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;
$this->installEntitySchema('user');
$this->installEntitySchema('node');
- $this->installConfig(['field']);
+ $this->installConfig(['system', 'field']);
// Set up the ConfigImporter object for testing.
$storage_comparer = new StorageComparer(
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(),
]);
// 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,
]);
'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.
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());
}
// 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.
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());
}