diff --git a/core/modules/block_content/src/Tests/BlockContentCreationTest.php b/core/modules/block_content/src/Tests/BlockContentCreationTest.php index df9760b..006ed35 100644 --- a/core/modules/block_content/src/Tests/BlockContentCreationTest.php +++ b/core/modules/block_content/src/Tests/BlockContentCreationTest.php @@ -74,7 +74,7 @@ public function testBlockContentCreation() { $this->drupalPostForm('block/add/basic', $edit, t('Save')); // Check that the Basic block has been created. - $this->assertRaw('A block with description ' . $edit['info[0][value]'] .' already exists.'); + $this->assertRaw('A custom block with block description ' . $edit['info[0][value]'] .' already exists.'); $this->assertResponse(200); } @@ -148,7 +148,7 @@ public function testBlockContentCreationMultipleViewModes() { $this->drupalPostForm('block/add/basic', $edit, t('Save')); // Check that the Basic block has been created. - $this->assertRaw('A block with description ' . $edit['info[0][value]'] .' already exists.'); + $this->assertRaw('A custom block with block description ' . $edit['info[0][value]'] .' already exists.'); $this->assertResponse(200); } diff --git a/core/modules/block_content/src/Tests/BlockContentValidationTest.php b/core/modules/block_content/src/Tests/BlockContentValidationTest.php index 585a705..2dee571 100644 --- a/core/modules/block_content/src/Tests/BlockContentValidationTest.php +++ b/core/modules/block_content/src/Tests/BlockContentValidationTest.php @@ -37,7 +37,7 @@ public function testValidation() { // Make sure the violation is on the info property $this->assertEqual($violations[0]->getPropertyPath(), 'info'); // Make sure the message is correct. - $this->assertEqual($violations[0]->getMessage(), 'A block with description ' . $block->label() . ' already exists.'); + $this->assertEqual($violations[0]->getMessage(), 'A custom block with block description ' . $block->label() . ' already exists.'); } } diff --git a/core/modules/comment/src/Tests/CommentBlockTest.php b/core/modules/comment/src/Tests/CommentBlockTest.php index e6eee69..c44589b 100644 --- a/core/modules/comment/src/Tests/CommentBlockTest.php +++ b/core/modules/comment/src/Tests/CommentBlockTest.php @@ -73,11 +73,13 @@ function testRecentCommentBlock() { // Test the only the 10 latest comments are shown and in the proper order. $this->assertNoText($comments[10]->getSubject(), 'Comment 11 not found in block.'); for ($i = 0; $i < 10; $i++) { - $this->assertText($comments[$i]->getSubject(), SafeMarkup::format('Comment @number found in block.', array('@number' => 10 - $i))); + $number = 10 - $i; + $this->assertText($comments[$i]->getSubject(), "Comment $number found in block."); if ($i > 1) { $previous_position = $position; $position = strpos($this->getRawContent(), $comments[$i]->getSubject()); - $this->assertTrue($position > $previous_position, SafeMarkup::format('Comment @a appears after comment @b', array('@a' => 10 - $i, '@b' => 11 - $i))); + $last_number = $number + 1; + $this->assertTrue($position > $previous_position, "Comment $number appears after comment $last_number"); } $position = strpos($this->getRawContent(), $comments[$i]->getSubject()); } diff --git a/core/modules/comment/src/Tests/CommentFieldAccessTest.php b/core/modules/comment/src/Tests/CommentFieldAccessTest.php index 2a1e5de..2d221cb 100644 --- a/core/modules/comment/src/Tests/CommentFieldAccessTest.php +++ b/core/modules/comment/src/Tests/CommentFieldAccessTest.php @@ -215,7 +215,7 @@ public function testAccessToAdministrativeFields() { $username = $set['user']->getUsername(); $state = $may_update ? 'can' : 'cannot'; $comment_subject = $set['comment']->getSubject(); - $this->assertEqual($may_view, $set['user']->hasPermission('administer comments') || ($set['comment']->isPublished() && $set['user']->hasPermission('access comments')), "User $username $state view field $field on comment $comment_subject"); + $this->assertTrue($may_view, "User $username can view field $field on comment $comment_subject"); $this->assertEqual($may_update, $set['user']->hasPermission('administer comments'), "User $username $state update field $field on comment $comment_subject"); } } diff --git a/core/modules/config/src/Tests/ConfigCRUDTest.php b/core/modules/config/src/Tests/ConfigCRUDTest.php index 6af82fa..9db6c62 100644 --- a/core/modules/config/src/Tests/ConfigCRUDTest.php +++ b/core/modules/config/src/Tests/ConfigCRUDTest.php @@ -287,9 +287,7 @@ public function testDataTypes() { $this->fail('No Exception thrown upon saving invalid data type.'); } catch (UnsupportedDataTypeConfigException $e) { - $this->pass(SafeMarkup::format('%class thrown upon saving invalid data type.', array( - '%class' => get_class($e), - ))); + $this->pass("{get_class($e)} thrown upon saving invalid data type."); } // Test that setting an unsupported type for a config object with no schema @@ -304,9 +302,7 @@ public function testDataTypes() { $this->fail('No Exception thrown upon saving invalid data type.'); } catch (UnsupportedDataTypeConfigException $e) { - $this->pass(SafeMarkup::format('%class thrown upon saving invalid data type.', array( - '%class' => get_class($e), - ))); + $this->pass("{get_class($e)} thrown upon saving invalid data type."); } } diff --git a/core/modules/config/src/Tests/ConfigEntityTest.php b/core/modules/config/src/Tests/ConfigEntityTest.php index 13ab721..7734c25 100644 --- a/core/modules/config/src/Tests/ConfigEntityTest.php +++ b/core/modules/config/src/Tests/ConfigEntityTest.php @@ -151,9 +151,7 @@ function testCRUD() { )); try { $id_length_config_test->save(); - $this->pass(SafeMarkup::format("config_test entity with ID length @length was saved.", array( - '@length' => strlen($id_length_config_test->id())) - )); + $this->pass('config_test entity with ID length ' . strlen($id_length_config_test->id()) . ' was saved.'); } catch (ConfigEntityIdLengthException $e) { $this->fail($e->getMessage()); @@ -165,9 +163,7 @@ function testCRUD() { )); try { $id_length_config_test->save(); - $this->pass(SafeMarkup::format("config_test entity with ID length @length was saved.", array( - '@length' => strlen($id_length_config_test->id()), - ))); + $this->pass('config_test entity with ID length ' . strlen($id_length_config_test->id()) . ' was saved.'); } catch (ConfigEntityIdLengthException $e) { $this->fail($e->getMessage()); @@ -179,16 +175,10 @@ function testCRUD() { )); try { $status = $id_length_config_test->save(); - $this->fail(SafeMarkup::format("config_test entity with ID length @length exceeding the maximum allowed length of @max saved successfully", array( - '@length' => strlen($id_length_config_test->id()), - '@max' => static::MAX_ID_LENGTH, - ))); + $this->fail('config_test entity with ID length ' . strlen($id_length_config_test->id()) . ' exceeding the maximum allowed length of ' . static::MAX_ID_LENGTH . ' saved successfully'); } catch (ConfigEntityIdLengthException $e) { - $this->pass(SafeMarkup::format("config_test entity with ID length @length exceeding the maximum allowed length of @max failed to save", array( - '@length' => strlen($id_length_config_test->id()), - '@max' => static::MAX_ID_LENGTH, - ))); + $this->pass('config_test entity with ID length ' . strlen($id_length_config_test->id()) . ' exceeding the maximum allowed length of @' . static::MAX_ID_LENGTH . ' failed to save'); } // Ensure that creating an entity with the same id as an existing one is not diff --git a/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php b/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php index c461f30..be71b06 100644 --- a/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php +++ b/core/modules/config/src/Tests/ConfigImportRenameValidationTest.php @@ -110,7 +110,7 @@ public function testRenameValidation() { catch (ConfigImporterException $e) { $this->pass('Expected ConfigImporterException thrown when a renamed configuration entity does not match the existing entity type.'); $expected = array( - SafeMarkup::format('Entity type mismatch on rename. @old_type not equal to @new_type for existing configuration @old_name and staged configuration @new_name.', array('@old_type' => 'node_type', '@new_type' => 'config_test', '@old_name' => 'node.type.' . $content_type->id(), '@new_name' => 'config_test.dynamic.' . $test_entity_id)) + 'Entity type mismatch on rename. node_type not equal to config_test for existing configuration node.type.' . $content_type->id() . ' and staged configuration config_test.dynamic.' . $test_entity_id ); $this->assertEqual($expected, $this->configImporter->getErrors()); } @@ -153,7 +153,7 @@ public function testRenameSimpleConfigValidation() { catch (ConfigImporterException $e) { $this->pass('Expected ConfigImporterException thrown when simple configuration is renamed.'); $expected = array( - SafeMarkup::format('Rename operation for simple configuration. Existing configuration @old_name and staged configuration @new_name.', array('@old_name' => 'config_test.old', '@new_name' => 'config_test.new')) + 'Rename operation for simple configuration. Existing configuration config_test and staged configuration config_test.new.', ); $this->assertEqual($expected, $this->configImporter->getErrors()); } diff --git a/core/modules/config/src/Tests/ConfigImporterTest.php b/core/modules/config/src/Tests/ConfigImporterTest.php index 3fca8c0..1f865e5 100644 --- a/core/modules/config/src/Tests/ConfigImporterTest.php +++ b/core/modules/config/src/Tests/ConfigImporterTest.php @@ -250,7 +250,7 @@ function testSecondaryWritePrimaryFirst() { $logs = $this->configImporter->getErrors(); $this->assertEqual(count($logs), 1); - $this->assertEqual($logs[0], SafeMarkup::format('Deleted and replaced configuration entity "@name"', array('@name' => $name_secondary))); + $this->assertEqual($logs[0], 'Deleted and replaced configuration entity "' . $name_secondary . '"'); } /** @@ -299,9 +299,7 @@ function testSecondaryWriteSecondaryFirst() { $this->assertEqual($logs[0], Html::escape("Unexpected error during import with operation create for $name_primary: 'config_test' entity with ID 'secondary' already exists.")); } - /** - * Tests that secondary updates for deleted files work as expected. - */ + function testSecondaryUpdateDeletedDeleterFirst() { $name_deleter = 'config_test.dynamic.deleter'; $name_deletee = 'config_test.dynamic.deletee'; @@ -378,9 +376,8 @@ function testSecondaryUpdateDeletedDeleterFirst() { $logs = $this->configImporter->getErrors(); $this->assertEqual(count($logs), 1); - $this->assertEqual($logs[0], SafeMarkup::format('Update target "@name" is missing.', array('@name' => $name_deletee))); + $this->assertEqual($logs[0], 'Update target "' . $name_deletee . '" is missing.'); } - /** * Tests that secondary updates for deleted files work as expected. * diff --git a/core/modules/system/src/Tests/Entity/EntityTranslationTest.php b/core/modules/system/src/Tests/Entity/EntityTranslationTest.php index 076a3c4..66281d1 100644 --- a/core/modules/system/src/Tests/Entity/EntityTranslationTest.php +++ b/core/modules/system/src/Tests/Entity/EntityTranslationTest.php @@ -169,17 +169,17 @@ protected function doTestMultilingualProperties($entity_type) { $this->assertEqual($default_langcode, LanguageInterface::LANGCODE_NOT_SPECIFIED, "$entity_type: Entity created as language neutral."); $field = $entity->getTranslation(LanguageInterface::LANGCODE_DEFAULT)->get('name'); $this->assertEqual($name, $field->value, "$entity_type: The entity name has been correctly stored as language neutral."); - $this->assertEqual($default_langcode, $field->getLangcode(), "$entity_type: The field object has the expect langcode."); + $this->assertEqual($default_langcode, $field->getLangcode(), "$entity_type: The field object has the expected langcode."); $this->assertEqual($uid, $entity->getTranslation(LanguageInterface::LANGCODE_DEFAULT)->get('user_id')->target_id, "$entity_type: The entity author has been correctly stored as language neutral."); $translation = $entity->getTranslation(LanguageInterface::LANGCODE_DEFAULT); $field = $translation->get('name'); $this->assertEqual($name, $field->value, "$entity_type: The entity name defaults to neutral language."); - $this->assertEqual($default_langcode, $field->getLangcode(), "$entity_type: The field object has the expect langcode."); + $this->assertEqual($default_langcode, $field->getLangcode(), "$entity_type: The field object has the expected langcode."); $this->assertEqual($uid, $translation->get('user_id')->target_id, "$entity_type: The entity author defaults to neutral language."); $field = $entity->get('name'); $this->assertEqual($name, $field->value, "$entity_type: The entity name can be retrieved without specifying a language."); - $this->assertEqual($default_langcode, $field->getLangcode(), "$entity_type: The field object has the expect langcode."); + $this->assertEqual($default_langcode, $field->getLangcode(), "$entity_type: The field object has the expected langcode."); $this->assertEqual($uid, $entity->get('user_id')->target_id, "$entity_type: The entity author can be retrieved without specifying a language."); // Create a language-aware entity and check that properties are stored @@ -191,7 +191,7 @@ protected function doTestMultilingualProperties($entity_type) { $this->assertEqual($default_langcode, $langcode, "$entity_type: Entity created as language specific."); $field = $entity->getTranslation($langcode)->get('name'); $this->assertEqual($name, $field->value, "$entity_type: The entity name has been correctly stored as a language-aware property."); - $this->assertEqual($default_langcode, $field->getLangcode(), "$entity_type: The field object has the expect langcode."); + $this->assertEqual($default_langcode, $field->getLangcode(), "$entity_type: The field object has the expected langcode."); $this->assertEqual($uid, $entity->getTranslation($langcode)->get('user_id')->target_id, "$entity_type: The entity author has been correctly stored as a language-aware property."); // Create property translations. @@ -666,7 +666,7 @@ function testFieldDefinitions() { $this->assertTrue(!isset($base_field_definitions['id']->translatable), 'Translatability for the id field is not defined.'); $this->assertFalse($definitions['id']->isTranslatable(), 'Field translatability is disabled by default.'); - // Check that entity id keys have the expect translatability. + // Check that entity id keys have the expected translatability. $translatable_fields = array( 'id' => TRUE, 'uuid' => TRUE,