Drupal 8.0.0 beta 12. More info: https://www.drupal.org/node/2514176

This commit is contained in:
Pantheon Automation 2015-08-17 17:00:26 -07:00 committed by Greg Anderson
commit 9921556621
13277 changed files with 1459781 additions and 0 deletions

View file

@ -0,0 +1,70 @@
<?php
/**
* @file
* Contains \Drupal\comment\Tests\CommentStringIdEntitiesTest.
*/
namespace Drupal\comment\Tests;
use Drupal\comment\Entity\CommentType;
use Drupal\simpletest\KernelTestBase;
/**
* Tests that comment fields cannot be added to entities with non-integer IDs.
*
* @group comment
*/
class CommentStringIdEntitiesTest extends KernelTestBase {
/**
* Modules to install.
*
* @var array
*/
public static $modules = array(
'comment',
'user',
'field',
'field_ui',
'entity_test',
'text',
);
protected function setUp() {
parent::setUp();
$this->installEntitySchema('comment');
$this->installSchema('comment', array('comment_entity_statistics'));
// Create the comment body field storage.
$this->installConfig(array('field'));
}
/**
* Tests that comment fields cannot be added entities with non-integer IDs.
*/
public function testCommentFieldNonStringId() {
try {
$bundle = CommentType::create(array(
'id' => 'foo',
'label' => 'foo',
'description' => '',
'target_entity_type_id' => 'entity_test_string_id',
));
$bundle->save();
$field_storage = entity_create('field_storage_config', array(
'field_name' => 'foo',
'entity_type' => 'entity_test_string_id',
'settings' => array(
'comment_type' => 'entity_test_string_id',
),
'type' => 'comment',
));
$field_storage->save();
$this->fail('Did not throw an exception as expected.');
}
catch (\UnexpectedValueException $e) {
$this->pass('Exception thrown when trying to create comment field on Entity Type with string ID.');
}
}
}