X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Ftests%2FDrupal%2FKernelTests%2FCore%2FConfig%2FConfigImportRenameValidationTest.php;h=f52b3956ab962d2a21dacf7fc0788aac8f39bae6;hb=refs%2Fheads%2Fd864;hp=e755d5fd88b4679d5e3ae46b8204998c5b5efdf6;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php b/web/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php index e755d5fd8..f52b3956a 100644 --- a/web/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php +++ b/web/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRenameValidationTest.php @@ -2,8 +2,7 @@ namespace Drupal\KernelTests\Core\Config; -use Drupal\Component\Utility\SafeMarkup; -use Drupal\Component\Utility\Unicode; +use Drupal\Component\Render\FormattableMarkup; use Drupal\Component\Uuid\Php; use Drupal\Core\Config\ConfigImporter; use Drupal\Core\Config\ConfigImporterException; @@ -40,7 +39,7 @@ class ConfigImportRenameValidationTest extends KernelTestBase { $this->installEntitySchema('user'); $this->installEntitySchema('node'); - $this->installConfig(['field']); + $this->installConfig(['system', 'field']); // Set up the ConfigImporter object for testing. $storage_comparer = new StorageComparer( @@ -67,7 +66,7 @@ class ConfigImportRenameValidationTest extends KernelTestBase { public function testRenameValidation() { // Create a test entity. $test_entity_id = $this->randomMachineName(); - $test_entity = entity_create('config_test', [ + $test_entity = \Drupal::entityTypeManager()->getStorage('config_test')->create([ 'id' => $test_entity_id, 'label' => $this->randomMachineName(), ]); @@ -82,7 +81,7 @@ class ConfigImportRenameValidationTest extends KernelTestBase { // Create a content type with a matching UUID in the active storage. $content_type = NodeType::create([ - 'type' => Unicode::strtolower($this->randomMachineName(16)), + 'type' => mb_strtolower($this->randomMachineName(16)), 'name' => $this->randomMachineName(), 'uuid' => $uuid, ]); @@ -95,7 +94,7 @@ class ConfigImportRenameValidationTest extends KernelTestBase { 'node.type.' . $content_type->id() . '::config_test.dynamic.' . $test_entity_id, ]; $renames = $this->configImporter->getUnprocessedConfiguration('rename'); - $this->assertIdentical($expected, $renames); + $this->assertSame($expected, $renames); // Try to import the configuration. We expect an exception to be thrown // because the staged entity is of a different type. @@ -106,7 +105,7 @@ class ConfigImportRenameValidationTest extends KernelTestBase { catch (ConfigImporterException $e) { $this->pass('Expected ConfigImporterException thrown when a renamed configuration entity does not match the existing entity type.'); $expected = [ - SafeMarkup::format('Entity type mismatch on rename. @old_type not equal to @new_type for existing configuration @old_name and staged configuration @new_name.', ['@old_type' => 'node_type', '@new_type' => 'config_test', '@old_name' => 'node.type.' . $content_type->id(), '@new_name' => 'config_test.dynamic.' . $test_entity_id]) + new FormattableMarkup('Entity type mismatch on rename. @old_type not equal to @new_type for existing configuration @old_name and staged configuration @new_name.', ['@old_type' => 'node_type', '@new_type' => 'config_test', '@old_name' => 'node.type.' . $content_type->id(), '@new_name' => 'config_test.dynamic.' . $test_entity_id]), ]; $this->assertEqual($expected, $this->configImporter->getErrors()); } @@ -135,10 +134,10 @@ class ConfigImportRenameValidationTest extends KernelTestBase { // UUIDs match. $this->configImporter->reset(); $expected = [ - 'config_test.old::config_test.new' + 'config_test.old::config_test.new', ]; $renames = $this->configImporter->getUnprocessedConfiguration('rename'); - $this->assertIdentical($expected, $renames); + $this->assertSame($expected, $renames); // Try to import the configuration. We expect an exception to be thrown // because the rename is for simple configuration. @@ -149,7 +148,7 @@ class ConfigImportRenameValidationTest extends KernelTestBase { catch (ConfigImporterException $e) { $this->pass('Expected ConfigImporterException thrown when simple configuration is renamed.'); $expected = [ - SafeMarkup::format('Rename operation for simple configuration. Existing configuration @old_name and staged configuration @new_name.', ['@old_name' => 'config_test.old', '@new_name' => 'config_test.new']) + new FormattableMarkup('Rename operation for simple configuration. Existing configuration @old_name and staged configuration @new_name.', ['@old_name' => 'config_test.old', '@new_name' => 'config_test.new']), ]; $this->assertEqual($expected, $this->configImporter->getErrors()); }