diff --git a/core/modules/comment/tests/src/Functional/CommentTestBase.php b/core/modules/comment/tests/src/Functional/CommentTestBase.php index 8d7c817df859888e1938059517b5c774f6ef4e92..abdae813e0eedb5d402cd8efb939b979da96446f 100644 --- a/core/modules/comment/tests/src/Functional/CommentTestBase.php +++ b/core/modules/comment/tests/src/Functional/CommentTestBase.php @@ -249,8 +249,6 @@ public function setCommentSubject($enabled) { $form_display->removeComponent('subject'); } $form_display->save(); - // Display status message. - $this->pass('Comment subject ' . ($enabled ? 'enabled' : 'disabled') . '.'); } /** @@ -336,8 +334,6 @@ public function setCommentSettings($name, $value, $message, $field_name = 'comme $field = FieldConfig::loadByName('node', 'article', $field_name); $field->setSetting($name, $value); $field->save(); - // Display status message. - $this->pass($message); } /** diff --git a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php index 117da558d239f1a32d603f4ecd53f27ba52c3850..9430b95a39faf900284617e0148230c1c03ab0f6 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityCacheTagsTestBase.php @@ -382,7 +382,6 @@ public function testReferencedEntity() { $nonempty_entity_listing_cache_tags = Cache::mergeTags($nonempty_entity_listing_cache_tags, $this->getAdditionalCacheTagsForEntityListing($this->entity)); $nonempty_entity_listing_cache_tags = Cache::mergeTags($nonempty_entity_listing_cache_tags, $page_cache_tags); - $this->pass("Test referencing entity.", 'Debug'); $this->verifyPageCache($referencing_entity_url, 'MISS'); // Verify a cache hit, but also the presence of the correct cache tags. @@ -405,7 +404,6 @@ public function testReferencedEntity() { } $this->verifyRenderCache($cid, $referencing_entity_cache_tags, $redirected_cid); - $this->pass("Test non-referencing entity.", 'Debug'); $this->verifyPageCache($non_referencing_entity_url, 'MISS'); // Verify a cache hit, but also the presence of the correct cache tags. $this->verifyPageCache($non_referencing_entity_url, 'HIT', Cache::mergeTags($non_referencing_entity_cache_tags, $page_cache_tags)); @@ -414,7 +412,6 @@ public function testReferencedEntity() { $cid = $this->createCacheId($cache_keys, $entity_cache_contexts); $this->verifyRenderCache($cid, $non_referencing_entity_cache_tags); - $this->pass("Test listing of referencing entities.", 'Debug'); // Prime the page cache for the listing of referencing entities. $this->verifyPageCache($listing_url, 'MISS'); @@ -423,7 +420,6 @@ public function testReferencedEntity() { $expected_tags = Cache::mergeTags($expected_tags, $page_cache_tags_referencing_entity); $this->verifyPageCache($listing_url, 'HIT', $expected_tags); - $this->pass("Test empty listing.", 'Debug'); // Prime the page cache for the empty listing. $this->verifyPageCache($empty_entity_listing_url, 'MISS'); // Verify a cache hit, but also the presence of the correct cache tags. @@ -432,7 +428,6 @@ public function testReferencedEntity() { $contexts_in_header = $this->drupalGetHeader('X-Drupal-Cache-Contexts'); $this->assertEqual(Cache::mergeContexts($page_cache_contexts, $this->getAdditionalCacheContextsForEntityListing()), empty($contexts_in_header) ? [] : explode(' ', $contexts_in_header)); - $this->pass("Test listing containing referenced entity.", 'Debug'); // Prime the page cache for the listing containing the referenced entity. $this->verifyPageCache($nonempty_entity_listing_url, 'MISS', $nonempty_entity_listing_cache_tags); // Verify a cache hit, but also the presence of the correct cache tags. @@ -443,7 +438,6 @@ public function testReferencedEntity() { // Verify that after modifying the referenced entity, there is a cache miss // for every route except the one for the non-referencing entity. - $this->pass("Test modification of referenced entity.", 'Debug'); $this->entity->save(); $this->verifyPageCache($referencing_entity_url, 'MISS'); $this->verifyPageCache($listing_url, 'MISS'); @@ -460,7 +454,6 @@ public function testReferencedEntity() { // Verify that after modifying the referencing entity, there is a cache miss // for every route except the ones for the non-referencing entity and the // empty entity listing. - $this->pass("Test modification of referencing entity.", 'Debug'); $this->referencingEntity->save(); $this->verifyPageCache($referencing_entity_url, 'MISS'); $this->verifyPageCache($listing_url, 'MISS'); @@ -475,7 +468,6 @@ public function testReferencedEntity() { // Verify that after modifying the non-referencing entity, there is a cache // miss only for the non-referencing entity route. - $this->pass("Test modification of non-referencing entity.", 'Debug'); $this->nonReferencingEntity->save(); $this->verifyPageCache($referencing_entity_url, 'HIT'); $this->verifyPageCache($listing_url, 'HIT'); @@ -491,7 +483,6 @@ public function testReferencedEntity() { // for both the referencing entity, and the listing of referencing // entities, but not for any other routes. $referenced_entity_view_mode = $this->selectViewMode($this->entity->getEntityTypeId()); - $this->pass("Test modification of referenced entity's '$referenced_entity_view_mode' display.", 'Debug'); /** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */ $display_repository = \Drupal::service('entity_display.repository'); $entity_display = $display_repository->getViewDisplay($entity_type, $this->entity->bundle(), $referenced_entity_view_mode); @@ -511,7 +502,6 @@ public function testReferencedEntity() { // Verify that after modifying the corresponding bundle entity, there is a // cache miss for both the referencing entity, and the listing of // referencing entities, but not for any other routes. - $this->pass("Test modification of referenced entity's bundle entity.", 'Debug'); $bundle_entity = $this->container->get('entity_type.manager') ->getStorage($bundle_entity_type_id) ->load($this->entity->bundle()); @@ -543,7 +533,6 @@ public function testReferencedEntity() { if ($this->entity->getEntityType()->get('field_ui_base_route')) { // Verify that after modifying a configurable field on the entity, there // is a cache miss. - $this->pass("Test modification of referenced entity's configurable field.", 'Debug'); $field_storage_name = $this->entity->getEntityTypeId() . '.configurable_field'; $field_storage = FieldStorageConfig::load($field_storage_name); $field_storage->save(); @@ -559,7 +548,6 @@ public function testReferencedEntity() { // Verify that after modifying a configurable field on the entity, there // is a cache miss. - $this->pass("Test modification of referenced entity's configurable field.", 'Debug'); $field_name = $this->entity->getEntityTypeId() . '.' . $this->entity->bundle() . '.configurable_field'; $field = FieldConfig::load($field_name); $field->save(); @@ -577,7 +565,6 @@ public function testReferencedEntity() { // Verify that after invalidating the entity's cache tag directly, there is // a cache miss for every route except the ones for the non-referencing // entity and the empty entity listing. - $this->pass("Test invalidation of referenced entity's cache tag.", 'Debug'); Cache::invalidateTags($this->entity->getCacheTagsToInvalidate()); $this->verifyPageCache($referencing_entity_url, 'MISS'); $this->verifyPageCache($listing_url, 'MISS'); @@ -593,7 +580,6 @@ public function testReferencedEntity() { // Verify that after invalidating the entity's list cache tag directly, // there is a cache miss for both the empty entity listing and the non-empty // entity listing routes, but not for other routes. - $this->pass("Test invalidation of referenced entity's list cache tag.", 'Debug'); Cache::invalidateTags($this->entity->getEntityType()->getListCacheTags()); $this->verifyPageCache($empty_entity_listing_url, 'MISS'); $this->verifyPageCache($nonempty_entity_listing_url, 'MISS'); @@ -609,7 +595,6 @@ public function testReferencedEntity() { // Verify that after invalidating the generic entity type's view cache tag // directly, there is a cache miss for both the referencing entity, and the // listing of referencing entities, but not for other routes. - $this->pass("Test invalidation of referenced entity's 'view' cache tag.", 'Debug'); Cache::invalidateTags($view_cache_tag); $this->verifyPageCache($referencing_entity_url, 'MISS'); $this->verifyPageCache($listing_url, 'MISS'); @@ -624,7 +609,6 @@ public function testReferencedEntity() { // Verify that after deleting the entity, there is a cache miss for every // route except for the non-referencing entity one. - $this->pass('Test deletion of referenced entity.', 'Debug'); $this->entity->delete(); $this->verifyPageCache($referencing_entity_url, 'MISS'); $this->verifyPageCache($listing_url, 'MISS'); diff --git a/core/modules/system/tests/src/Functional/Entity/EntityWithUriCacheTagsTestBase.php b/core/modules/system/tests/src/Functional/Entity/EntityWithUriCacheTagsTestBase.php index e62d343ced936858fd22fe2084966cc99f817cff..f6b71ad4b73ea279a4a2d63b2a556395b3a3be0f 100644 --- a/core/modules/system/tests/src/Functional/Entity/EntityWithUriCacheTagsTestBase.php +++ b/core/modules/system/tests/src/Functional/Entity/EntityWithUriCacheTagsTestBase.php @@ -34,7 +34,6 @@ public function testEntityUri() { $view_cache_tag = \Drupal::entityTypeManager()->getViewBuilder($entity_type)->getCacheTags(); $render_cache_tag = 'rendered'; - $this->pass("Test entity.", 'Debug'); $this->verifyPageCache($entity_url, 'MISS'); // Verify a cache hit, but also the presence of the correct cache tags. @@ -57,7 +56,6 @@ public function testEntityUri() { } // Verify that after modifying the entity, there is a cache miss. - $this->pass("Test modification of entity.", 'Debug'); $this->entity->save(); $this->verifyPageCache($entity_url, 'MISS'); @@ -65,7 +63,6 @@ public function testEntityUri() { $this->verifyPageCache($entity_url, 'HIT'); // Verify that after modifying the entity's display, there is a cache miss. - $this->pass("Test modification of entity's '$view_mode' display.", 'Debug'); $entity_display = \Drupal::service('entity_display.repository')->getViewDisplay($entity_type, $this->entity->bundle(), $view_mode); $entity_display->save(); $this->verifyPageCache($entity_url, 'MISS'); @@ -76,7 +73,6 @@ public function testEntityUri() { if ($bundle_entity_type_id = $this->entity->getEntityType()->getBundleEntityType()) { // Verify that after modifying the corresponding bundle entity, there is a // cache miss. - $this->pass("Test modification of entity's bundle entity.", 'Debug'); $bundle_entity = $this->container->get('entity_type.manager') ->getStorage($bundle_entity_type_id) ->load($this->entity->bundle()); @@ -90,7 +86,6 @@ public function testEntityUri() { if ($this->entity->getEntityType()->get('field_ui_base_route')) { // Verify that after modifying a configurable field on the entity, there // is a cache miss. - $this->pass("Test modification of entity's configurable field.", 'Debug'); $field_storage_name = $this->entity->getEntityTypeId() . '.configurable_field'; $field_storage = FieldStorageConfig::load($field_storage_name); $field_storage->save(); @@ -101,7 +96,6 @@ public function testEntityUri() { // Verify that after modifying a configurable field on the entity, there // is a cache miss. - $this->pass("Test modification of entity's configurable field.", 'Debug'); $field_name = $this->entity->getEntityTypeId() . '.' . $this->entity->bundle() . '.configurable_field'; $field = FieldConfig::load($field_name); $field->save(); @@ -113,7 +107,6 @@ public function testEntityUri() { // Verify that after invalidating the entity's cache tag directly, there is // a cache miss. - $this->pass("Test invalidation of entity's cache tag.", 'Debug'); Cache::invalidateTags($this->entity->getCacheTagsToInvalidate()); $this->verifyPageCache($entity_url, 'MISS'); @@ -122,7 +115,6 @@ public function testEntityUri() { // Verify that after invalidating the generic entity type's view cache tag // directly, there is a cache miss. - $this->pass("Test invalidation of entity's 'view' cache tag.", 'Debug'); Cache::invalidateTags($view_cache_tag); $this->verifyPageCache($entity_url, 'MISS'); @@ -130,7 +122,6 @@ public function testEntityUri() { $this->verifyPageCache($entity_url, 'HIT'); // Verify that after deleting the entity, there is a cache miss. - $this->pass('Test deletion of entity.', 'Debug'); $this->entity->delete(); $this->verifyPageCache($entity_url, 'MISS'); $this->assertResponse(404); diff --git a/core/modules/tour/tests/src/Functional/TourTestBase.php b/core/modules/tour/tests/src/Functional/TourTestBase.php index 941586de6135084b193494578a198d79dab1dda7..5c2ccbd43ff59f2234c70b0c21ba6da874f4ac51 100644 --- a/core/modules/tour/tests/src/Functional/TourTestBase.php +++ b/core/modules/tour/tests/src/Functional/TourTestBase.php @@ -66,7 +66,6 @@ public function assertTourTips($tips = []) { } $total++; } - $this->pass(new FormattableMarkup('Total %total Tips tested of which %modals modal(s).', ['%total' => $total, '%modals' => $modals])); } } diff --git a/core/tests/Drupal/FunctionalTests/Installer/ConfigAfterInstallerTestBase.php b/core/tests/Drupal/FunctionalTests/Installer/ConfigAfterInstallerTestBase.php index 32b2906030390465f6f5ec4de5db91e550304681..741ef8276f4c8e7c01616f9717bc306c69dce182 100644 --- a/core/tests/Drupal/FunctionalTests/Installer/ConfigAfterInstallerTestBase.php +++ b/core/tests/Drupal/FunctionalTests/Installer/ConfigAfterInstallerTestBase.php @@ -32,13 +32,7 @@ protected function assertInstalledConfig(array $skipped_config) { foreach ($profile_config_storage->listAll() as $config_name) { $result = $config_manager->diff($profile_config_storage, $active_config_storage, $config_name); - try { - $this->assertConfigDiff($result, $config_name, $skipped_config); - $this->pass("$config_name has no differences"); - } - catch (\Exception $e) { - $this->fail($e->getMessage()); - } + $this->assertConfigDiff($result, $config_name, $skipped_config); } } diff --git a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php index 8324996ea023ad7a50d3a3f1fe9a6e71eaebeeb8..a8d042fdfae2744927f4e3c968b3378b27d1521b 100644 --- a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php @@ -216,10 +216,10 @@ public function testSetGet() { // Calling ::set() with invalid cache tags. This should fail an assertion. try { $backend->set('assertion_test', 'value', Cache::PERMANENT, ['node' => [3, 5, 7]]); - $this->fail('::set() was called with invalid cache tags, runtime assertion did not fail.'); + $this->fail('::set() was called with invalid cache tags, but runtime assertion did not fail.'); } catch (\AssertionError $e) { - $this->pass('::set() was called with invalid cache tags, runtime assertion failed.'); + // Do nothing; continue testing in extending classes. } } @@ -418,10 +418,10 @@ public function testSetMultiple() { 'exception_test_3' => ['data' => 3, 'tags' => ['node' => [3, 5, 7]]], ]; $backend->setMultiple($items); - $this->fail('::setMultiple() was called with invalid cache tags, runtime assertion did not fail.'); + $this->fail('::setMultiple() was called with invalid cache tags, but runtime assertion did not fail.'); } catch (\AssertionError $e) { - $this->pass('::setMultiple() was called with invalid cache tags, runtime assertion failed.'); + // Do nothing; continue testing in extending classes. } } diff --git a/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php b/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php index d5601397fe6e6b7784c9c6fc5cc30b15bf4a6994..af8e3cc26602b438864fed7c5b1f3746ba6fa6ef 100644 --- a/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php +++ b/core/tests/Drupal/KernelTests/Core/Config/Storage/ConfigStorageTestBase.php @@ -138,8 +138,7 @@ public function testInvalidStorage() { $this->fail('Exception not thrown upon deleting from a non-existing storage bin.'); } catch (\Exception $e) { - $class = get_class($e); - $this->pass($class . ' thrown upon deleting from a non-existing storage bin.'); + // An exception occurred as expected; just continue. } // Listing on a non-existing storage bin returns an empty array. diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index d5f6ca69679e91f0a2d41704ea0ba93aab788355..b1ebad5e32b601bfa9af0559b1b0c44902cafe82 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -6,7 +6,6 @@ use Drupal\Component\FileCache\FileCache; use Drupal\Component\FileCache\FileCacheFactory; use Drupal\Component\Utility\Html; -use Drupal\Component\Render\FormattableMarkup; use Drupal\Core\Config\Development\ConfigSchemaChecker; use Drupal\Core\Database\Database; use Drupal\Core\DependencyInjection\ContainerBuilder; @@ -735,21 +734,8 @@ protected function installEntitySchema($entity_type_id) { if ($storage instanceof SqlEntityStorageInterface) { $tables = $storage->getTableMapping()->getTableNames(); $db_schema = $this->container->get('database')->schema(); - $all_tables_exist = TRUE; foreach ($tables as $table) { - if (!$db_schema->tableExists($table)) { - $this->fail(new FormattableMarkup('Installed entity type table for the %entity_type entity type: %table', [ - '%entity_type' => $entity_type_id, - '%table' => $table, - ])); - $all_tables_exist = FALSE; - } - } - if ($all_tables_exist) { - $this->pass(new FormattableMarkup('Installed entity type tables for the %entity_type entity type: %tables', [ - '%entity_type' => $entity_type_id, - '%tables' => '{' . implode('}, {', $tables) . '}', - ])); + $this->assertTrue($db_schema->tableExists($table), "The entity type table '$table' for the entity type '$entity_type_id' should exist."); } } }