Commit 7b1f3e11 authored by xjm's avatar xjm
Browse files

Issue #3123253 by mondrake, Lal_, prabha1997, longwave, xjm, alexpott, jungle:...

Issue #3123253 by mondrake, Lal_, prabha1997, longwave, xjm, alexpott, jungle: Remove usage of AssertLegacyTrait::pass() from base test classes
parent 70350eec
......@@ -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);
}
/**
......
......@@ -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');
......
......@@ -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);
......
......@@ -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]));
}
}
......
......@@ -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);
}
}
......
......@@ -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.
}
}
......
......@@ -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.
......
......@@ -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.");
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment