diff --git a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php index a8f33aa..349c8ee 100644 --- a/core/modules/language/src/Tests/LanguageConfigurationElementTest.php +++ b/core/modules/language/src/Tests/LanguageConfigurationElementTest.php @@ -152,39 +152,6 @@ public function testDefaultLangcode() { } /** - * Tests that the configuration is updated when the node type is changed. - */ - public function testNodeTypeUpdate() { - // Create the article content type first if the profile used is not the - // standard one. - if ($this->profile != 'standard') { - $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article')); - } - $admin_user = $this->drupalCreateUser(array('administer content types')); - $this->drupalLogin($admin_user); - $edit = array( - 'language_configuration[langcode]' => 'current_interface', - 'language_configuration[language_alterable]' => TRUE, - ); - $this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type')); - // Check the language default configuration for the articles. - $configuration = ContentLanguageSettings::loadByEntityTypeBundle('node', 'article'); - $uuid = $configuration->uuid(); - $this->assertEqual($configuration->getDefaultLangcode(), 'current_interface', 'The default language configuration has been saved on the Article content type.'); - $this->assertTrue($configuration->isLanguageAlterable(), 'The alterable language configuration has been saved on the Article content type.'); - // Rename the article content type. - $edit = array( - 'type' => 'article_2' - ); - $this->drupalPostForm('admin/structure/types/manage/article', $edit, t('Save content type')); - // Check that we still have the settings for the new node type. - $configuration = ContentLanguageSettings::loadByEntityTypeBundle('node', 'article_2'); - $this->assertEqual($configuration->getDefaultLangcode(), 'current_interface', 'The default language configuration has been kept on the new Article content type.'); - $this->assertTrue($configuration->isLanguageAlterable(), 'The alterable language configuration has been kept on the new Article content type.'); - $this->assertEqual($configuration->uuid(), $uuid, 'The language configuration uuid has been kept on the new Article content type.'); - } - - /** * Tests the language settings are deleted on bundle delete. */ public function testNodeTypeDelete() { @@ -219,39 +186,4 @@ public function testNodeTypeDelete() { $this->assertFalse($configuration, 'The language configuration was deleted after bundle was deleted.'); } - /** - * Tests that the configuration is updated when a vocabulary is changed. - */ - public function testTaxonomyVocabularyUpdate() { - $vocabulary = entity_create('taxonomy_vocabulary', array( - 'name' => 'Country', - 'vid' => 'country', - )); - $vocabulary->save(); - - $admin_user = $this->drupalCreateUser(array('administer taxonomy')); - $this->drupalLogin($admin_user); - $edit = array( - 'default_language[langcode]' => 'current_interface', - 'default_language[language_alterable]' => TRUE, - ); - $this->drupalPostForm('admin/structure/taxonomy/manage/country', $edit, t('Save')); - - // Check the language default configuration. - $configuration = ContentLanguageSettings::loadByEntityTypeBundle('taxonomy_term', 'country'); - $uuid = $configuration->uuid(); - $this->assertEqual($configuration->getDefaultLangcode(), 'current_interface', 'The default language configuration has been saved on the Country vocabulary.'); - $this->assertTrue($configuration->isLanguageAlterable(), 'The alterable language configuration has been saved on the Country vocabulary.'); - // Rename the vocabulary. - $edit = array( - 'vid' => 'nation' - ); - $this->drupalPostForm('admin/structure/taxonomy/manage/country', $edit, t('Save')); - // Check that we still have the settings for the new vocabulary. - $configuration = ContentLanguageSettings::loadByEntityTypeBundle('taxonomy_term', 'nation'); - $this->assertEqual($configuration->getDefaultLangcode(), 'current_interface', 'The default language configuration has been kept on the new Country vocabulary.'); - $this->assertTrue($configuration->isLanguageAlterable(), 'The alterable language configuration has been kept on the new Country vocabulary.'); - $this->assertEqual($configuration->uuid(), $uuid, 'The language configuration uuid has been kept on the new Country vocabulary.'); - } - } diff --git a/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php b/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php deleted file mode 100644 index 75e4f0d..0000000 --- a/core/modules/node/src/Tests/NodeTypeRenameConfigImportTest.php +++ /dev/null @@ -1,145 +0,0 @@ -webUser = $this->drupalCreateUser(array('synchronize configuration')); - $this->drupalLogin($this->webUser); - } - - /** - * Tests configuration renaming. - */ - public function testConfigurationRename() { - $content_type = $this->drupalCreateContentType(array( - 'type' => Unicode::strtolower($this->randomMachineName(16)), - 'name' => $this->randomMachineName(), - )); - $staged_type = $content_type->id(); - - // Check the default status value for a node of this type. - $node = entity_create('node', array('type' => $staged_type)); - $this->assertTrue($node->status->value, 'Node status defaults to TRUE.'); - - // Override a core base field. - $fields = \Drupal::entityManager()->getFieldDefinitions($content_type->getEntityType()->getBundleOf(), $content_type->id()); - $fields['status']->getConfig($content_type->id())->setDefaultValue(FALSE)->save(); - - $active = $this->container->get('config.storage'); - $staging = $this->container->get('config.storage.staging'); - - $config_name = $content_type->getEntityType()->getConfigPrefix() . '.' . $content_type->id(); - // Emulate a staging operation. - $this->copyConfig($active, $staging); - - // Change the machine name of the content type. - $content_type->set('type', Unicode::strtolower($this->randomMachineName(8))); - $content_type->save(); - $active_type = $content_type->id(); - - // Ensure the base field override has been renamed and the value is correct. - $node = entity_create('node', array('type' => $active_type)); - $this->assertFalse($node->status->value, 'Node status defaults to FALSE.'); - - $renamed_config_name = $content_type->getEntityType()->getConfigPrefix() . '.' . $content_type->id(); - $this->assertTrue($active->exists($renamed_config_name), 'The content type has the new name in the active store.'); - $this->assertFalse($active->exists($config_name), "The content type's old name does not exist active store."); - - $this->configImporter()->reset(); - $this->assertEqual(0, count($this->configImporter()->getUnprocessedConfiguration('create')), 'There are no configuration items to create.'); - $this->assertEqual(0, count($this->configImporter()->getUnprocessedConfiguration('delete')), 'There are no configuration items to delete.'); - $this->assertEqual(0, count($this->configImporter()->getUnprocessedConfiguration('update')), 'There are no configuration items to update.'); - - // We expect that changing the machine name of the content type will - // rename five configuration entities: the node type, the body field - // instance, two entity form displays, and the entity view display. - // @see \Drupal\node\Entity\NodeType::postSave() - $expected = array( - 'node.type.' . $active_type . '::node.type.' . $staged_type, - 'core.base_field_override.node.' . $active_type . '.status::core.base_field_override.node.' . $staged_type . '.status', - 'core.entity_form_display.node.' . $active_type . '.default::core.entity_form_display.node.' . $staged_type . '.default', - 'core.entity_view_display.node.' . $active_type . '.default::core.entity_view_display.node.' . $staged_type . '.default', - 'core.entity_view_display.node.' . $active_type . '.teaser::core.entity_view_display.node.' . $staged_type . '.teaser', - 'field.field.node.' . $active_type . '.body::field.field.node.' . $staged_type . '.body', - ); - $renames = $this->configImporter()->getUnprocessedConfiguration('rename'); - $this->assertIdentical($expected, $renames); - - $this->drupalGet('admin/config/development/configuration'); - foreach ($expected as $rename) { - $names = $this->configImporter()->getStorageComparer()->extractRenameNames($rename); - $this->assertText(SafeMarkup::format('@source_name to @target_name', array('@source_name' => $names['old_name'], '@target_name' => $names['new_name']))); - // Test that the diff link is present for each renamed item. - $href = \Drupal::urlGenerator()->getPathFromRoute('config.diff', array('source_name' => $names['old_name'], 'target_name' => $names['new_name'])); - $this->assertLinkByHref($href); - $hrefs[$rename] = $href; - } - - // Ensure that the diff works for each renamed item. - foreach ($hrefs as $rename => $href) { - $this->drupalGet($href); - $names = $this->configImporter()->getStorageComparer()->extractRenameNames($rename); - $config_entity_type = \Drupal::service('config.manager')->getEntityTypeIdByName($names['old_name']); - $entity_type = \Drupal::entityManager()->getDefinition($config_entity_type); - $old_id = ConfigEntityStorage::getIDFromConfigName($names['old_name'], $entity_type->getConfigPrefix()); - $new_id = ConfigEntityStorage::getIDFromConfigName($names['new_name'], $entity_type->getConfigPrefix()); - - // Because table columns can be on multiple lines, need to assert a regex - // pattern rather than normal text. - $id_key = $entity_type->getKey('id'); - $text = "$id_key: $old_id"; - $this->assertTextPattern('/\-\s+' . preg_quote($text, '/') . '/', "'-$text' found."); - $text = "$id_key: $new_id"; - $this->assertTextPattern('/\+\s+' . preg_quote($text, '/') . '/', "'+$text' found."); - } - - // Run the import. - $this->drupalPostForm('admin/config/development/configuration', array(), t('Import all')); - $this->assertText(t('There are no configuration changes to import.')); - - $this->assertFalse(NodeType::load($active_type), 'The content no longer exists with the old name.'); - $content_type = NodeType::load($staged_type); - $this->assertIdentical($staged_type, $content_type->id()); - - // Ensure the base field override has been renamed and the value is correct. - $node = entity_create('node', array('type' => $staged_type)); - $this->assertFALSE($node->status->value, 'Node status defaults to FALSE.'); - } - -}