diff --git a/core/modules/simpletest/src/AssertHelperTrait.php b/core/modules/simpletest/src/AssertHelperTrait.php index d477081..dc68e23 100644 --- a/core/modules/simpletest/src/AssertHelperTrait.php +++ b/core/modules/simpletest/src/AssertHelperTrait.php @@ -23,7 +23,7 @@ * @return mixed * The input value, with MarkupInterface objects casted to string. */ - protected function castSafeStrings($value) { + protected static function castSafeStrings($value) { if ($value instanceof MarkupInterface) { $value = (string) $value; } diff --git a/core/tests/Drupal/KernelTests/AssertLegacyTrait.php b/core/tests/Drupal/KernelTests/AssertLegacyTrait.php index 81b6935..6165871 100644 --- a/core/tests/Drupal/KernelTests/AssertLegacyTrait.php +++ b/core/tests/Drupal/KernelTests/AssertLegacyTrait.php @@ -59,7 +59,7 @@ public static function assertFalse($actual, $message = '') { * instead. */ protected function assertEqual($actual, $expected, $message = '') { - $this->assertEquals($this->castSafeStrings($expected), $this->castSafeStrings($actual), $message); + $this->assertEquals($expected, $actual, $message); } /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php index 1096ce2..c94d124 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityKernelTestBase.php @@ -9,6 +9,8 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\KernelTests\KernelTestBase; +use Drupal\user\Entity\Role; +use Drupal\user\Entity\User; /** * Defines an abstract test base for entity kernel tests. @@ -99,7 +101,7 @@ protected function setUp() { protected function createUser($values = array(), $permissions = array()) { if ($permissions) { // Create a new role and apply permissions to it. - $role = entity_create('user_role', array( + $role = Role::create(array( 'id' => strtolower($this->randomMachineName(8)), 'label' => $this->randomMachineName(8), )); @@ -108,7 +110,7 @@ protected function createUser($values = array(), $permissions = array()) { $values['roles'][] = $role->id(); } - $account = entity_create('user', $values + array( + $account = User::create($values + array( 'name' => $this->randomMachineName(), 'status' => 1, )); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php index 0b60f93..59eb785 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php @@ -12,7 +12,6 @@ use Drupal\entity_test\Entity\EntityTestMulRev; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; -use Drupal\KernelTests\Core\Entity\EntityLanguageTestBase; use Drupal\language\Entity\ConfigurableLanguage; /** diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php index fe8b5bd..1677b99 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTypeConstraintValidatorTest.php @@ -7,7 +7,6 @@ namespace Drupal\KernelTests\Core\Entity; -use Drupal\system\Tests\Entity\EntityUnitTestBase; use Drupal\system\Tests\TypedData; use Drupal\Core\TypedData\DataDefinition; diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php index e2be94b..30fcb20 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php @@ -12,7 +12,6 @@ use Drupal\Core\Entity\Exception\FieldStorageDefinitionUpdateForbiddenException; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; -use Drupal\system\Tests\Entity\EntityUnitTestBase; /** * Tests Field SQL Storage . diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php index 0941a94..0adee64 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldTranslationSqlStorageTest.php @@ -10,7 +10,6 @@ use Drupal\Core\Entity\FieldableEntityInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\field\Entity\FieldStorageConfig; -use Drupal\KernelTests\Core\Entity\EntityLanguageTestBase; /** * Tests Field translation SQL Storage. diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index e593fa7..d20f341 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -1147,4 +1147,14 @@ public function __sleep() { return []; } + /** + * {@inheritdoc} + */ + public static function assertEquals($expected, $actual, $message = '', $delta = 0.0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false) { + $expected = static::castSafeStrings($expected); + $actual = static::castSafeStrings($actual); + parent::assertEquals($expected, $actual, $message, $delta, $maxDepth, $canonicalize, $ignoreCase); + } + + }