diff --git a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php index 96bc18b..b1a775c 100644 --- a/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php +++ b/core/lib/Drupal/Core/Config/Entity/ConfigStorageController.php @@ -238,7 +238,7 @@ public function create(array $values) { // Check to see if an entity already exists. $config = config($this->getConfigPrefix() . $entity->id()); if (!$config->isNew()) { - throw new EntityMalformedException('The entity ID is not unique.'); + throw new EntityMalformedException(format_string('The @type entity ID (@id) is not unique.', array('@type' => $this->entityType, '@id' => $entity->id()))); } } // Mark this entity as new, so isNew() returns TRUE. diff --git a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php index 0091300..228cb69 100644 --- a/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php +++ b/core/modules/breakpoint/lib/Drupal/breakpoint/Tests/BreakpointThemeTest.php @@ -40,19 +40,7 @@ public function setUp() { */ public function testThemeBreakpoints() { // Verify the breakpoint group for breakpoint_test_theme was created. - $breakpoint_group_obj = entity_create('breakpoint_group', array( - 'label' => 'Breakpoint test theme', - 'name' => 'breakpoint_test_theme', - 'source' => 'breakpoint_test_theme', - 'sourceType' => Breakpoint::SOURCE_TYPE_THEME, - 'id' => Breakpoint::SOURCE_TYPE_THEME . '.breakpoint_test_theme.breakpoint_test_theme', - )); - $breakpoint_group_obj->breakpoints = array( - 'theme.breakpoint_test_theme.mobile' => array(), - 'theme.breakpoint_test_theme.narrow' => array(), - 'theme.breakpoint_test_theme.wide' => array(), - 'theme.breakpoint_test_theme.tv' => array(), - ); + $breakpoint_group_obj = entity_load('breakpoint_group', Breakpoint::SOURCE_TYPE_THEME . '.breakpoint_test_theme.breakpoint_test_theme'); // Verify we can load this breakpoint defined by the theme. $this->verifyBreakpointGroup($breakpoint_group_obj); @@ -67,18 +55,7 @@ public function testThemeBreakpoints() { */ public function testThemeBreakpointGroup() { // Verify the breakpoint group 'test' was created by breakpoint_test_theme. - $breakpoint_group_obj = entity_create('breakpoint_group', array( - 'label' => 'Test Theme', - 'name' => 'test', - 'sourceType' => Breakpoint::SOURCE_TYPE_THEME, - 'source' => 'breakpoint_test_theme', - 'id' => Breakpoint::SOURCE_TYPE_THEME . '.breakpoint_test_theme.test', - )); - $breakpoint_group_obj->breakpoints = array( - 'theme.breakpoint_test_theme.mobile' => array('1.5x', '2.x'), - 'theme.breakpoint_test_theme.narrow' => array(), - 'theme.breakpoint_test_theme.wide' => array(), - ); + $breakpoint_group_obj = entity_load('breakpoint_group', Breakpoint::SOURCE_TYPE_THEME . '.breakpoint_test_theme.test'); // Verify we can load this breakpoint defined by the theme. $this->verifyBreakpointGroup($breakpoint_group_obj); @@ -92,24 +69,9 @@ public function testThemeBreakpointGroup() { * Test the breakpoints defined by the custom group in the module. */ public function testThemeBreakpointGroupModule() { - // Call the import manually, since the testbot needs to enable the module - // first, otherwise the theme isn't detected. - _breakpoint_import_breakpoint_groups('breakpoint_theme_test', Breakpoint::SOURCE_TYPE_MODULE); - - // Verify the breakpoint group 'module_test' was created by + // Verify the breakpoint group 'module_test' was created by the // breakpoint_theme_test module. - $breakpoint_group_obj = entity_create('breakpoint_group', array( - 'label' => 'Test Module', - 'name' => 'module_test', - 'sourceType' => Breakpoint::SOURCE_TYPE_MODULE, - 'source' => 'breakpoint_theme_test', - 'id' => Breakpoint::SOURCE_TYPE_MODULE . '.breakpoint_theme_test.module_test', - )); - $breakpoint_group_obj->breakpoints = array( - 'theme.breakpoint_test_theme.mobile' => array(), - 'theme.breakpoint_test_theme.narrow' => array(), - 'theme.breakpoint_test_theme.wide' => array(), - ); + $breakpoint_group_obj = entity_load('breakpoint_group', Breakpoint::SOURCE_TYPE_MODULE . '.breakpoint_theme_test.module_test'); // Verify we can load this breakpoint defined by the theme. $this->verifyBreakpointGroup($breakpoint_group_obj); diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php index efcbf0e..ddfa7cc 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigEntityTest.php @@ -137,24 +137,6 @@ function testCRUD() { $this->assertIdentical($config_test->isNew(), FALSE); $this->assertIdentical($config_test->getOriginalID(), $expected['id']); - // Re-create the entity with the same ID and verify updated status. - $same_id = entity_create('config_test', array( - 'id' => $config_test->id(), - )); - $this->assertIdentical($same_id->isNew(), TRUE); - $status = $same_id->save(); - $this->assertIdentical($status, SAVED_UPDATED); - - // Verify that the entity was overwritten. - $same_id = entity_load('config_test', $config_test->id()); - $this->assertIdentical($same_id->id(), $config_test->id()); - // Note: Reloading loads from FileStorage, and FileStorage enforces strings. - $this->assertIdentical($same_id->label(), ''); - $this->assertNotEqual($same_id->uuid(), $config_test->uuid()); - - // Revert to previous state. - $config_test->save(); - // Verify that renaming the ID returns correct status and properties. $ids = array($expected['id'], 'second_' . $this->randomName(4), 'third_' . $this->randomName(4)); for ($i = 1; $i < 3; $i++) { diff --git a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php index 66984cd..4242bcc 100644 --- a/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php +++ b/core/modules/config/lib/Drupal/config/Tests/ConfigImportTest.php @@ -8,6 +8,7 @@ namespace Drupal\config\Tests; use Drupal\simpletest\DrupalUnitTestBase; +use Drupal\Core\Entity\EntityMalformedException; /** * Tests importing configuration from files into active configuration. @@ -199,7 +200,11 @@ function testUpdated() { */ function testDuplicate() { $this->assertEqual(config('config_test.dynamic.default')->get('label'), 'Default', "Configuration object label is 'Default'."); - module_enable(array('config_test_duplicate')); + try { + module_enable(array('config_test_duplicate')); + } + catch (EntityMalformedException $e) { + } $this->assertEqual(config('config_test.dynamic.default')->get('label'), 'Default', 'Configuration object is not silently overwritten on import.'); } diff --git a/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php b/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php index 5d31134..b568f7e 100644 --- a/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php +++ b/core/modules/views/lib/Drupal/views/Tests/ViewStorageTest.php @@ -143,6 +143,8 @@ protected function createTests() { // Create a new View instance with config values. $values = config('views.view.test_view_storage')->get(); + // Change the machine name to prevent a conflict. + $values['name'] = strtolower($this->randomName(8)); $created = $this->controller->create($values); $this->assertTrue($created instanceof View, 'Created object is a View.'); diff --git a/core/modules/views/tests/views_test_config/test_views/views.view.test_field_type.yml b/core/modules/views/tests/views_test_config/test_views/views.view.test_field_type.yml deleted file mode 100644 index c9172bc..0000000 --- a/core/modules/views/tests/views_test_config/test_views/views.view.test_field_type.yml +++ /dev/null @@ -1,20 +0,0 @@ -api_version: '3.0' -base_table: node -core: '8' -description: '' -disabled: '0' -display: - default: - display_options: - fields: - type: - field: type - id: type - table: node - display_plugin: default - display_title: Master - id: default - position: '0' -human_name: '' -name: test_field_type -tag: ''