diff --git a/core/modules/aggregator/tests/src/Functional/FeedFetcherPluginTest.php b/core/modules/aggregator/tests/src/Functional/FeedFetcherPluginTest.php
index 8bf1244e353ecdbc07365371635e2b4ed8b7e087..be18d4dc35cf77e12abaca00c6185590a170c270 100644
--- a/core/modules/aggregator/tests/src/Functional/FeedFetcherPluginTest.php
+++ b/core/modules/aggregator/tests/src/Functional/FeedFetcherPluginTest.php
@@ -34,7 +34,7 @@ public function testfetch() {
     // Create feed with local url.
     $feed = $this->createFeed();
     $this->updateFeedItems($feed);
-    $this->assertFalse(empty($feed->items));
+    $this->assertNotEmpty($feed->items);
 
     // Delete items and restore checked property to 0.
     $this->deleteFeedItems($feed);
@@ -43,7 +43,7 @@ public function testfetch() {
     $feed->save();
     $this->updateFeedItems($feed);
     // Fetch should fail due to feed name.
-    $this->assertTrue(empty($feed->items));
+    $this->assertEmpty($feed->items);
   }
 
 }
diff --git a/core/modules/aggregator/tests/src/Functional/FeedProcessorPluginTest.php b/core/modules/aggregator/tests/src/Functional/FeedProcessorPluginTest.php
index fd13616ef10025ce3b32b383c2729538fdbf29de..5595a6a62c2326a7d5bd652f8817b58e4465cb41 100644
--- a/core/modules/aggregator/tests/src/Functional/FeedProcessorPluginTest.php
+++ b/core/modules/aggregator/tests/src/Functional/FeedProcessorPluginTest.php
@@ -51,7 +51,7 @@ public function testDelete() {
     $this->updateAndDelete($feed, NULL);
     // Make sure the feed title is changed.
     $entities = \Drupal::entityTypeManager()->getStorage('aggregator_feed')->loadByProperties(['description' => $description]);
-    $this->assertTrue(empty($entities));
+    $this->assertEmpty($entities);
   }
 
   /**
diff --git a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
index dcb68b48430b3259ba3623ba2bcf1f9349541d40..5624904e4a4e1968d3022e16c8a9360518338f99 100644
--- a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
+++ b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
@@ -188,7 +188,7 @@ public function testBigPipe() {
     $this->assertSession()->responseContains('</body>');
 
     // Verifying BigPipe assets are present.
-    $this->assertFalse(empty($this->getDrupalSettings()), 'drupalSettings present.');
+    $this->assertNotEmpty($this->getDrupalSettings());
     $this->assertContains('big_pipe/big_pipe', explode(',', $this->getDrupalSettings()['ajaxPageState']['libraries']), 'BigPipe asset library is present.');
 
     // Verify that the two expected exceptions are logged as errors.
@@ -506,12 +506,25 @@ protected function assertBigPipeNoJsMetaRefreshRedirect(): void {
     $this->assertEquals(302, $statuses[0], 'The first response was a 302 (redirect).');
     $this->assertStringStartsWith('big_pipe_nojs=1', $headers[0]['Set-Cookie'][0], 'The first response sets the big_pipe_nojs cookie.');
     $this->assertEquals($original_url, $headers[0]['Location'][0], 'The first response redirected back to the original page.');
-    $this->assertTrue(empty(array_diff(['cookies:big_pipe_nojs', 'session.exists'], explode(' ', $headers[0]['X-Drupal-Cache-Contexts'][0]))), 'The first response varies by the "cookies:big_pipe_nojs" and "session.exists" cache contexts.');
+    $this->assertEmpty(
+      array_diff([
+        'cookies:big_pipe_nojs',
+        'session.exists',
+      ], explode(' ', $headers[0]['X-Drupal-Cache-Contexts'][0])),
+      'The first response varies by the "cookies:big_pipe_nojs" and "session.exists" cache contexts.'
+    );
     $this->assertFalse(isset($headers[0]['Surrogate-Control']), 'The first response has no "Surrogate-Control" header.');
 
     // Second response: redirect followed.
     $this->assertEquals(200, $statuses[1], 'The second response was a 200.');
-    $this->assertTrue(empty(array_diff(['cookies:big_pipe_nojs', 'session.exists'], explode(' ', $headers[0]['X-Drupal-Cache-Contexts'][0]))), 'The first response varies by the "cookies:big_pipe_nojs" and "session.exists" cache contexts.');
+    $this->assertEmpty(
+      array_diff([
+        'cookies:big_pipe_nojs',
+        'session.exists',
+      ], explode(' ', $headers[0]['X-Drupal-Cache-Contexts'][0])),
+      'The second response varies by the "cookies:big_pipe_nojs" and "session.exists" cache contexts.'
+    );
+
     $this->assertEquals('no-store, content="BigPipe/1.0"', $headers[1]['Surrogate-Control'][0], 'The second response has a "Surrogate-Control" header.');
 
     // Check that the <meta> refresh is absent, only one redirect ever happens.
diff --git a/core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php b/core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php
index ef3ebef2f6050e7333eccd41a76cecdc59399700..b229c6f23c157e3a38b7b66f0bab67814479b9ad 100644
--- a/core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php
+++ b/core/modules/block/tests/src/Functional/AssertBlockAppearsTrait.php
@@ -3,7 +3,6 @@
 namespace Drupal\Tests\block\Functional;
 
 use Drupal\block\Entity\Block;
-use Drupal\Component\Render\FormattableMarkup;
 
 /**
  * Provides test assertions for testing block appearance.
@@ -20,7 +19,7 @@ trait AssertBlockAppearsTrait {
    */
   protected function assertBlockAppears(Block $block) {
     $result = $this->findBlockInstance($block);
-    $this->assertTrue(!empty($result), new FormattableMarkup('The block @id appears on the page', ['@id' => $block->id()]));
+    $this->assertNotEmpty($result, sprintf('The block %s should appear on the page.', $block->id()));
   }
 
   /**
@@ -31,7 +30,7 @@ protected function assertBlockAppears(Block $block) {
    */
   protected function assertNoBlockAppears(Block $block) {
     $result = $this->findBlockInstance($block);
-    $this->assertFalse(!empty($result), new FormattableMarkup('The block @id does not appear on the page', ['@id' => $block->id()]));
+    $this->assertEmpty($result, sprintf('The block %s should not appear on the page.', $block->id()));
   }
 
   /**
diff --git a/core/modules/block/tests/src/Functional/BlockHtmlTest.php b/core/modules/block/tests/src/Functional/BlockHtmlTest.php
index f6e8a284194dbfc51d211a32c8894cf8f0bb0cb5..19223a887c91512be76e4ba93f83d03030c7e0e8 100644
--- a/core/modules/block/tests/src/Functional/BlockHtmlTest.php
+++ b/core/modules/block/tests/src/Functional/BlockHtmlTest.php
@@ -49,7 +49,7 @@ public function testHtml() {
 
     // Ensure expected markup for a menu block.
     $elements = $this->xpath('//nav[contains(@class, :nav-class)]/ul[contains(@class, :ul-class)]/li', [':nav-class' => 'block-menu', ':ul-class' => 'menu']);
-    $this->assertTrue(!empty($elements), 'The proper block markup was found.');
+    $this->assertNotEmpty($elements, 'The proper block markup was found.');
   }
 
 }
diff --git a/core/modules/block/tests/src/Functional/BlockLanguageTest.php b/core/modules/block/tests/src/Functional/BlockLanguageTest.php
index a55a0f47b716853fc4adb7a6363517db00f65e4d..a1380da619a03e45c37a8acaa337a4381c0635fb 100644
--- a/core/modules/block/tests/src/Functional/BlockLanguageTest.php
+++ b/core/modules/block/tests/src/Functional/BlockLanguageTest.php
@@ -116,13 +116,13 @@ public function testLanguageBlockVisibilityLanguageDelete() {
     // it is deleted.
     $block = Block::load($block->id());
     $visibility = $block->getVisibility();
-    $this->assertTrue(empty($visibility['language']['langcodes']['fr']), 'Language is no longer not set in the block configuration after deleting the block.');
+    $this->assertArrayNotHasKey('language', $visibility, 'Language is no longer not set in the block configuration after deleting the block.');
 
     // Ensure that the block visibility for language is gone from the UI.
     $this->drupalGet('admin/structure/block');
     $this->clickLink('Configure');
     $elements = $this->xpath('//details[@id="edit-visibility-language"]');
-    $this->assertTrue(empty($elements));
+    $this->assertEmpty($elements);
   }
 
   /**
diff --git a/core/modules/block/tests/src/Functional/BlockSystemBrandingTest.php b/core/modules/block/tests/src/Functional/BlockSystemBrandingTest.php
index 518e95717a4e52aa8e1a55d4c4223e500977183e..9e95d73b64a25429a12b5473e7bf79361435b822 100644
--- a/core/modules/block/tests/src/Functional/BlockSystemBrandingTest.php
+++ b/core/modules/block/tests/src/Functional/BlockSystemBrandingTest.php
@@ -48,9 +48,9 @@ public function testSystemBrandingSettings() {
     $site_name_element = $this->xpath($site_name_xpath);
     $site_slogan_element = $this->xpath($site_slogan_xpath);
     // Test that all branding elements are displayed.
-    $this->assertTrue(!empty($site_logo_element), 'The branding block logo was found.');
-    $this->assertTrue(!empty($site_name_element), 'The branding block site name was found.');
-    $this->assertTrue(!empty($site_slogan_element), 'The branding block slogan was found.');
+    $this->assertNotEmpty($site_logo_element, 'The branding block logo was found.');
+    $this->assertNotEmpty($site_name_element, 'The branding block site name was found.');
+    $this->assertNotEmpty($site_slogan_element, 'The branding block slogan was found.');
     $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site');
 
     // Be sure the slogan is XSS-filtered.
@@ -70,9 +70,9 @@ public function testSystemBrandingSettings() {
     $site_name_element = $this->xpath($site_name_xpath);
     $site_slogan_element = $this->xpath($site_slogan_xpath);
     // Re-test all branding elements.
-    $this->assertTrue(empty($site_logo_element), 'The branding block logo was disabled.');
-    $this->assertTrue(!empty($site_name_element), 'The branding block site name was found.');
-    $this->assertTrue(!empty($site_slogan_element), 'The branding block slogan was found.');
+    $this->assertEmpty($site_logo_element, 'The branding block logo was disabled.');
+    $this->assertNotEmpty($site_name_element, 'The branding block site name was found.');
+    $this->assertNotEmpty($site_slogan_element, 'The branding block slogan was found.');
     $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site');
 
     // Turn just the site name off.
@@ -85,9 +85,9 @@ public function testSystemBrandingSettings() {
     $site_name_element = $this->xpath($site_name_xpath);
     $site_slogan_element = $this->xpath($site_slogan_xpath);
     // Re-test all branding elements.
-    $this->assertTrue(!empty($site_logo_element), 'The branding block logo was found.');
-    $this->assertTrue(empty($site_name_element), 'The branding block site name was disabled.');
-    $this->assertTrue(!empty($site_slogan_element), 'The branding block slogan was found.');
+    $this->assertNotEmpty($site_logo_element, 'The branding block logo was found.');
+    $this->assertEmpty($site_name_element, 'The branding block site name was disabled.');
+    $this->assertNotEmpty($site_slogan_element, 'The branding block slogan was found.');
     $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site');
 
     // Turn just the site slogan off.
@@ -100,9 +100,9 @@ public function testSystemBrandingSettings() {
     $site_name_element = $this->xpath($site_name_xpath);
     $site_slogan_element = $this->xpath($site_slogan_xpath);
     // Re-test all branding elements.
-    $this->assertTrue(!empty($site_logo_element), 'The branding block logo was found.');
-    $this->assertTrue(!empty($site_name_element), 'The branding block site name was found.');
-    $this->assertTrue(empty($site_slogan_element), 'The branding block slogan was disabled.');
+    $this->assertNotEmpty($site_logo_element, 'The branding block logo was found.');
+    $this->assertNotEmpty($site_name_element, 'The branding block site name was found.');
+    $this->assertEmpty($site_slogan_element, 'The branding block slogan was disabled.');
     $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site');
 
     // Turn the site name and the site slogan off.
@@ -115,9 +115,9 @@ public function testSystemBrandingSettings() {
     $site_name_element = $this->xpath($site_name_xpath);
     $site_slogan_element = $this->xpath($site_slogan_xpath);
     // Re-test all branding elements.
-    $this->assertTrue(!empty($site_logo_element), 'The branding block logo was found.');
-    $this->assertTrue(empty($site_name_element), 'The branding block site name was disabled.');
-    $this->assertTrue(empty($site_slogan_element), 'The branding block slogan was disabled.');
+    $this->assertNotEmpty($site_logo_element, 'The branding block logo was found.');
+    $this->assertEmpty($site_name_element, 'The branding block site name was disabled.');
+    $this->assertEmpty($site_slogan_element, 'The branding block slogan was disabled.');
     $this->assertSession()->responseHeaderContains('X-Drupal-Cache-Tags', 'config:system.site');
   }
 
diff --git a/core/modules/block/tests/src/Functional/BlockUiTest.php b/core/modules/block/tests/src/Functional/BlockUiTest.php
index 5618a05e5b7a0253718c83a27bbb91b977dd5bf6..a7790c96ef4896ec67104fed0c1467a7c1e08f41 100644
--- a/core/modules/block/tests/src/Functional/BlockUiTest.php
+++ b/core/modules/block/tests/src/Functional/BlockUiTest.php
@@ -114,7 +114,7 @@ public function testBlockAdminUiPage() {
     $this->drupalGet('admin/structure/block');
     // Look for the blocks table.
     $blocks_table = $this->xpath("//table[@id='blocks']");
-    $this->assertTrue(!empty($blocks_table), 'The blocks table is being rendered.');
+    $this->assertNotEmpty($blocks_table, 'The blocks table is being rendered.');
     // Look for test blocks in the table.
     foreach ($this->blockValues as $delta => $values) {
       $block = $this->blocks[$delta];
@@ -142,7 +142,7 @@ public function testBlockAdminUiPage() {
     $this->drupalPlaceBlock('system_powered_by_block', ['region' => 'header', 'id' => 'header']);
     $this->drupalGet('admin/structure/block');
     $element = $this->xpath('//tr[contains(@class, :class)]', [':class' => 'region-title-header']);
-    $this->assertTrue(!empty($element));
+    $this->assertNotEmpty($element);
 
     // Ensure hidden themes do not appear in the UI. Enable another non base
     // theme and place the local tasks block.
@@ -184,7 +184,7 @@ public function testCandidateBlockList() {
     $this->drupalGet('admin/structure/block');
     $this->clickLink('Place block');
     $elements = $this->xpath($pattern, $arguments);
-    $this->assertTrue(!empty($elements), 'The test block appears in the category for its module.');
+    $this->assertNotEmpty($elements, 'The test block appears in the category for its module.');
 
     // Trigger the custom category addition in block_test_block_alter().
     $this->container->get('state')->set('block_test_info_alter', TRUE);
@@ -194,7 +194,7 @@ public function testCandidateBlockList() {
     $this->clickLink('Place block');
     $arguments[':category'] = 'Custom category';
     $elements = $this->xpath($pattern, $arguments);
-    $this->assertTrue(!empty($elements), 'The test block appears in a custom category controlled by block_test_block_alter().');
+    $this->assertNotEmpty($elements, 'The test block appears in a custom category controlled by block_test_block_alter().');
   }
 
   /**
@@ -207,7 +207,7 @@ public function testContextAwareUnsatisfiedBlocks() {
     $this->assertSession()->elementNotExists('xpath', '//tr[.//td/div[text()="Test context-aware unsatisfied block"] and .//td[text()="Block test"] and .//td//a[contains(@href, "admin/structure/block/add/test_context_aware_unsatisfied/classy")]]');
 
     $definition = \Drupal::service('plugin.manager.block')->getDefinition('test_context_aware_unsatisfied');
-    $this->assertTrue(!empty($definition), 'The context-aware test block does not exist.');
+    $this->assertNotEmpty($definition, 'The context-aware test block does not exist.');
   }
 
   /**
@@ -230,9 +230,9 @@ public function testContextAwareBlocks() {
     $this->drupalGet('admin/structure/block');
     $this->clickLink('Place block');
     $elements = $this->xpath($pattern, $arguments);
-    $this->assertTrue(!empty($elements), 'The context-aware test block appears.');
+    $this->assertNotEmpty($elements, 'The context-aware test block appears.');
     $definition = \Drupal::service('plugin.manager.block')->getDefinition('test_context_aware');
-    $this->assertTrue(!empty($definition), 'The context-aware test block exists.');
+    $this->assertNotEmpty($definition, 'The context-aware test block exists.');
     $edit = [
       'region' => 'content',
       'settings[context_mapping][user]' => '@block_test.multiple_static_context:userB',
diff --git a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php
index 6d56f6bea0db0063e5797eb7e79c5cf2da23288d..c3f0b15ac859c9d438b84825a27416e0e515421b 100644
--- a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php
+++ b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php
@@ -214,7 +214,7 @@ public function testViewsBlockForm() {
     $block = $storage->load('views_block__test_view_block_block_1');
     // This will only return a result if our new block has been created with the
     // expected machine name.
-    $this->assertTrue(!empty($block), 'The expected block was loaded.');
+    $this->assertNotEmpty($block, 'The expected block was loaded.');
 
     for ($i = 2; $i <= 3; $i++) {
       // Place the same block again and make sure we have a new ID.
@@ -223,7 +223,7 @@ public function testViewsBlockForm() {
       $block = $storage->load('views_block__test_view_block_block_1_' . $i);
       // This will only return a result if our new block has been created with the
       // expected machine name.
-      $this->assertTrue(!empty($block), 'The expected block was loaded.');
+      $this->assertNotEmpty($block, 'The expected block was loaded.');
     }
 
     // Tests the override capability of items per page.
diff --git a/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php b/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php
index 26b0b6354743aab598db7747eb5533434a1981a0..a32aa61a15af8a1e05f2091377cfcf51867c7501 100644
--- a/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php
+++ b/core/modules/block/tests/src/Kernel/BlockStorageUnitTest.php
@@ -77,7 +77,7 @@ protected function createTests() {
 
     // Verify all of the block properties.
     $actual_properties = $this->config('block.block.test_block')->get();
-    $this->assertTrue(!empty($actual_properties['uuid']), 'The block UUID is set.');
+    $this->assertNotEmpty($actual_properties['uuid'], 'The block UUID is set.');
     unset($actual_properties['uuid']);
 
     // Ensure that default values are filled in.
@@ -129,14 +129,14 @@ protected function deleteTests() {
     // Ensure that the storage isn't currently empty.
     $config_storage = $this->container->get('config.storage');
     $config = $config_storage->listAll('block.block.');
-    $this->assertFalse(empty($config), 'There are blocks in config storage.');
+    $this->assertNotEmpty($config, 'There are blocks in config storage.');
 
     // Delete the block.
     $entity->delete();
 
     // Ensure that the storage is now empty.
     $config = $config_storage->listAll('block.block.');
-    $this->assertTrue(empty($config), 'There are no blocks in config storage.');
+    $this->assertEmpty($config, 'There are no blocks in config storage.');
   }
 
   /**
@@ -145,7 +145,7 @@ protected function deleteTests() {
   public function testDefaultBlocks() {
     \Drupal::service('theme_installer')->install(['classy']);
     $entities = $this->controller->loadMultiple();
-    $this->assertTrue(empty($entities), 'There are no blocks initially.');
+    $this->assertEmpty($entities, 'There are no blocks initially.');
 
     // Install the block_test.module, so that its default config is installed.
     $this->installConfig(['block_test']);
diff --git a/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php b/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php
index a9f31b4ca3d88a09484298091e5b3f8f15b6619f..0e0117e8b25779e9bca56d7f221df632ace918cb 100644
--- a/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php
+++ b/core/modules/block/tests/src/Kernel/Migrate/d7/MigrateBlockTest.php
@@ -167,7 +167,7 @@ public function testBlockMigration() {
       'seven_statistics_popular',
       'seven_block_1',
     ];
-    $this->assertTrue(empty(Block::loadMultiple($non_existent_blocks)));
+    $this->assertEmpty(Block::loadMultiple($non_existent_blocks));
   }
 
 }
diff --git a/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php b/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php
index 365a438363b5f7411d615e84314ca48c26dca344..0ecb7748a715bc908c11a07c2382e6e44666564b 100644
--- a/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php
+++ b/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php
@@ -141,7 +141,7 @@ protected function createBookNode($book_nid, $parent = NULL) {
       $this->submitForm($edit, 'Save');
       // Make sure the parent was flagged as having children.
       $parent_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($parent);
-      $this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children');
+      $this->assertNotEmpty($parent_node->book['has_children'], 'Parent node is marked as having children');
     }
     else {
       $this->drupalGet('node/add/book');
diff --git a/core/modules/book/tests/src/Functional/BookTest.php b/core/modules/book/tests/src/Functional/BookTest.php
index 15366c4f5a07d4bef6629834c21f59fa6aa174ad..230125f28c07580f03b386c4ab7697b3044c7f3e 100644
--- a/core/modules/book/tests/src/Functional/BookTest.php
+++ b/core/modules/book/tests/src/Functional/BookTest.php
@@ -440,7 +440,7 @@ public function testBookDelete() {
     $this->submitForm($edit, 'Remove');
     $node_storage->resetCache([$nodes[4]->id()]);
     $node4 = $node_storage->load($nodes[4]->id());
-    $this->assertTrue(empty($node4->book), 'Deleting child book node properly allowed.');
+    $this->assertEmpty($node4->book, 'Deleting child book node properly allowed.');
 
     // $nodes[4] is stale, trying to delete it directly will cause an error.
     $node4->delete();
@@ -453,7 +453,7 @@ public function testBookDelete() {
     $this->submitForm($edit, 'Remove');
     $node_storage->resetCache([$this->book->id()]);
     $node = $node_storage->load($this->book->id());
-    $this->assertTrue(empty($node->book), 'Deleting childless top-level book node properly allowed.');
+    $this->assertEmpty($node->book, 'Deleting childless top-level book node properly allowed.');
 
     // Tests directly deleting a book parent.
     $nodes = $this->createBook();
@@ -681,7 +681,7 @@ public function testHookNodeLoadAccess() {
     // @see node_access_test_node_grants().
     $this->drupalLogin($this->webUserWithoutNodeAccess);
     $book_node = $node_storage->load($this->book->id());
-    $this->assertTrue(!empty($book_node->book));
+    $this->assertNotEmpty($book_node->book);
     $this->assertEquals($this->book->id(), $book_node->book['bid']);
 
     // Reset the internal cache to retrigger the hook_node_load() call.
@@ -689,7 +689,7 @@ public function testHookNodeLoadAccess() {
 
     $this->drupalLogin($this->webUser);
     $book_node = $node_storage->load($this->book->id());
-    $this->assertTrue(!empty($book_node->book));
+    $this->assertNotEmpty($book_node->book);
     $this->assertEquals($this->book->id(), $book_node->book['bid']);
   }
 
diff --git a/core/modules/book/tests/src/Functional/BookTestTrait.php b/core/modules/book/tests/src/Functional/BookTestTrait.php
index 508fafab4c138c9538b184766b4021fd1a5ea21d..724feea3605ebb7fba5a8f7bebe7313854f22c51 100644
--- a/core/modules/book/tests/src/Functional/BookTestTrait.php
+++ b/core/modules/book/tests/src/Functional/BookTestTrait.php
@@ -198,7 +198,7 @@ public function createBookNode($book_nid, $parent = NULL, $edit = []) {
       $this->submitForm($edit, 'Save');
       // Make sure the parent was flagged as having children.
       $parent_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($parent);
-      $this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children');
+      $this->assertNotEmpty($parent_node->book['has_children'], 'Parent node is marked as having children');
     }
     else {
       $this->drupalGet('node/add/book');
diff --git a/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php b/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php
index 410adf3f9a118fdc3745fd6f8d10ba52ebda49ca..5051f0a81eb6ca1744dd10bb2ce02e17a7c0ed6a 100644
--- a/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php
+++ b/core/modules/book/tests/src/Functional/Views/BookRelationshipTest.php
@@ -128,7 +128,7 @@ protected function createBookNode($book_nid, $parent = NULL) {
       $this->submitForm($edit, 'Save');
       // Make sure the parent was flagged as having children.
       $parent_node = \Drupal::entityTypeManager()->getStorage('node')->loadUnchanged($parent);
-      $this->assertFalse(empty($parent_node->book['has_children']), 'Parent node is marked as having children');
+      $this->assertNotEmpty($parent_node->book['has_children'], 'Parent node is marked as having children');
     }
     else {
       $this->drupalGet('node/add/book');
diff --git a/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php b/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php
index 3f852ef8e31301b163c1b5192539f3f381157f3f..aea21f6847c576e79c0c02bed5b7f94bc3acc4ce 100644
--- a/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php
+++ b/core/modules/ckeditor/tests/src/Kernel/CKEditorTest.php
@@ -422,7 +422,7 @@ public function testJSTranslation() {
     $this->ckeditor->getJSSettings($editor);
     $localeStorage = $this->container->get('locale.storage');
     $string = $localeStorage->findString(['source' => 'Edit Link', 'context' => '']);
-    $this->assertTrue(!empty($string), 'String from JavaScript file saved.');
+    $this->assertNotEmpty($string, 'String from JavaScript file saved.');
 
     // With locale module, CKEditor should not adhere to the language selected.
     $this->assertCKEditorLanguage();
diff --git a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php
index 71780ada8786d5e8bac95a48dfc361bb324f63ca..7b005eaeb399191572c09e4db41b5845834707f4 100644
--- a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php
@@ -38,7 +38,7 @@ public function testCommentDefaultFields() {
 
     // Check that the 'comment_body' field is present on the comment bundle.
     $field = FieldConfig::loadByName('comment', 'comment', 'comment_body');
-    $this->assertTrue(!empty($field), 'The comment_body field is added when a comment bundle is created');
+    $this->assertNotEmpty($field, 'The comment_body field is added when a comment bundle is created');
 
     $field->delete();
 
diff --git a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
index 1440743eb19a9d1de17276601fb0643c98b79803..6631b26f91071a722e88ade5acd0df09396c7185 100644
--- a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php
@@ -92,7 +92,7 @@ public function testCommentInterface() {
     ];
     $pattern_permalink = '//footer[contains(@class,"comment__meta")]/a[contains(@href,:link) and text()="Permalink"]';
     $permalink = $this->xpath($pattern_permalink, $arguments);
-    $this->assertTrue(!empty($permalink), 'Permalink link found.');
+    $this->assertNotEmpty($permalink, 'Permalink link found.');
 
     // Set comments to have subject and preview to optional.
     $this->drupalLogout();
@@ -317,7 +317,7 @@ public function testViewMode() {
 
     // Comment displayed in 'default' display mode found and has body text.
     $comment_element = $this->cssSelect('.comment-wrapper');
-    $this->assertTrue(!empty($comment_element));
+    $this->assertNotEmpty($comment_element);
     $this->assertSession()->responseContains('<p>' . $comment_text . '</p>');
 
     // Create a new comment entity view mode.
@@ -350,7 +350,7 @@ public function testViewMode() {
     // The comment should exist but without the body text because we used $mode
     // mode this time.
     $comment_element = $this->cssSelect('.comment-wrapper');
-    $this->assertTrue(!empty($comment_element));
+    $this->assertNotEmpty($comment_element);
     $this->assertSession()->responseNotContains('<p>' . $comment_text . '</p>');
   }
 
diff --git a/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php b/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php
index 099db671d4ebb234fd10a74236f6d2a8f57560b3..e65be6c6b584bb812158a9d47131a45eb2846e4c 100644
--- a/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php
+++ b/core/modules/comment/tests/src/Kernel/Views/CommentUserNameTest.php
@@ -158,7 +158,7 @@ public function testUsername() {
     $comment_author = $this->xpath('//div[contains(@class, :class)]/span[normalize-space(text())=""]', [
       ':class' => 'views-field-subject',
     ]);
-    $this->assertTrue(!empty($comment_author));
+    $this->assertNotEmpty($comment_author);
     // When comment belongs to an anonymous user the name field has a value and
     // it is rendered correctly.
     $this->assertLink('barry (not verified)');
diff --git a/core/modules/config/tests/src/Functional/ConfigImportUITest.php b/core/modules/config/tests/src/Functional/ConfigImportUITest.php
index 5e4bdd1d13d7186ca4887dbf41f046708a2bf734..a2078e6d30a80577f785e83c3c764dafd52e7acb 100644
--- a/core/modules/config/tests/src/Functional/ConfigImportUITest.php
+++ b/core/modules/config/tests/src/Functional/ConfigImportUITest.php
@@ -162,7 +162,7 @@ public function testImport() {
     $uninstalled = \Drupal::state()->get('ConfigImportUITest.core.extension.modules_uninstalled', []);
     $expected = ['automated_cron', 'ban', 'text', 'options'];
     $this->assertSame($expected, $installed, 'Automated Cron, Ban, Text and Options modules installed in the correct order.');
-    $this->assertTrue(empty($uninstalled), 'No modules uninstalled during import');
+    $this->assertEmpty($uninstalled, 'No modules uninstalled during import');
 
     // Verify that the automated_cron configuration object was only written
     // once during the import process and only with the value set in the staged
@@ -218,7 +218,7 @@ public function testImport() {
     $uninstalled = \Drupal::state()->get('ConfigImportUITest.core.extension.modules_uninstalled', []);
     $expected = ['options', 'text', 'ban', 'automated_cron'];
     $this->assertSame($expected, $uninstalled, 'Options, Text, Ban and Automated Cron modules uninstalled in the correct order.');
-    $this->assertTrue(empty($installed), 'No modules installed during import');
+    $this->assertEmpty($installed, 'No modules installed during import');
 
     $theme_info = \Drupal::service('theme_handler')->listInfo();
     $this->assertFalse(isset($theme_info['bartik']), 'Bartik theme uninstalled during import.');
diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php
index 1fd76ccaff37dfec35c666171698a87571fb5e4f..42d54b21efe81eed2c735194799eced8c5727479 100644
--- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php
+++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationUiTest.php
@@ -3,7 +3,6 @@
 namespace Drupal\Tests\config_translation\Functional;
 
 use Drupal\Component\Utility\Html;
-use Drupal\Component\Render\FormattableMarkup;
 use Drupal\Core\Language\Language;
 use Drupal\Core\Language\LanguageInterface;
 use Drupal\Core\Test\AssertMailTrait;
@@ -843,7 +842,7 @@ public function testLocaleDBStorage() {
 
     // Make sure there is no translation stored in locale storage before edit.
     $translation = $this->getTranslation('user.settings', 'anonymous', 'fr');
-    $this->assertTrue(empty($translation));
+    $this->assertEmpty($translation);
 
     // Add custom translation.
     $edit = [
@@ -1124,12 +1123,12 @@ public function testMenuTranslationWithoutChange() {
    */
   protected function getTranslation($config_name, $key, $langcode) {
     $settings_locations = $this->localeStorage->getLocations(['type' => 'configuration', 'name' => $config_name]);
-    $this->assertTrue(!empty($settings_locations), new FormattableMarkup('Configuration locations found for %config_name.', ['%config_name' => $config_name]));
+    $this->assertNotEmpty($settings_locations, "$config_name should have configuration locations.");
 
     if (!empty($settings_locations)) {
       $source = $this->container->get('config.factory')->get($config_name)->get($key);
       $source_string = $this->localeStorage->findString(['source' => $source, 'type' => 'configuration']);
-      $this->assertTrue(!empty($source_string), new FormattableMarkup('Found string for %config_name.%key.', ['%config_name' => $config_name, '%key' => $key]));
+      $this->assertNotEmpty($source_string, "$config_name.$key should have a source string.");
 
       if (!empty($source_string)) {
         $conditions = [
diff --git a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
index 17f70fc4b67c11807340da4c0250bc0bbf2991c2..7355414411060e1b9407dc0efff2b1c3221faf9d 100644
--- a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
+++ b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
@@ -776,7 +776,7 @@ public function testDefaultValue() {
       // Check if default_date has been stored successfully.
       $config_entity = $this->config('field.field.node.date_content.' . $field_name)
         ->get();
-      $this->assertTrue(empty($config_entity['default_value']), 'Empty default value has been stored successfully');
+      $this->assertEmpty($config_entity['default_value'], 'Empty default value has been stored successfully');
 
       // Clear field cache in order to avoid stale cache values.
       \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
index d6c4e0cb7728b57d8250380e9c5589ae71890d64..3d323450b8df61c0d0571f9dd3552d6015cfd44a 100644
--- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
+++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
@@ -1118,7 +1118,7 @@ public function testDefaultValue() {
 
     // Check if default_date has been stored successfully.
     $config_entity = $this->config('field.field.node.date_content.' . $field_name)->get();
-    $this->assertTrue(empty($config_entity['default_value']), 'Empty default value has been stored successfully');
+    $this->assertEmpty($config_entity['default_value'], 'Empty default value has been stored successfully');
 
     // Clear field cache in order to avoid stale cache values.
     \Drupal::service('entity_field.manager')->clearCachedFieldDefinitions();
diff --git a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php
index 027d0eb7640bbdc513254b611d147d40b0db15fa..10fda5adc58467dabae02c7fcdf128f631cfbf97 100644
--- a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php
+++ b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php
@@ -347,7 +347,7 @@ public function testEntitySaveOrder() {
     $entity->name->value = $this->randomMachineName();
     // Now get the field value.
     $value = $entity->get('field_test_taxonomy_term');
-    $this->assertTrue(empty($value['target_id']));
+    $this->assertArrayNotHasKey('target_id', $value);
     $this->assertNull($entity->field_test_taxonomy_term->target_id);
     // And then set it.
     $entity->field_test_taxonomy_term = $value;
diff --git a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
index 715839cacc1d6145dd18cd353c50e5c604533718..6850eeae370b18be01f674b07d41814fb413d9a6 100644
--- a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
+++ b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceSettingsTest.php
@@ -177,7 +177,7 @@ public function testCustomTargetBundleDeletion() {
     // 'target_bundles' field setting.
     $field_config = FieldConfig::loadByName('node', $this->nodeType->id(), $name);
     $handler_settings = $field_config->getSetting('handler_settings');
-    $this->assertTrue(empty($handler_settings['target_bundles']));
+    $this->assertEmpty($handler_settings['target_bundles']);
   }
 
   /**
diff --git a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
index d46815f006d3422c83492d238f909524b8d2dc30..1ae8620840641f3202827273d8469b564ffae92a 100644
--- a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
@@ -365,8 +365,8 @@ public function testEntityDeleteBundle() {
     $controller->resetCache();
     $entity = $controller->load($entity->id());
 
-    $this->assertTrue(empty($entity->{$this->fieldTestData->field_name}), 'No data for first field');
-    $this->assertTrue(empty($entity->{$field_name}), 'No data for second field');
+    $this->assertEmpty($entity->{$this->fieldTestData->field_name}, 'No data for first field');
+    $this->assertEmpty($entity->{$field_name}, 'No data for second field');
 
     // Verify that the fields are gone.
     $this->assertNull(FieldConfig::load('entity_test.' . $this->fieldTestData->field->getTargetBundle() . '.' . $this->fieldTestData->field_name), "First field is deleted");
diff --git a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
index 85653e2d7f3dda1cad0b06796c8b6dcae3026a11..10a972abc5ce71ec4ee46edaff6412100dee282b 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
@@ -115,7 +115,7 @@ public function testImportDelete() {
     // completely removed once the data is purged.
     field_purge_batch(10);
     $deleted_storages = \Drupal::state()->get('field.storage.deleted', []);
-    $this->assertTrue(empty($deleted_storages), 'Fields are deleted');
+    $this->assertEmpty($deleted_storages, 'Fields are deleted');
   }
 
 }
diff --git a/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php b/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php
index a73f22dc72dd892d89bf84ce0c4655e6d23eb50b..266f20910e0703d565eb7bb5da3f59a5caa7c401 100644
--- a/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php
@@ -227,7 +227,7 @@ public function testRead() {
     $this->assertCount(1, $fields, 'The field was properly read.');
     $this->assertArrayHasKey($id, $fields, 'The field has the correct key.');
     $fields = $field_storage_config_storage->loadByProperties(['field_name' => $field_storage_definition['field_name'], 'type' => 'foo']);
-    $this->assertTrue(empty($fields), 'No field was found.');
+    $this->assertEmpty($fields, 'No field was found.');
 
     // Create a field from the field storage.
     $field_definition = [
@@ -337,11 +337,11 @@ public function testDeleteNoData() {
 
     // Try to load the storage normally and make sure it does not show up.
     $field_storage = FieldStorageConfig::load('entity_test.' . $field_storage_definition['field_name']);
-    $this->assertTrue(empty($field_storage), 'Field storage was deleted');
+    $this->assertEmpty($field_storage, 'Field storage was deleted');
 
     // Try to load the field normally and make sure it does not show up.
     $field = FieldConfig::load('entity_test.' . '.' . $field_definition['bundle'] . '.' . $field_definition['field_name']);
-    $this->assertTrue(empty($field), 'Field was deleted');
+    $this->assertEmpty($field, 'Field was deleted');
 
     // Make sure the other field and its storage are not deleted.
     $another_field_storage = FieldStorageConfig::load('entity_test.' . $another_field_storage_definition['field_name']);
diff --git a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
index 358c1f04e15bb9a2ae1a9f70d19c3fcff99717d0..e4cc74b449d09bb658fa30eb11be5a4653095858 100644
--- a/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
+++ b/core/modules/field_ui/tests/src/Kernel/EntityDisplayTest.php
@@ -595,7 +595,7 @@ public function testComponentDependencies() {
     // Reload the form display.
     $form_display = EntityFormDisplay::load($form_display->id());
     // The display exists.
-    $this->assertFalse(empty($form_display));
+    $this->assertNotEmpty($form_display);
     // The form display should not depend on $role[0] anymore.
     $this->assertNoDependency('config', $dependencies[0], $form_display);
     // The form display should depend on 'anonymous' user role.
@@ -612,7 +612,7 @@ public function testComponentDependencies() {
     // Reload the form display.
     $form_display = EntityFormDisplay::load($form_display->id());
     // The display exists.
-    $this->assertFalse(empty($form_display));
+    $this->assertNotEmpty($form_display);
     // The component is still enabled.
     $this->assertNotNull($form_display->getComponent($field_name));
     // The form display should not depend on 'color' module anymore.
@@ -624,7 +624,7 @@ public function testComponentDependencies() {
     // Reload the form display.
     $form_display = EntityFormDisplay::load($form_display->id());
     // The display exists.
-    $this->assertFalse(empty($form_display));
+    $this->assertNotEmpty($form_display);
     // The component has been disabled.
     $this->assertNull($form_display->getComponent($field_name));
     $this->assertTrue($form_display->get('hidden')[$field_name]);
diff --git a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php
index bef8026c396e6ba887602a486bae551833ae7d3e..49178c9f4dd8ee8180a81d4d98f9b99118cf09a4 100644
--- a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php
@@ -113,7 +113,7 @@ public function testSingleValuedWidget() {
     // Save the node and ensure it does not have the file.
     $this->submitForm([], 'Save');
     $node = $node_storage->loadUnchanged($nid);
-    $this->assertTrue(empty($node->{$field_name}->target_id), 'File was successfully removed from the node.');
+    $this->assertEmpty($node->{$field_name}->target_id, 'File was successfully removed from the node.');
   }
 
   /**
@@ -204,7 +204,7 @@ public function testMultiValuedWidget() {
     preg_match('/node\/([0-9])/', $this->getUrl(), $matches);
     $nid = $matches[1];
     $node = $node_storage->loadUnchanged($nid);
-    $this->assertTrue(empty($node->{$field_name}->target_id), 'Node was successfully saved without any files.');
+    $this->assertEmpty($node->{$field_name}->target_id, 'Node was successfully saved without any files.');
 
     // Try to upload more files than allowed on revision.
     $upload_files_node_revision = [$test_file, $test_file, $test_file, $test_file];
@@ -575,7 +575,7 @@ protected function doTestTemporaryFileRemovalExploit(UserInterface $victim_user,
     $victim_tmp_file = $this->createTemporaryFile('some text', $victim_user);
     $victim_tmp_file = File::load($victim_tmp_file->id());
     $this->assertTrue($victim_tmp_file->isTemporary(), 'New file saved to disk is temporary.');
-    $this->assertFalse(empty($victim_tmp_file->id()), 'New file has an fid.');
+    $this->assertNotEmpty($victim_tmp_file->id(), 'New file has an fid.');
     $this->assertEquals($victim_user->id(), $victim_tmp_file->getOwnerId(), 'New file belongs to the victim.');
 
     // Have attacker create a new node with a different uploaded file and
diff --git a/core/modules/file/tests/src/Kernel/DeleteTest.php b/core/modules/file/tests/src/Kernel/DeleteTest.php
index 59b0ea405388a2aa74e5a92c97950e4c448c11d3..e3ca3f5e3c0a3c8d77162bd5c658a240ba17ea22 100644
--- a/core/modules/file/tests/src/Kernel/DeleteTest.php
+++ b/core/modules/file/tests/src/Kernel/DeleteTest.php
@@ -52,7 +52,7 @@ public function testInUse() {
     $file_usage->delete($file, 'testing', 'test', 1);
     $usage = $file_usage->listUsage($file);
     $this->assertFileHooksCalled(['load', 'update']);
-    $this->assertTrue(empty($usage), 'File usage data was removed.');
+    $this->assertEmpty($usage, 'File usage data was removed.');
     $this->assertFileExists($file->getFileUri());
     $file = File::load($file->id());
     $this->assertNotEmpty($file, 'File still exists in the database.');
diff --git a/core/modules/forum/tests/src/Functional/ForumIndexTest.php b/core/modules/forum/tests/src/Functional/ForumIndexTest.php
index d90c73d31ce64e21557c27d24c3ee12e5292b9af..8be1ca651f8b03246c14b675c1fcc8946a469e50 100644
--- a/core/modules/forum/tests/src/Functional/ForumIndexTest.php
+++ b/core/modules/forum/tests/src/Functional/ForumIndexTest.php
@@ -59,7 +59,7 @@ public function testForumIndexStatus() {
 
     // Check that the node exists in the database.
     $node = $this->drupalGetNodeByTitle($title);
-    $this->assertTrue(!empty($node), 'New forum node found in database.');
+    $this->assertNotEmpty($node, 'New forum node found in database.');
 
     // Create a child forum.
     $edit = [
diff --git a/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php b/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php
index 1ca15cb687c757e5432b9459fc698fcea771b3ee..bbc0efe1314d934e1676cd1f3c67acb7ffd6c4ed 100644
--- a/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php
+++ b/core/modules/forum/tests/src/Functional/ForumNodeAccessTest.php
@@ -68,7 +68,7 @@ public function testForumNodeAccess() {
     $this->drupalGet('node/add/forum', ['query' => ['forum_id' => 1]]);
     $this->submitForm($edit, 'Save');
     $private_node = $this->drupalGetNodeByTitle($private_node_title);
-    $this->assertTrue(!empty($private_node), 'New private forum node found in database.');
+    $this->assertNotEmpty($private_node, 'New private forum node found in database.');
 
     // Create a public node.
     $public_node_title = $this->randomMachineName(20);
@@ -79,7 +79,7 @@ public function testForumNodeAccess() {
     $this->drupalGet('node/add/forum', ['query' => ['forum_id' => 1]]);
     $this->submitForm($edit, 'Save');
     $public_node = $this->drupalGetNodeByTitle($public_node_title);
-    $this->assertTrue(!empty($public_node), 'New public forum node found in database.');
+    $this->assertNotEmpty($public_node, 'New public forum node found in database.');
 
     // Enable the new and active forum blocks.
     $this->drupalPlaceBlock('forum_active_block');
diff --git a/core/modules/forum/tests/src/Functional/ForumTest.php b/core/modules/forum/tests/src/Functional/ForumTest.php
index 4d1e0767eacb6a18cfb0182276e3ffcba1718060..29135c74837ed545e2fd2b9326274b0ce6952309 100644
--- a/core/modules/forum/tests/src/Functional/ForumTest.php
+++ b/core/modules/forum/tests/src/Functional/ForumTest.php
@@ -464,7 +464,7 @@ public function createForum($type, $parent = 0) {
       'description__value' => $description,
     ]);
     $term = array_shift($term);
-    $this->assertTrue(!empty($term), 'The ' . $type . ' exists in the database');
+    $this->assertNotEmpty($term, "The forum type '$type' should exist in the database.");
 
     // Verify forum hierarchy.
     $tid = $term->id();
diff --git a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
index 167e279b444c41c2fcb32239f6afed1cfaf30a0f..8bacd7c951861d80642677a74460bd547dc7d635 100644
--- a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
@@ -179,9 +179,9 @@ public function testRead() {
       'user--user',
       $first_include['type']
     );
-    $this->assertFalse(empty($first_include['attributes']));
-    $this->assertTrue(empty($first_include['attributes']['mail']));
-    $this->assertTrue(empty($first_include['attributes']['pass']));
+    $this->assertNotEmpty($first_include['attributes']);
+    $this->assertArrayNotHasKey('mail', $first_include['attributes']);
+    $this->assertArrayNotHasKey('pass', $first_include['attributes']);
     // 12. Collection with one access denied.
     $this->nodes[1]->set('status', FALSE);
     $this->nodes[1]->save();
@@ -284,8 +284,8 @@ public function testRead() {
     $this->assertEquals(200, $response->getStatusCode());
     $this->assertEquals('user--user', $single_output['data']['type']);
     $this->assertEquals($this->user->get('name')->value, $single_output['data']['attributes']['name']);
-    $this->assertTrue(empty($single_output['data']['attributes']['mail']));
-    $this->assertTrue(empty($single_output['data']['attributes']['pass']));
+    $this->assertArrayNotHasKey('mail', $single_output['data']['attributes']);
+    $this->assertArrayNotHasKey('pass', $single_output['data']['attributes']);
     // 18. Test filtering on the column of a link.
     $filter = [
       'linkUri' => [
diff --git a/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php b/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php
index c3ee121f41d86c1211bdf1bf98e240e4164641e5..c104fbea37238a55484e41773a2d89c97d88c58d 100644
--- a/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php
+++ b/core/modules/jsonapi/tests/src/Kernel/Normalizer/JsonApiDocumentTopLevelNormalizerTest.php
@@ -299,7 +299,7 @@ public function testNormalize() {
         'related' => ['href' => Url::fromUri('internal:/jsonapi/node/article/' . $this->node->uuid() . '/uid', ['query' => ['resourceVersion' => 'id:' . $this->node->getRevisionId()]])->setAbsolute()->toString(TRUE)->getGeneratedUrl()],
       ],
     ], $normalized['data']['relationships']['uid']);
-    $this->assertTrue(empty($normalized['meta']['omitted']));
+    $this->assertArrayNotHasKey('meta', $normalized);
     $this->assertSame($this->user->uuid(), $normalized['included'][0]['id']);
     $this->assertSame('user--user', $normalized['included'][0]['type']);
     $this->assertSame('user1', $normalized['included'][0]['attributes']['display_name']);
@@ -394,8 +394,8 @@ public function testNormalizeUuid() {
     $this->assertStringMatchesFormat($this->node->uuid(), $normalized['data']['id']);
     $this->assertEquals($this->node->type->entity->uuid(), $normalized['data']['relationships']['node_type']['data']['id']);
     $this->assertEquals($this->user->uuid(), $normalized['data']['relationships']['uid']['data']['id']);
-    $this->assertFalse(empty($normalized['included'][0]['id']));
-    $this->assertTrue(empty($normalized['meta']['omitted']));
+    $this->assertNotEmpty($normalized['included'][0]['id']);
+    $this->assertArrayNotHasKey('meta', $normalized);
     $this->assertEquals($this->user->uuid(), $normalized['included'][0]['id']);
     $this->assertCount(1, $normalized['included'][0]['attributes']);
     $this->assertCount(12, $normalized['included'][1]['attributes']);
diff --git a/core/modules/jsonapi/tests/src/Unit/Normalizer/HttpExceptionNormalizerTest.php b/core/modules/jsonapi/tests/src/Unit/Normalizer/HttpExceptionNormalizerTest.php
index 1e43522591e2d06d6f75d68d6d5e60c71901d47f..928fdf8514aefe5c75275c52e78a1546ab3f23d0 100644
--- a/core/modules/jsonapi/tests/src/Unit/Normalizer/HttpExceptionNormalizerTest.php
+++ b/core/modules/jsonapi/tests/src/Unit/Normalizer/HttpExceptionNormalizerTest.php
@@ -49,8 +49,8 @@ public function testNormalize() {
     $normalized = $normalizer->normalize($exception, 'api_json');
     $normalized = $normalized->getNormalization();
     $error = $normalized[0];
-    $this->assertTrue(empty($error['meta']));
-    $this->assertTrue(empty($error['source']));
+    $this->assertArrayNotHasKey('meta', $error);
+    $this->assertArrayNotHasKey('source', $error);
   }
 
 }
diff --git a/core/modules/language/tests/src/Functional/LanguageConfigSchemaTest.php b/core/modules/language/tests/src/Functional/LanguageConfigSchemaTest.php
index af801d8ca87fbb9f039ef946dbb5e998aa3b9bdf..7145d7c30c804c20db690629e45085265023c7cc 100644
--- a/core/modules/language/tests/src/Functional/LanguageConfigSchemaTest.php
+++ b/core/modules/language/tests/src/Functional/LanguageConfigSchemaTest.php
@@ -50,7 +50,7 @@ protected function setUp(): void {
   public function testValidLanguageConfigSchema() {
     // Make sure no language configuration available by default.
     $config_data = $this->config('language.settings')->get();
-    $this->assertTrue(empty($config_data));
+    $this->assertEmpty($config_data);
 
     $settings_path = 'admin/config/regional/content-language';
 
diff --git a/core/modules/locale/tests/src/Functional/LocaleContentTest.php b/core/modules/locale/tests/src/Functional/LocaleContentTest.php
index 1f67248703c9cd7fac9c8e5d404556e398722575..9b4c3b51ea6d760fea3391de28d49b81de8007cc 100644
--- a/core/modules/locale/tests/src/Functional/LocaleContentTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleContentTest.php
@@ -215,25 +215,25 @@ public function testContentTypeDirLang() {
     // Check if English node does not have lang tag.
     $this->drupalGet('node/' . $nodes['en']->id());
     $element = $this->cssSelect('article.node[lang="en"]');
-    $this->assertTrue(empty($element), 'The lang tag has not been assigned to the English node.');
+    $this->assertEmpty($element, 'The lang tag has not been assigned to the English node.');
 
     // Check if English node does not have dir tag.
     $element = $this->cssSelect('article.node[dir="ltr"]');
-    $this->assertTrue(empty($element), 'The dir tag has not been assigned to the English node.');
+    $this->assertEmpty($element, 'The dir tag has not been assigned to the English node.');
 
     // Check if Arabic node has lang="ar" & dir="rtl" tags.
     $this->drupalGet('node/' . $nodes['ar']->id());
     $element = $this->cssSelect('article.node[lang="ar"][dir="rtl"]');
-    $this->assertTrue(!empty($element), 'The lang and dir tags have been assigned correctly to the Arabic node.');
+    $this->assertNotEmpty($element, 'The lang and dir tags have been assigned correctly to the Arabic node.');
 
     // Check if Spanish node has lang="es" tag.
     $this->drupalGet('node/' . $nodes['es']->id());
     $element = $this->cssSelect('article.node[lang="es"]');
-    $this->assertTrue(!empty($element), 'The lang tag has been assigned correctly to the Spanish node.');
+    $this->assertNotEmpty($element, 'The lang tag has been assigned correctly to the Spanish node.');
 
     // Check if Spanish node does not have dir="ltr" tag.
     $element = $this->cssSelect('article.node[lang="es"][dir="ltr"]');
-    $this->assertTrue(empty($element), 'The dir tag has not been assigned to the Spanish node.');
+    $this->assertEmpty($element, 'The dir tag has not been assigned to the Spanish node.');
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php
index e3bcc483002badc9e93f3f841758d4ecf1b77520..f22cc669128be0edb96f0ea9dca61005bc2319c0 100644
--- a/core/modules/node/tests/src/Functional/NodeRevisionsTest.php
+++ b/core/modules/node/tests/src/Functional/NodeRevisionsTest.php
@@ -358,7 +358,7 @@ public function testNodeRevisionWithoutLogMessage() {
     $this->assertSession()->pageTextContains($new_title);
     $node_storage->resetCache([$node->id()]);
     $node_revision = $node_storage->load($node->id());
-    $this->assertTrue(empty($node_revision->revision_log->value), 'After a new node revision is saved with an empty log message, the log message for the node is empty.');
+    $this->assertEmpty($node_revision->revision_log->value, 'After a new node revision is saved with an empty log message, the log message for the node is empty.');
   }
 
   /**
diff --git a/core/modules/node/tests/src/Functional/PagePreviewTest.php b/core/modules/node/tests/src/Functional/PagePreviewTest.php
index 4eca2c42b381b8ae096df23e67f5069a03b91d80..9f188c0010143306d41337030db9c1c87aaae4cb 100644
--- a/core/modules/node/tests/src/Functional/PagePreviewTest.php
+++ b/core/modules/node/tests/src/Functional/PagePreviewTest.php
@@ -213,7 +213,7 @@ public function testPagePreview() {
 
     // Check that we see the class of the node type on the body element.
     $body_class_element = $this->xpath("//body[contains(@class, 'page-node-type-page')]");
-    $this->assertTrue(!empty($body_class_element), 'Node type body class found.');
+    $this->assertNotEmpty($body_class_element, 'Node type body class found.');
 
     // Get the UUID.
     $url = parse_url($this->getUrl());
diff --git a/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareCombinationTest.php b/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareCombinationTest.php
index 2a71d6446f3b73705561819c08bae555d2a87f1c..dc1966815f5ff4ffb87311de99f7a10673613dcf 100644
--- a/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareCombinationTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareCombinationTest.php
@@ -309,7 +309,7 @@ public function testNodeAccessLanguageAwareCombination() {
     $nids = $select->execute()->fetchAllAssoc('nid');
 
     // There are no nodes with German translations, so no results are returned.
-    $this->assertTrue(empty($nids), 'Query returns an empty result.');
+    $this->assertEmpty($nids, 'Query returns an empty result.');
 
     // Query the nodes table as admin user (full access) with the node access
     // tag and no specific langcode.
diff --git a/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareTest.php b/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareTest.php
index 7fb4067586294e2f2a9c06a96721a9446ea96560..e4ec70f980f9eb4f43a9697e529d5e5078fbfb39 100644
--- a/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareTest.php
@@ -247,7 +247,7 @@ public function testNodeAccessLanguageAware() {
     $nids = $select->execute()->fetchAllAssoc('nid');
 
     // There are no nodes with German translations, so no results are returned.
-    $this->assertTrue(empty($nids), 'Query returns an empty result when the de langcode is specified.');
+    $this->assertEmpty($nids, 'Query returns an empty result when the de langcode is specified.');
 
     // Query the nodes table as admin user (full access) with the node access
     // tag and no specific langcode.
diff --git a/core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php b/core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php
index a7a66057af98d767fc20ca21f7aa0b6980d4eaa3..7e9f8873006a2134828d3628a2f7a8f5455cfe23 100644
--- a/core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php
@@ -231,7 +231,7 @@ public function testNodeAccessQueryTag() {
     $nids = $select->execute()->fetchAllAssoc('nid');
 
     // Because no nodes are created in German, no nodes are returned.
-    $this->assertTrue(empty($nids), 'Query returns an empty result.');
+    $this->assertEmpty($nids, 'Query returns an empty result.');
 
     // Query the nodes table as admin user (full access) with the node access
     // tag and no specific langcode.
diff --git a/core/modules/options/tests/src/Kernel/OptionsFieldTest.php b/core/modules/options/tests/src/Kernel/OptionsFieldTest.php
index d80be94be79982c518665a0a8510b78d0ef77ed8..001a04e1719723744106992fe555cde7a8f4f1ca 100644
--- a/core/modules/options/tests/src/Kernel/OptionsFieldTest.php
+++ b/core/modules/options/tests/src/Kernel/OptionsFieldTest.php
@@ -28,9 +28,9 @@ public function testUpdateAllowedValues() {
     // All three options appear.
     $entity = EntityTest::create();
     $form = \Drupal::service('entity.form_builder')->getForm($entity);
-    $this->assertTrue(!empty($form[$this->fieldName]['widget'][1]), 'Option 1 exists');
-    $this->assertTrue(!empty($form[$this->fieldName]['widget'][2]), 'Option 2 exists');
-    $this->assertTrue(!empty($form[$this->fieldName]['widget'][3]), 'Option 3 exists');
+    $this->assertArrayHasKey(1, $form[$this->fieldName]['widget'], 'Option 1 exists');
+    $this->assertArrayHasKey(2, $form[$this->fieldName]['widget'], 'Option 2 exists');
+    $this->assertArrayHasKey(3, $form[$this->fieldName]['widget'], 'Option 3 exists');
 
     // Use one of the values in an actual entity, and check that this value
     // cannot be removed from the list.
@@ -54,9 +54,9 @@ public function testUpdateAllowedValues() {
     $this->fieldStorage->save();
     $entity = EntityTest::create();
     $form = \Drupal::service('entity.form_builder')->getForm($entity);
-    $this->assertTrue(empty($form[$this->fieldName]['widget'][1]), 'Option 1 does not exist');
-    $this->assertTrue(!empty($form[$this->fieldName]['widget'][2]), 'Option 2 exists');
-    $this->assertTrue(empty($form[$this->fieldName]['widget'][3]), 'Option 3 does not exist');
+    $this->assertArrayNotHasKey(1, $form[$this->fieldName]['widget'], 'Option 1 does not exist');
+    $this->assertArrayHasKey(2, $form[$this->fieldName]['widget'], 'Option 2 exists');
+    $this->assertArrayNotHasKey(3, $form[$this->fieldName]['widget'], 'Option 3 does not exist');
 
     // Completely new options appear.
     $this->fieldStorage->setSetting('allowed_values', [10 => 'Update', 20 => 'Twenty']);
@@ -65,11 +65,11 @@ public function testUpdateAllowedValues() {
     // setting, so we need to reinitialize the entity object.
     $entity = EntityTest::create();
     $form = \Drupal::service('entity.form_builder')->getForm($entity);
-    $this->assertTrue(empty($form[$this->fieldName]['widget'][1]), 'Option 1 does not exist');
-    $this->assertTrue(empty($form[$this->fieldName]['widget'][2]), 'Option 2 does not exist');
-    $this->assertTrue(empty($form[$this->fieldName]['widget'][3]), 'Option 3 does not exist');
-    $this->assertTrue(!empty($form[$this->fieldName]['widget'][10]), 'Option 10 exists');
-    $this->assertTrue(!empty($form[$this->fieldName]['widget'][20]), 'Option 20 exists');
+    $this->assertArrayNotHasKey(1, $form[$this->fieldName]['widget'], 'Option 1 does not exist');
+    $this->assertArrayNotHasKey(2, $form[$this->fieldName]['widget'], 'Option 2 does not exist');
+    $this->assertArrayNotHasKey(3, $form[$this->fieldName]['widget'], 'Option 3 does not exist');
+    $this->assertArrayHasKey(10, $form[$this->fieldName]['widget'], 'Option 10 exists');
+    $this->assertArrayHasKey(20, $form[$this->fieldName]['widget'], 'Option 20 exists');
 
     // Options are reset when a new field with the same name is created.
     $this->fieldStorage->delete();
@@ -88,9 +88,9 @@ public function testUpdateAllowedValues() {
       ->save();
     $entity = EntityTest::create();
     $form = \Drupal::service('entity.form_builder')->getForm($entity);
-    $this->assertTrue(!empty($form[$this->fieldName]['widget'][1]), 'Option 1 exists');
-    $this->assertTrue(!empty($form[$this->fieldName]['widget'][2]), 'Option 2 exists');
-    $this->assertTrue(!empty($form[$this->fieldName]['widget'][3]), 'Option 3 exists');
+    $this->assertArrayHasKey(1, $form[$this->fieldName]['widget'], 'Option 1 exists');
+    $this->assertArrayHasKey(2, $form[$this->fieldName]['widget'], 'Option 2 exists');
+    $this->assertArrayHasKey(3, $form[$this->fieldName]['widget'], 'Option 3 exists');
 
     // Test the generateSampleValue() method.
     $entity = EntityTest::create();
diff --git a/core/modules/path/tests/src/Functional/PathAliasTest.php b/core/modules/path/tests/src/Functional/PathAliasTest.php
index 04acb78a1b20e7fa853fb4065aec0a36b3ef44e1..013ceebdc3d13cd36ecaccb22afae0cc971b2c07 100644
--- a/core/modules/path/tests/src/Functional/PathAliasTest.php
+++ b/core/modules/path/tests/src/Functional/PathAliasTest.php
@@ -267,9 +267,9 @@ public function testNodeAlias() {
 
     // Confirm the 'canonical' and 'shortlink' URLs.
     $elements = $this->xpath("//link[contains(@rel, 'canonical') and contains(@href, '" . $edit['path[0][alias]'] . "')]");
-    $this->assertTrue(!empty($elements), 'Page contains canonical link URL.');
+    $this->assertNotEmpty($elements, 'Page contains canonical link URL.');
     $elements = $this->xpath("//link[contains(@rel, 'shortlink') and contains(@href, 'node/" . $node1->id() . "')]");
-    $this->assertTrue(!empty($elements), 'Page contains shortlink URL.');
+    $this->assertNotEmpty($elements, 'Page contains shortlink URL.');
 
     $previous = $edit['path[0][alias]'];
     // Change alias to one containing "exotic" characters.
diff --git a/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php b/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php
index 821727d1993afe0e5a2380640c64c0d93e8558de..b578e92640ecbd8ed46a01b4601295f5db1a8322 100644
--- a/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php
+++ b/core/modules/path/tests/src/Functional/PathTaxonomyTermTest.php
@@ -69,9 +69,9 @@ public function testTermAlias() {
 
     // Confirm the 'canonical' and 'shortlink' URLs.
     $elements = $this->xpath("//link[contains(@rel, 'canonical') and contains(@href, '" . $edit['path[0][alias]'] . "')]");
-    $this->assertTrue(!empty($elements), 'Term page contains canonical link URL.');
+    $this->assertNotEmpty($elements, 'Term page contains canonical link URL.');
     $elements = $this->xpath("//link[contains(@rel, 'shortlink') and contains(@href, 'taxonomy/term/" . $tid . "')]");
-    $this->assertTrue(!empty($elements), 'Term page contains shortlink URL.');
+    $this->assertNotEmpty($elements, 'Term page contains shortlink URL.');
 
     // Change the term's URL alias.
     $edit2 = [];
diff --git a/core/modules/quickedit/tests/src/Kernel/QuickEditLoadingTest.php b/core/modules/quickedit/tests/src/Kernel/QuickEditLoadingTest.php
index d034d2c9e140a1158d6ab8dacb44767f250815c3..0066ca9495e9a623cb6c464ad0e45de8e31c8524 100644
--- a/core/modules/quickedit/tests/src/Kernel/QuickEditLoadingTest.php
+++ b/core/modules/quickedit/tests/src/Kernel/QuickEditLoadingTest.php
@@ -77,12 +77,12 @@ public function testDisplayOptions() {
     $build = $node->body->view(['label' => 'inline']);
     $this->setRawContent($renderer->renderRoot($build));
     $elements = $this->xpath('//div[@data-quickedit-field-id]');
-    $this->assertFalse(!empty($elements), 'data-quickedit-field-id attribute not added when rendering field using dynamic display options.');
+    $this->assertEmpty($elements, 'data-quickedit-field-id attribute not added when rendering field using dynamic display options.');
 
     $build = $node->body->view('default');
     $this->setRawContent($renderer->renderRoot($build));
     $elements = $this->xpath('//div[@data-quickedit-field-id="node/1/body/en/default"]');
-    $this->assertTrue(!empty($elements), 'Body with data-quickedit-field-id attribute found.');
+    $this->assertNotEmpty($elements, 'Body with data-quickedit-field-id attribute found.');
   }
 
 }
diff --git a/core/modules/search/tests/src/Functional/SearchBlockTest.php b/core/modules/search/tests/src/Functional/SearchBlockTest.php
index c1c18c7b919bd30a4d831a2330ec8c25fa34e16e..7cf659ba49487e3ed0b0e052a87da6597b934a01 100644
--- a/core/modules/search/tests/src/Functional/SearchBlockTest.php
+++ b/core/modules/search/tests/src/Functional/SearchBlockTest.php
@@ -64,7 +64,7 @@ public function testSearchFormBlock() {
     // Check that name attribute is not empty.
     $pattern = "//input[@type='submit' and @name='']";
     $elements = $this->xpath($pattern);
-    $this->assertTrue(empty($elements), 'The search input field does not have empty name attribute.');
+    $this->assertEmpty($elements, 'The search input field does not have empty name attribute.');
 
     // Test a normal search via the block form, from the front page.
     $terms = ['keys' => 'test'];
diff --git a/core/modules/search/tests/src/Kernel/SearchExcerptTest.php b/core/modules/search/tests/src/Kernel/SearchExcerptTest.php
index 7ef4044eab25080ab12912b1a420d75e98f8d949..3d740bb586d2e89942f5193dc5d9a0062403388f 100644
--- a/core/modules/search/tests/src/Kernel/SearchExcerptTest.php
+++ b/core/modules/search/tests/src/Kernel/SearchExcerptTest.php
@@ -64,7 +64,7 @@ public function testSearchExcerpt() {
     // 123456789 HTMLTest +123456789+&lsquo;  +&lsquo;  +&lsquo;  +&lsquo;  +12345678  &nbsp;&nbsp;  +&lsquo;  +&lsquo;  +&lsquo;   &lsquo;
     $text = "<div class=\"field field--name-body field--type-text-with-summary field--label-hidden\"><div class=\"field__items\"><div class=\"field__item even\" property=\"content:encoded\"><p>123456789 HTMLTest +123456789+‘  +‘  +‘  +‘  +12345678      +‘  +‘  +‘   ‘</p>\n</div></div></div> ";
     $result = $this->doSearchExcerpt('HTMLTest', $text);
-    $this->assertFalse(empty($result), 'Rendered Multi-byte HTML encodings are not corrupted in search excerpts');
+    $this->assertNotEmpty($result, 'Rendered Multi-byte HTML encodings are not corrupted in search excerpts');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php b/core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php
index 4e064969f8fd58200c273319ff214313591c064f..110fc1516f9f6331d4ef673d082f91c4720ac7ee 100644
--- a/core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php
+++ b/core/modules/system/tests/src/Functional/Common/NoJavaScriptAnonymousTest.php
@@ -53,7 +53,7 @@ public function testNoJavaScript() {
   protected function assertNoJavaScript(): void {
     // Ensure drupalSettings is not set.
     $settings = $this->getDrupalSettings();
-    $this->assertTrue(empty($settings), 'drupalSettings is not set.');
+    $this->assertEmpty($settings, 'drupalSettings is not set.');
     $this->assertSession()->responseNotMatches('/\.js/');
   }
 
diff --git a/core/modules/system/tests/src/Functional/Form/FormTest.php b/core/modules/system/tests/src/Functional/Form/FormTest.php
index 7c4eddd2fd38f7f331b52c35c9f3bdd553600b40..d1b00eea3650a0791b0c1bcfbf8c1f88ba49c340 100644
--- a/core/modules/system/tests/src/Functional/Form/FormTest.php
+++ b/core/modules/system/tests/src/Functional/Form/FormTest.php
@@ -147,7 +147,7 @@ public function testRequiredFields() {
             else {
               // Make sure there is *no* form error for this element. We're
               // not using assertEmpty() because the array key might not exist.
-              $this->assertTrue(empty($errors[$element]), "Optional '$type' field '$element' has no errors with empty input");
+              $this->assertArrayNotHasKey($element, $errors, "Optional '$type' field '$element' should have no errors with empty input.");
             }
           }
         }
diff --git a/core/modules/system/tests/src/Functional/Form/StorageTest.php b/core/modules/system/tests/src/Functional/Form/StorageTest.php
index 847a6b460899d90baca55ee9f4a3370a1ab466f0..385ca20392a84a324da3f345cee70bb678ac28cd 100644
--- a/core/modules/system/tests/src/Functional/Form/StorageTest.php
+++ b/core/modules/system/tests/src/Functional/Form/StorageTest.php
@@ -211,8 +211,8 @@ public function testImmutableFormLegacyProtection() {
     $original = json_decode($response, TRUE);
     $this->assertEquals($original['form']['#build_id_old'], $build_id, 'Original build_id was recorded');
     $this->assertNotEquals($original['form']['#build_id'], $build_id, 'New build_id was generated');
-    $this->assertTrue(empty($original['form']['#poisoned']), 'Original form structure was preserved');
-    $this->assertTrue(empty($original['form_state']['poisoned']), 'Original form state was preserved');
+    $this->assertArrayNotHasKey('#poisoned', $original['form'], 'Original form structure was preserved');
+    $this->assertArrayNotHasKey('poisoned', $original['form_state'], 'Original form state was preserved');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Menu/AssertMenuActiveTrailTrait.php b/core/modules/system/tests/src/Functional/Menu/AssertMenuActiveTrailTrait.php
index f525f86441939df6f8bfc3d658f6026243cac69b..1f70d519533e310be730bc5a0037c266e3cd96af 100644
--- a/core/modules/system/tests/src/Functional/Menu/AssertMenuActiveTrailTrait.php
+++ b/core/modules/system/tests/src/Functional/Menu/AssertMenuActiveTrailTrait.php
@@ -2,7 +2,6 @@
 
 namespace Drupal\Tests\system\Functional\Menu;
 
-use Drupal\Component\Render\FormattableMarkup;
 use Drupal\Core\Url;
 
 /**
@@ -40,7 +39,7 @@ protected function assertMenuActiveTrail($tree, $last_active) {
         $i++;
       }
       $elements = $this->xpath($xpath);
-      $this->assertTrue(!empty($elements), 'Active trail to current page was found in menu tree.');
+      $this->assertNotEmpty($elements, 'Active trail to current page should be visible in menu tree.');
 
       // Append prefix for active link asserted below.
       $xpath .= '/following-sibling::ul/descendant::';
@@ -57,10 +56,7 @@ protected function assertMenuActiveTrail($tree, $last_active) {
       ':title' => $active_link_title,
     ];
     $elements = $this->xpath($xpath, $args);
-    $this->assertTrue(!empty($elements), new FormattableMarkup('Active link %title was found in menu tree, including active trail links %tree.', [
-      '%title' => $active_link_title,
-      '%tree' => implode(' » ', $tree),
-    ]));
+    $this->assertNotEmpty($elements, sprintf('Active link %s should be visible in menu tree, including active trail links %s.', $active_link_title, implode(' » ', $tree)));
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Session/SessionTest.php b/core/modules/system/tests/src/Functional/Session/SessionTest.php
index 10c8f55b4704148a8f289c0b32af1da98dccfe08..4b696ea2d5b80ce0542d63b8ff5cd50cf2301f02 100644
--- a/core/modules/system/tests/src/Functional/Session/SessionTest.php
+++ b/core/modules/system/tests/src/Functional/Session/SessionTest.php
@@ -60,7 +60,7 @@ public function testSessionSaveRegenerate() {
     $this->drupalGet('session-test/id');
     $matches = [];
     preg_match('/\s*session_id:(.*)\n/', $this->getSession()->getPage()->getContent(), $matches);
-    $this->assertTrue(!empty($matches[1]), 'Found session ID before logging in.');
+    $this->assertNotEmpty($matches[1], 'Found session ID before logging in.');
     $original_session = $matches[1];
 
     // We cannot use $this->drupalLogin($user); because we exit in
@@ -77,7 +77,7 @@ public function testSessionSaveRegenerate() {
     $this->drupalGet('session-test/id');
     $matches = [];
     preg_match('/\s*session_id:(.*)\n/', $this->getSession()->getPage()->getContent(), $matches);
-    $this->assertTrue(!empty($matches[1]), 'Found session ID after logging in.');
+    $this->assertNotEmpty($matches[1], 'Found session ID after logging in.');
     $this->assertNotSame($original_session, $matches[1], 'Session ID changed after login.');
   }
 
diff --git a/core/modules/system/tests/src/Functional/Theme/EngineTwigTest.php b/core/modules/system/tests/src/Functional/Theme/EngineTwigTest.php
index da8fe199b8bc3c67c4b9e8728979633e72b04f11..c358a92f74e4b77715d60bb4ceb7ee363bb838a6 100644
--- a/core/modules/system/tests/src/Functional/Theme/EngineTwigTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/EngineTwigTest.php
@@ -69,7 +69,7 @@ public function testTwigUrlGenerator() {
 
     // Make sure we got something.
     $content = $this->getSession()->getPage()->getContent();
-    $this->assertFalse(empty($content), 'Page content is not empty');
+    $this->assertNotEmpty($content, 'Page content is not empty');
     foreach ($expected as $string) {
       $this->assertSession()->responseContains('<div>' . $string . '</div>');
     }
@@ -103,7 +103,7 @@ public function testTwigLinkGenerator() {
     $this->assertCacheContext('url.site');
 
     $content = $this->getSession()->getPage()->getContent();
-    $this->assertFalse(empty($content), 'Page content is not empty');
+    $this->assertNotEmpty($content, 'Page content is not empty');
     foreach ($expected as $string) {
       $this->assertSession()->responseContains('<div>' . $string . '</div>');
     }
@@ -122,7 +122,7 @@ public function testTwigUrlToString() {
     ];
 
     $content = $this->getSession()->getPage()->getContent();
-    $this->assertFalse(empty($content), 'Page content is not empty');
+    $this->assertNotEmpty($content, 'Page content is not empty');
     foreach ($expected as $string) {
       $this->assertSession()->responseContains('<div>' . $string . '</div>');
     }
diff --git a/core/modules/system/tests/src/Kernel/Action/ActionTest.php b/core/modules/system/tests/src/Kernel/Action/ActionTest.php
index 2dac37555cec52d73f7476076ab4dd4176800d53..becf628e64b7446a8c0ac0a62ca996fab0242c01 100644
--- a/core/modules/system/tests/src/Kernel/Action/ActionTest.php
+++ b/core/modules/system/tests/src/Kernel/Action/ActionTest.php
@@ -45,13 +45,13 @@ public function testOperations() {
     $definitions = $this->actionManager->getDefinitions();
     // Verify that the action definitions are found.
     $this->assertGreaterThan(1, count($definitions));
-    $this->assertTrue(!empty($definitions['action_test_no_type']), 'The test action is among the definitions found.');
+    $this->assertNotEmpty($definitions['action_test_no_type'], 'The test action is among the definitions found.');
 
     $definition = $this->actionManager->getDefinition('action_test_no_type');
-    $this->assertTrue(!empty($definition), 'The test action definition is found.');
+    $this->assertNotEmpty($definition, 'The test action definition is found.');
 
     $definitions = $this->actionManager->getDefinitionsByType('user');
-    $this->assertTrue(empty($definitions['action_test_no_type']), 'An action with no type is not found.');
+    $this->assertArrayNotHasKey('action_test_no_type', $definitions, 'An action with no type is not found.');
 
     // Create an instance of the 'save entity' action.
     $action = $this->actionManager->createInstance('action_test_save_entity');
diff --git a/core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelectionReferenceableTest.php b/core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelectionReferenceableTest.php
index bab37c3981dde82392e77bbedf5601a15f20a03b..a0e5bc68749f03ccdc88177ede4ade47b91d9f48 100644
--- a/core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelectionReferenceableTest.php
+++ b/core/modules/system/tests/src/Kernel/Entity/EntityReferenceSelectionReferenceableTest.php
@@ -113,7 +113,7 @@ public function testReferenceablesWithNoLabelKey($match, $match_operator, $limit
 
     // Number of returned items.
     if (empty($count_limited)) {
-      $this->assertTrue(empty($referenceables[$this->bundle]));
+      $this->assertArrayNotHasKey($this->bundle, $referenceables);
     }
     else {
       $this->assertCount($count_limited, $referenceables[$this->bundle]);
diff --git a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
index f672a4c7cc208eee344f53e72d9d0ea014c64acc..42278b772ec084abe5458116a3a90ad11e4dc205 100644
--- a/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
+++ b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php
@@ -301,7 +301,7 @@ public function testModuleMetaData() {
     // Generate the list of available modules.
     $modules = $this->container->get('extension.list.module')->getList();
     // Check that the mtime field exists for the system module.
-    $this->assertTrue(!empty($modules['system']->info['mtime']), 'The system.info.yml file modification time field is present.');
+    $this->assertNotEmpty($modules['system']->info['mtime'], 'The system.info.yml file modification time field is present.');
     // Use 0 if mtime isn't present, to avoid an array index notice.
     $test_mtime = !empty($modules['system']->info['mtime']) ? $modules['system']->info['mtime'] : 0;
     // Ensure the mtime field contains a number that is greater than zero.
@@ -333,7 +333,7 @@ public function testThemeMetaData() {
     // Generate the list of available themes.
     $themes = \Drupal::service('theme_handler')->rebuildThemeData();
     // Check that the mtime field exists for the bartik theme.
-    $this->assertTrue(!empty($themes['bartik']->info['mtime']), 'The bartik.info.yml file modification time field is present.');
+    $this->assertNotEmpty($themes['bartik']->info['mtime'], 'The bartik.info.yml file modification time field is present.');
     // Use 0 if mtime isn't present, to avoid an array index notice.
     $test_mtime = !empty($themes['bartik']->info['mtime']) ? $themes['bartik']->info['mtime'] : 0;
     // Ensure the mtime field contains a number that is greater than zero.
diff --git a/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php b/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php
index 30d27000f3e1838a5b5ffa1af0f84cfeda5d66c9..85b25ffe9b65c613eaf0985058ba2cd6140a41c9 100644
--- a/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TaxonomyTermIndentationTest.php
@@ -97,7 +97,7 @@ public function testTermIndentation() {
     // Check explicitly that term 2 has no parents.
     \Drupal::entityTypeManager()->getStorage('taxonomy_term')->resetCache();
     $parents = $taxonomy_storage->loadParents($term2->id());
-    $this->assertTrue(empty($parents), 'Term 2 has no parents now');
+    $this->assertEmpty($parents, 'Term 2 has no parents now');
   }
 
 }
diff --git a/core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php b/core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php
index ab39d7babc96bcd7e1d09c3319aa495607e822d3..f64a0af32f711dd615fc81a1713026b2ac1ba2c2 100644
--- a/core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php
@@ -172,7 +172,7 @@ public function testAutocompleteCountResults() {
       $this->autocompleteUrl,
       ['query' => ['q' => 'zzz']]
     );
-    $this->assertTrue(empty($data), 'Autocomplete returned no results');
+    $this->assertEmpty($data, 'Autocomplete returned no results');
 
     // Test that only one matching term found, when only one matches.
     $data = $this->drupalGetJson(
diff --git a/core/modules/taxonomy/tests/src/Functional/TermTest.php b/core/modules/taxonomy/tests/src/Functional/TermTest.php
index 99d4a1e74957c3c949ca1ebe2093dfc66450c33e..4ec62e5bdfa369a01e3c3a425534870c06cf5f04 100644
--- a/core/modules/taxonomy/tests/src/Functional/TermTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TermTest.php
@@ -275,7 +275,7 @@ public function testNodeTermCreationAndDeletion() {
       $this->assertSession()->pageTextContains($term);
     }
     $tree = $this->container->get('entity_type.manager')->getStorage('taxonomy_term')->loadTree($this->vocabulary->id());
-    $this->assertTrue(empty($tree), 'The terms are not created on preview.');
+    $this->assertEmpty($tree, 'The terms are not created on preview.');
 
     // Save, creating the terms.
     $this->drupalGet('node/add/article');
diff --git a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
index 3f85b2f81940291b26b6fe5329d67a79664bb055..29e43b72bf56f8ac7e3f0811748c0d08f0f96024 100644
--- a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
@@ -38,7 +38,7 @@ public function testTermDelete() {
     // Delete a valid term.
     $valid_term->delete();
     $terms = \Drupal::entityTypeManager()->getStorage('taxonomy_term')->loadByProperties(['vid' => $vocabulary->id()]);
-    $this->assertTrue(empty($terms), 'Vocabulary is empty after deletion');
+    $this->assertEmpty($terms, 'Vocabulary is empty after deletion');
   }
 
   /**
@@ -57,12 +57,12 @@ public function testMultipleParentDelete() {
     $term_storage = $this->container->get('entity_type.manager')->getStorage('taxonomy_term');
     $term_storage->resetCache([$child_term_id]);
     $child_term = Term::load($child_term_id);
-    $this->assertTrue(!empty($child_term), 'Child term is not deleted if only one of its parents is removed.');
+    $this->assertNotEmpty($child_term, 'Child term is not deleted if only one of its parents is removed.');
 
     $parent_term2->delete();
     $term_storage->resetCache([$child_term_id]);
     $child_term = Term::load($child_term_id);
-    $this->assertTrue(empty($child_term), 'Child term is deleted if all of its parents are removed.');
+    $this->assertEmpty($child_term, 'Child term is deleted if all of its parents are removed.');
   }
 
   /**
@@ -161,11 +161,11 @@ public function testTermPreview() {
     // Confirm we can get the view of unsaved term.
     $render_array = $entity_manager->getViewBuilder('taxonomy_term')
       ->view($term);
-    $this->assertTrue(!empty($render_array), 'Term view builder is built.');
+    $this->assertNotEmpty($render_array, 'Term view builder is built.');
 
     // Confirm we can render said view.
     $rendered = \Drupal::service('renderer')->renderPlain($render_array);
-    $this->assertTrue(!empty(trim($rendered)), 'Term is able to be rendered.');
+    $this->assertNotEmpty(trim($rendered), 'Term is able to be rendered.');
   }
 
 }
diff --git a/core/modules/text/tests/src/Kernel/TextSummaryTest.php b/core/modules/text/tests/src/Kernel/TextSummaryTest.php
index 5537e74acc0cd7d2ae0376c50c5c9ac8e480963c..acac900bfcea184aa7f24595358747a8434a9098 100644
--- a/core/modules/text/tests/src/Kernel/TextSummaryTest.php
+++ b/core/modules/text/tests/src/Kernel/TextSummaryTest.php
@@ -297,8 +297,8 @@ public function testRequiredSummary() {
       'test_textwithsummary' => ['value' => $this->randomMachineName()],
     ]);
     $form = \Drupal::service('entity.form_builder')->getForm($entity);
-    $this->assertTrue(!empty($form['test_textwithsummary']['widget'][0]['summary']), 'Summary field is shown');
-    $this->assertTrue(!empty($form['test_textwithsummary']['widget'][0]['summary']['#required']), 'Summary field is required');
+    $this->assertNotEmpty($form['test_textwithsummary']['widget'][0]['summary'], 'Summary field is shown');
+    $this->assertNotEmpty($form['test_textwithsummary']['widget'][0]['summary']['#required'], 'Summary field is required');
 
     // Test validation.
     /** @var \Symfony\Component\Validator\ConstraintViolation[] $violations */
diff --git a/core/modules/tour/tests/src/Functional/TourTestBase.php b/core/modules/tour/tests/src/Functional/TourTestBase.php
index 23f2190f42376d3a568698e338728f9aff48c45d..21b6f3fe169b2a82be359fcad30cde33f6b8497b 100644
--- a/core/modules/tour/tests/src/Functional/TourTestBase.php
+++ b/core/modules/tour/tests/src/Functional/TourTestBase.php
@@ -59,7 +59,7 @@ public function assertTourTips($tips = []) {
         }
         elseif (!empty($tip['data-class'])) {
           $elements = $this->getSession()->getPage()->findAll('css', '.' . $tip['data-class']);
-          $this->assertFalse(empty($elements), new FormattableMarkup('Found corresponding page element for tour tip with class .%data-class', ['%data-class' => $tip['data-class']]));
+          $this->assertNotEmpty($elements, sprintf("Page element for tour tip with class .%s should be present", $tip['data-class']));
         }
         else {
           // It's a modal.
diff --git a/core/modules/update/tests/src/Functional/UpdateContribTest.php b/core/modules/update/tests/src/Functional/UpdateContribTest.php
index 4a55f9d44027909f8e49311405eb18ab6a384f07..f00934dd9fd185a1820c6ae8fcc094f54be37368 100644
--- a/core/modules/update/tests/src/Functional/UpdateContribTest.php
+++ b/core/modules/update/tests/src/Functional/UpdateContribTest.php
@@ -442,7 +442,7 @@ public function testUpdateHiddenBaseTheme() {
     $project_info = new ProjectInfo();
     $project_info->processInfoList($projects, $theme_data, 'theme', TRUE);
 
-    $this->assertTrue(!empty($projects['update_test_basetheme']), 'Valid base theme (update_test_basetheme) was found.');
+    $this->assertNotEmpty($projects['update_test_basetheme'], 'Valid base theme (update_test_basetheme) was found.');
   }
 
   /**
diff --git a/core/modules/user/tests/src/Functional/RestRegisterUserTest.php b/core/modules/user/tests/src/Functional/RestRegisterUserTest.php
index 25d92624972b3c3b144e5fa40d8c083d57ac4705..0dafd8a27ea24e230246750133c0eb0fff30b624 100644
--- a/core/modules/user/tests/src/Functional/RestRegisterUserTest.php
+++ b/core/modules/user/tests/src/Functional/RestRegisterUserTest.php
@@ -81,7 +81,7 @@ public function testRegisterUser() {
     $config->save();
     $user = $this->registerUser('Palmer.Eldritch');
     $this->assertFalse($user->isBlocked());
-    $this->assertFalse(empty($user->getPassword()));
+    $this->assertNotEmpty($user->getPassword());
     $email_count = count($this->drupalGetMails());
 
     $this->assertEquals(0, $email_count);
@@ -103,7 +103,7 @@ public function testRegisterUser() {
     $config->save();
     $name = 'Jason.Taverner';
     $user = $this->registerUser($name, FALSE);
-    $this->assertTrue(empty($user->getPassword()));
+    $this->assertEmpty($user->getPassword());
     $this->assertTrue($user->isBlocked());
     $this->resetAll();
 
@@ -116,7 +116,7 @@ public function testRegisterUser() {
     $name = 'Argaven';
     $user = $this->registerUser($name);
     $this->resetAll();
-    $this->assertFalse(empty($user->getPassword()));
+    $this->assertNotEmpty($user->getPassword());
     $this->assertTrue($user->isBlocked());
     $this->assertMailString('body', 'Your application for an account is', 2);
     $this->assertMailString('body', 'Argaven has applied for an account', 2);
@@ -128,7 +128,7 @@ public function testRegisterUser() {
     $name = 'Bob.Arctor';
     $user = $this->registerUser($name, FALSE);
     $this->resetAll();
-    $this->assertTrue(empty($user->getPassword()));
+    $this->assertEmpty($user->getPassword());
     $this->assertTrue($user->isBlocked());
 
     $this->assertMailString('body', 'Your application for an account is', 2);
@@ -210,7 +210,7 @@ protected function registerUser($name, $include_password = TRUE, $include_email
     $response = $this->registerRequest($name, $include_password, $include_email);
     $this->assertResourceResponse(200, FALSE, $response);
     $user = user_load_by_name($name);
-    $this->assertFalse(empty($user), 'User was create as expected');
+    $this->assertNotEmpty($user, 'User was create as expected');
     return $user;
   }
 
diff --git a/core/modules/user/tests/src/Functional/UserCancelTest.php b/core/modules/user/tests/src/Functional/UserCancelTest.php
index 897113f406e4de407de9e0afdc3232fbae2d9251..6ce17ab974303bfc76165471d590b54a15dd0943 100644
--- a/core/modules/user/tests/src/Functional/UserCancelTest.php
+++ b/core/modules/user/tests/src/Functional/UserCancelTest.php
@@ -662,7 +662,7 @@ public function testUserDeleteWithContentAndNodeAccess() {
     $node = $this->drupalCreateNode(['type' => 'page', 'uid' => $account->id()]);
     $account->delete();
     $load2 = \Drupal::entityTypeManager()->getStorage('node')->load($node->id());
-    $this->assertTrue(empty($load2));
+    $this->assertEmpty($load2);
   }
 
 }
diff --git a/core/modules/views/src/Tests/AssertViewsCacheTagsTrait.php b/core/modules/views/src/Tests/AssertViewsCacheTagsTrait.php
index d443e3ba277065f9f328a19829569f0d46866970..e40fbb959c59351f0c3baad2569daee46e7588bb 100644
--- a/core/modules/views/src/Tests/AssertViewsCacheTagsTrait.php
+++ b/core/modules/views/src/Tests/AssertViewsCacheTagsTrait.php
@@ -138,7 +138,7 @@ protected function assertViewsCacheTagsFromStaticRenderArray(ViewExecutable $vie
 
     $render_cache_item = $render_cache->get($original);
     if ($views_caching_is_enabled) {
-      $this->assertTrue(!empty($render_cache_item), 'Render cache item found.');
+      $this->assertNotEmpty($render_cache_item, 'Render cache item found.');
       if ($render_cache_item) {
         $this->assertEqualsCanonicalizing($expected_render_array_cache_tags, $render_cache_item['#cache']['tags']);
       }
diff --git a/core/modules/views/tests/src/Functional/Handler/HandlerTest.php b/core/modules/views/tests/src/Functional/Handler/HandlerTest.php
index 2ac51567d82e8d5b06bf55b0e86a22d9697ea1b0..dde6c344f9bac5c0a6856c09730ebcc3f3b93f50 100644
--- a/core/modules/views/tests/src/Functional/Handler/HandlerTest.php
+++ b/core/modules/views/tests/src/Functional/Handler/HandlerTest.php
@@ -304,7 +304,7 @@ public function testSetRelationship() {
 
     $field->options['relationship'] = 'valid_relationship';
     $field->setRelationship();
-    $this->assertFalse(!empty($field->relationship), 'Make sure that the relationship alias was not set without building a views query before.');
+    $this->assertEmpty($field->relationship, 'Make sure that the relationship alias was not set without building a views query before.');
 
     // Remove the invalid relationship.
     unset($view->relationship['broken_relationship']);
diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php
index 8eea7fb9faa658b98eaac1fba920db65c4ac4991..21c3ad29be7a6b7b86fe20429db90ed098911c75 100644
--- a/core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/DisplayFeedTest.php
@@ -176,7 +176,7 @@ public function testDisabledFeed() {
     // Ensure there is no link rel present on the page.
     $this->drupalGet('/test-attached-disabled');
     $result = $this->xpath('//link[@rel="alternate"]');
-    $this->assertTrue(empty($result), 'Page display does not contain a feed header.');
+    $this->assertEmpty($result, 'Page display does not contain a feed header.');
 
     // Ensure the feed attachment returns 'Not found'.
     $this->drupalGet('/test-attached-disabled.xml');
diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php
index 087d21a5b695ff0d7b1cf6520c5ad34bc578cd2e..5769c697d1fdcaddfe3cc9e349b84d3bc0d052d8 100644
--- a/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/DisplayTest.php
@@ -179,14 +179,14 @@ public function testReadMoreNoDisplay() {
     $view = Views::getView('test_display_more');
     // Confirm that the view validates when there is a page display.
     $errors = $view->validate();
-    $this->assertTrue(empty($errors), 'More link validation has no errors.');
+    $this->assertEmpty($errors, 'More link validation has no errors.');
 
     // Confirm that the view does not validate when the page display is disabled.
     $view->setDisplay('page_1');
     $view->display_handler->setOption('enabled', FALSE);
     $view->setDisplay('default');
     $errors = $view->validate();
-    $this->assertTrue(!empty($errors), 'More link validation has some errors.');
+    $this->assertNotEmpty($errors, 'More link validation has some errors.');
     $this->assertEquals('Display "Default" uses a "more" link but there are no displays it can link to. You need to specify a custom URL.', $errors['default'][0], 'More link validation has the right error.');
 
     // Confirm that the view does not validate when the page display does not exist.
@@ -194,7 +194,7 @@ public function testReadMoreNoDisplay() {
     $view->setDisplay('default');
     $view->display_handler->setOption('use_more', 1);
     $errors = $view->validate();
-    $this->assertTrue(!empty($errors), 'More link validation has some errors.');
+    $this->assertNotEmpty($errors, 'More link validation has some errors.');
     $this->assertEquals('Display "Default" uses a "more" link but there are no displays it can link to. You need to specify a custom URL.', $errors['default'][0], 'More link validation has the right error.');
   }
 
@@ -352,7 +352,7 @@ public function testMissingRelationship() {
     $view->removeHandler('default', 'relationship', 'uid_1');
     $errors = $view->validate();
     // Check that no error message is shown.
-    $this->assertTrue(empty($errors['default']), 'No errors found when removing unused relationship.');
+    $this->assertArrayNotHasKey('default', $errors, 'No errors found when removing unused relationship.');
 
     // Unset cached relationships (see DisplayPluginBase::getHandlers())
     unset($view->display_handler->handlers['relationship']);
diff --git a/core/modules/views/tests/src/Functional/Plugin/FilterTest.php b/core/modules/views/tests/src/Functional/Plugin/FilterTest.php
index c1a933d83d4dd201b423b64e08492be522e12b56..8283e14f5af7e4a66203f38dec52bb55c1ff2ae1 100644
--- a/core/modules/views/tests/src/Functional/Plugin/FilterTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/FilterTest.php
@@ -81,7 +81,7 @@ public function testFilterQuery() {
     $this->executeView($view);
 
     // Make sure the query have where data.
-    $this->assertTrue(!empty($view->query->where));
+    $this->assertNotEmpty($view->query->where);
 
     // Check the data added.
     $where = $view->query->where;
diff --git a/core/modules/views/tests/src/Functional/Wizard/BasicTest.php b/core/modules/views/tests/src/Functional/Wizard/BasicTest.php
index 75812cecf54d7afad04faf5418624a1b26e68591..6486e6c4e07d1c6ff5ad451a5fdf20aff7b23234 100644
--- a/core/modules/views/tests/src/Functional/Wizard/BasicTest.php
+++ b/core/modules/views/tests/src/Functional/Wizard/BasicTest.php
@@ -3,7 +3,6 @@
 namespace Drupal\Tests\views\Functional\Wizard;
 
 use Drupal\Component\Serialization\Json;
-use Drupal\Component\Render\FormattableMarkup;
 use Drupal\Core\Url;
 use Drupal\views\Views;
 
@@ -221,7 +220,7 @@ public function testWizardDefaultValues() {
 
     foreach ($displays as $display) {
       foreach (['query', 'exposed_form', 'pager', 'style', 'row'] as $type) {
-        $this->assertFalse(empty($display['display_options'][$type]['options']), new FormattableMarkup('Default options found for @plugin.', ['@plugin' => $type]));
+        $this->assertNotEmpty($display['display_options'][$type]['options'], "There should be default options available for '$type'.");
       }
     }
   }
diff --git a/core/modules/views/tests/src/Functional/Wizard/PagerTest.php b/core/modules/views/tests/src/Functional/Wizard/PagerTest.php
index 90945038bcaf5fccd7188f899c7e92471c42cf23..fa8355a7d060ec91577d0d8c0c17efc259aae54c 100644
--- a/core/modules/views/tests/src/Functional/Wizard/PagerTest.php
+++ b/core/modules/views/tests/src/Functional/Wizard/PagerTest.php
@@ -33,14 +33,14 @@ public function testPager() {
     // This technique for finding the existence of a pager
     // matches that used in Drupal\views_ui\Tests\PreviewTest.php.
     $elements = $this->xpath('//ul[contains(@class, :class)]/li', [':class' => 'pager__items']);
-    $this->assertTrue(!empty($elements), 'Full pager found.');
+    $this->assertNotEmpty($elements, 'Full pager found.');
 
     // Make a View that does not have a pager.
     $path_with_no_pager = 'test-view-without-pager';
     $this->createViewAtPath($path_with_no_pager, FALSE);
     $this->drupalGet($path_with_no_pager);
     $elements = $this->xpath('//ul[contains(@class, :class)]/li', [':class' => 'pager__items']);
-    $this->assertTrue(empty($elements), 'Full pager not found.');
+    $this->assertEmpty($elements, 'Full pager not found.');
   }
 
   /**
diff --git a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php
index 9d1d3befe6d8f41e8602068901b6cb43f588d408..38b9687cdf503f33c7db1a9a6949c68811b186cd 100644
--- a/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php
+++ b/core/modules/views/tests/src/FunctionalJavascript/Plugin/views/Handler/FieldTest.php
@@ -85,7 +85,7 @@ public function testFormatterChanging() {
     $web_assert->assertWaitOnAjaxRequest();
     $page->fillField('options[settings][trim_length]', '700');
     $apply_button = $page->find('css', '.views-ui-dialog button.button--primary');
-    $this->assertTrue(!empty($apply_button));
+    $this->assertNotEmpty($apply_button);
     $apply_button->press();
     $web_assert->assertWaitOnAjaxRequest();
 
diff --git a/core/modules/views/tests/src/Kernel/FieldApiDataTest.php b/core/modules/views/tests/src/Kernel/FieldApiDataTest.php
index 1df711aaeb29bd9d2cc6802516b961d9b2fa693c..c3c178707d4b4f2e3e4fe0af4471aedb0ebbfc2b 100644
--- a/core/modules/views/tests/src/Kernel/FieldApiDataTest.php
+++ b/core/modules/views/tests/src/Kernel/FieldApiDataTest.php
@@ -139,7 +139,7 @@ public function testViewsData() {
     // Test click sortable for string field.
     $this->assertTrue($data[$current_table][$field_storage_string->getName()]['field']['click sortable']);
     // Click sort should only be on the primary field.
-    $this->assertTrue(empty($data[$revision_table][$field_storage_string->getName()]['field']['click sortable']));
+    $this->assertArrayNotHasKey($field_storage_string->getName(), $data[$revision_table]);
     // Test click sortable for long text field.
     $data_long = $this->getViewsData('field_string_long');
     $current_table_long = $table_mapping->getDedicatedDataTableName($field_storage_string_long);
diff --git a/core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php b/core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php
index 6f488ff6fed8cee30fbd9c34d4aa31ad92fbae63..f81def4de0d44a1375a577f77501f71dc2108f50 100644
--- a/core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/AreaEntityTest.php
@@ -71,7 +71,7 @@ public function testEntityAreaData() {
 
     // Test that all expected entity types have data.
     foreach (array_keys($expected_entities) as $entity) {
-      $this->assertTrue(!empty($data['entity_' . $entity]), new FormattableMarkup('Views entity area data found for @entity', ['@entity' => $entity]));
+      $this->assertNotEmpty($data['entity_' . $entity], "Views entity '$entity' should have a data area.");
       // Test that entity_type is set correctly in the area data.
       $this->assertEquals($data['entity_' . $entity]['area']['entity_type'], $entity, new FormattableMarkup('Correct entity_type set for @entity', ['@entity' => $entity]));
     }
@@ -82,7 +82,7 @@ public function testEntityAreaData() {
 
     // Test that no configuration entity types have data.
     foreach (array_keys($expected_entities) as $entity) {
-      $this->assertTrue(empty($data['entity_' . $entity]), new FormattableMarkup('Views config entity area data not found for @entity', ['@entity' => $entity]));
+      $this->assertArrayNotHasKey('entity_' . $entity, $data, "Views config entity '$entity' should not have a data area.");
     }
   }
 
diff --git a/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php b/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php
index b3630ce9de50df4ab900d8781171d3ca11763398..7bab5e5c506996760ac24e9cbff318a2449c2897 100644
--- a/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php
+++ b/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php
@@ -296,7 +296,7 @@ public function testHeaderStorage() {
     // Note: views_test_data_views_pre_render() adds some cache tags.
     $this->assertEquals(['config:views.view.test_cache_header_storage', 'views_test_data:1'], $output['#cache']['tags']);
     $this->assertEquals(['non-existing-placeholder-just-for-testing-purposes' => ['#lazy_builder' => ['Drupal\views_test_data\Controller\ViewsTestDataController::placeholderLazyBuilder', ['bar']]]], $output['#attached']['placeholders']);
-    $this->assertFalse(!empty($view->build_info['pre_render_called']), 'Make sure hook_views_pre_render is not called for the cached view.');
+    $this->assertArrayNotHasKey('pre_render_called', $view->build_info, 'Make sure hook_views_pre_render is not called for the cached view.');
   }
 
   /**
diff --git a/core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php b/core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php
index ba1a7a4da22bf1a15c2270e0320378f9b32f872d..841c204418728a01c80bf771b453e91529fc4fac 100644
--- a/core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php
+++ b/core/modules/views/tests/src/Kernel/Plugin/DisplayPageTest.php
@@ -196,7 +196,7 @@ public function testReadMore() {
     $output = $renderer->renderRoot($output);
     $this->setRawContent($output);
     $result = $this->xpath('//div[@class=:class]/a', [':class' => 'more-link']);
-    $this->assertTrue(empty($result), 'The more link is not shown.');
+    $this->assertEmpty($result, 'The more link is not shown.');
 
     $view = Views::getView('test_display_more');
     $view->setDisplay();
@@ -214,7 +214,7 @@ public function testReadMore() {
     $output = $renderer->renderRoot($output);
     $this->setRawContent($output);
     $result = $this->xpath('//div[@class=:class]/a', [':class' => 'more-link']);
-    $this->assertTrue(empty($result), 'The more link is not shown when view has more records.');
+    $this->assertEmpty($result, 'The more link is not shown when view has more records.');
 
     // Test the default value of use_more_always.
     $view = View::create()->getExecutable();
diff --git a/core/modules/views/tests/src/Kernel/PluginInstanceTest.php b/core/modules/views/tests/src/Kernel/PluginInstanceTest.php
index 315fae720372ba56fa4c1cb3e02ec7f93948224b..d5d1dd6004d6459c128f0e0cd6e967044150db4d 100644
--- a/core/modules/views/tests/src/Kernel/PluginInstanceTest.php
+++ b/core/modules/views/tests/src/Kernel/PluginInstanceTest.php
@@ -75,7 +75,7 @@ public function testPluginData() {
 
     // Tests that the plugin list has not missed any types.
     $diff = array_diff(array_keys($this->definitions), $this->pluginTypes);
-    $this->assertTrue(empty($diff), 'All plugins were found and matched.');
+    $this->assertEmpty($diff, 'All plugins were found and matched.');
   }
 
   /**
diff --git a/core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php b/core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php
index de5e12ef28d3e85a55faab29acad1e5451502dbe..651310dd9e4431e2a4b3cff783128e620dda498f 100644
--- a/core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php
+++ b/core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php
@@ -159,7 +159,7 @@ public function testGetDerivativeDefinitionsWithLocalTask() {
     $this->assertEquals(12, $definitions['view.example_view.page_1']['weight']);
     $this->assertEquals('Example title', $definitions['view.example_view.page_1']['title']);
     $this->assertEquals($this->baseDefinition['class'], $definitions['view.example_view.page_1']['class']);
-    $this->assertTrue(empty($definitions['view.example_view.page_1']['base_route']));
+    $this->assertArrayNotHasKey('base_route', $definitions['view.example_view.page_1']);
   }
 
   /**
diff --git a/core/modules/views/tests/src/Unit/PluginTypeListTest.php b/core/modules/views/tests/src/Unit/PluginTypeListTest.php
index 29da6b3aff4d39d0bc049c0a09e6eca7d814c416..ee84e531271738d1e3234f7fcf7b93e6752fb27a 100644
--- a/core/modules/views/tests/src/Unit/PluginTypeListTest.php
+++ b/core/modules/views/tests/src/Unit/PluginTypeListTest.php
@@ -39,7 +39,7 @@ public function testPluginList() {
     ];
 
     $diff = array_diff($plugin_list, ViewExecutable::getPluginTypes());
-    $this->assertTrue(empty($diff), 'The plugin list is correct');
+    $this->assertEmpty($diff);
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
index 6be6c457802e4072db2b6e79a23aed9f1ee6dc5e..722a2a332c668b2ad6bd937408af9d94d0f31220 100644
--- a/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
+++ b/core/modules/views_ui/tests/src/Functional/ViewEditTest.php
@@ -67,7 +67,7 @@ public function testOtherOptions() {
     $this->submitForm([], 'Save');
     $view = \Drupal::entityTypeManager()->getStorage('view')->load('test_view');
     $displays = $view->get('display');
-    $this->assertTrue(!empty($displays['test_1']), 'Display data found for new display ID key.');
+    $this->assertNotEmpty($displays['test_1'], 'Display data found for new display ID key.');
     $this->assertSame('test_1', $displays['test_1']['id'], 'New display ID matches the display ID key.');
     $this->assertArrayNotHasKey('attachment_1', $displays);
 
diff --git a/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php b/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php
index 0c41a2c6843f66cd139fc9a0b4bba14aa4f817b1..b2523408083aca9702e6a9213ba83aa55b87fcd1 100644
--- a/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php
+++ b/core/modules/views_ui/tests/src/FunctionalJavascript/PreviewTest.php
@@ -134,7 +134,7 @@ public function testPreviewWithPagersUI() {
 
     // Test that the pager is present and rendered.
     $elements = $this->xpath('//ul[contains(@class, :class)]/li', [':class' => 'pager__items']);
-    $this->assertTrue(!empty($elements), 'Full pager found.');
+    $this->assertNotEmpty($elements, 'Full pager found.');
 
     // Verify elements and links to pages.
     // We expect to find 5 elements: current page == 1, links to pages 2 and
@@ -160,7 +160,7 @@ public function testPreviewWithPagersUI() {
 
     // Test that the pager is present and rendered.
     $elements = $this->xpath('//ul[contains(@class, :class)]/li', [':class' => 'pager__items']);
-    $this->assertTrue(!empty($elements), 'Full pager found.');
+    $this->assertNotEmpty($elements, 'Full pager found.');
 
     // Verify elements and links to pages.
     // We expect to find 7 elements: links to '<< first' and '< previous'
@@ -192,7 +192,7 @@ public function testPreviewWithPagersUI() {
 
     // Test that the pager is present and rendered.
     $elements = $this->xpath('//ul[contains(@class, :class)]/li', [':class' => 'pager__items']);
-    $this->assertTrue(!empty($elements), 'Mini pager found.');
+    $this->assertNotEmpty($elements, 'Mini pager found.');
 
     // Verify elements and links to pages.
     // We expect to find current pages element with no link, next page element
@@ -208,7 +208,7 @@ public function testPreviewWithPagersUI() {
 
     // Test that the pager is present and rendered.
     $elements = $this->xpath('//ul[contains(@class, :class)]/li', [':class' => 'pager__items']);
-    $this->assertTrue(!empty($elements), 'Mini pager found.');
+    $this->assertNotEmpty($elements, 'Mini pager found.');
 
     // Verify elements and links to pages.
     // We expect to find 3 elements: previous page with a link, current
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php
index 0036e88a8f0dbe3ad09de8dd5ca599d30e8dd49f..de6cd41365a46c4535251b84dfd6acec6d3cc4e2 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/DialogTest.php
@@ -173,7 +173,7 @@ public function testDialog() {
     // Check we get a chunk of the code, we can't test the whole form as form
     // build id and token with be different.
     $contact_form = $this->xpath("//form[@id='contact-form-add-form']");
-    $this->assertTrue(!empty($contact_form), 'Non-JS entity form page present.');
+    $this->assertNotEmpty($contact_form, 'Non-JS entity form page present.');
 
     // Reset: Return to the dialog links page.
     $this->drupalGet('ajax-test/dialog');
diff --git a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
index 76cf0ecbdc6f10ed56d6af325b6db9753d9ae8f1..0d3cabac04208713ddc5a3ad25025f5e0d308fd2 100644
--- a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
@@ -375,7 +375,7 @@ public function testGetMultiple() {
     $cids = ['key:key' => $long_cid];
     $return = $backend->getMultiple($cids);
     $this->assertEquals(300, $return[$long_cid]->data);
-    $this->assertTrue(empty($cids));
+    $this->assertEmpty($cids);
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php
index 9994e9db6fde12497c5232b5c8adaec69464b7b1..6b0ba0ae16150c9063ec9cd7153ccbc4f6f894fd 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php
@@ -3,7 +3,6 @@
 namespace Drupal\KernelTests\Core\Config;
 
 use Drupal\Component\Utility\Crypt;
-use Drupal\Component\Render\FormattableMarkup;
 use Drupal\Core\Config\Config;
 use Drupal\Core\Config\ConfigNameException;
 use Drupal\Core\Config\ConfigValueException;
@@ -222,9 +221,7 @@ public function testNameValidation() {
         unset($test_characters[$i]);
       }
     }
-    $this->assertTrue(empty($test_characters), new FormattableMarkup('Expected ConfigNameException was thrown for all invalid name characters: @characters', [
-      '@characters' => implode(' ', $characters),
-    ]));
+    $this->assertEmpty($test_characters, sprintf('Expected ConfigNameException was thrown for all invalid name characters: %s', implode(' ', $characters)));
 
     // Verify that a valid config object name can be saved.
     $name = 'namespace.object';
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php
index 22e610afec236f5dadcb06f41d21122b9a52a131..e53b30472ec1ec40f560fd764725ffb7f8892f52 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDependencyTest.php
@@ -67,7 +67,7 @@ public function testDependencyManagement() {
     // the dependencies array.
     $raw_config = $this->config('config_test.dynamic.entity1');
     $root_module_dependencies = $raw_config->get('dependencies.module');
-    $this->assertTrue(empty($root_module_dependencies), 'Node module is not written to the root dependencies array as it is enforced.');
+    $this->assertEmpty($root_module_dependencies, 'Node module is not written to the root dependencies array as it is enforced.');
 
     // Create additional entities to test dependencies on config entities.
     $entity2 = $storage->create(['id' => 'entity2', 'dependencies' => ['enforced' => ['config' => [$entity1->getConfigDependencyName()]]]]);
@@ -516,8 +516,8 @@ public function testConfigEntityDelete() {
     // \Drupal\Core\Config\ConfigManager::getConfigEntitiesToChangeOnDependencyRemoval().
     $config_entities = $config_manager->getConfigEntitiesToChangeOnDependencyRemoval('config', [$entity1->getConfigDependencyName()]);
     $this->assertEquals($entity2->uuid(), reset($config_entities['delete'])->uuid(), 'Entity 2 will be deleted.');
-    $this->assertTrue(empty($config_entities['update']), 'No dependent configuration entities will be updated.');
-    $this->assertTrue(empty($config_entities['unchanged']), 'No dependent configuration entities will be unchanged.');
+    $this->assertEmpty($config_entities['update'], 'No dependent configuration entities will be updated.');
+    $this->assertEmpty($config_entities['unchanged'], 'No dependent configuration entities will be unchanged.');
 
     // Test that doing a delete of entity1 deletes entity2 since it is dependent
     // on entity1.
@@ -568,7 +568,7 @@ public function testConfigEntityDelete() {
     // Do a dry run using
     // \Drupal\Core\Config\ConfigManager::getConfigEntitiesToChangeOnDependencyRemoval().
     $config_entities = $config_manager->getConfigEntitiesToChangeOnDependencyRemoval('config', [$entity1->getConfigDependencyName()]);
-    $this->assertTrue(empty($config_entities['delete']), 'No dependent configuration entities will be deleted.');
+    $this->assertEmpty($config_entities['delete'], 'No dependent configuration entities will be deleted.');
     $this->assertEquals($entity2->uuid(), reset($config_entities['update'])->uuid(), 'Entity 2 will be updated.');
     $this->assertEquals($entity3->uuid(), reset($config_entities['unchanged'])->uuid(), 'Entity 3 is not changed.');
 
@@ -634,8 +634,8 @@ public function testContentEntityDelete() {
     $config_entities = $config_manager->getConfigEntitiesToChangeOnDependencyRemoval('content', [$content_entity->getConfigDependencyName()]);
     $this->assertEquals($entity1->uuid(), $config_entities['delete'][1]->uuid(), 'Entity 1 will be deleted.');
     $this->assertEquals($entity2->uuid(), $config_entities['delete'][0]->uuid(), 'Entity 2 will be deleted.');
-    $this->assertTrue(empty($config_entities['update']), 'No dependencies of the content entity will be updated.');
-    $this->assertTrue(empty($config_entities['unchanged']), 'No dependencies of the content entity will be unchanged.');
+    $this->assertEmpty($config_entities['update'], 'No dependencies of the content entity will be updated.');
+    $this->assertEmpty($config_entities['unchanged'], 'No dependencies of the content entity will be unchanged.');
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
index a07a3fd7cf63105bc2b009e2ea255440157af41a..602ca3624e3f1ff7a48914614e604cbaaaf5fad7 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigSchemaTest.php
@@ -319,7 +319,7 @@ public function testSchemaData() {
     $this->assertInstanceOf(StringInterface::class, $property);
     $this->assertEquals('/user/login', $property->getValue(), 'Got the right value for page.front data.');
     $definition = $property->getDataDefinition();
-    $this->assertTrue(empty($definition['translatable']), 'Got the right translatability setting for page.front data.');
+    $this->assertEmpty($definition['translatable'], 'Got the right translatability setting for page.front data.');
 
     // Check nested array of properties.
     $list = $meta->get('page')->getElements();
diff --git a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php
index 678e0eee91adb9ce642ceff011ec4f504a7245e0..4d07af2a25a52cccc8915ef15a33ad72e3f21cfa 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/SchemaTest.php
@@ -105,8 +105,8 @@ public function testSchema() {
           $string_ascii_check = ($column->Collation == 'ascii_general_ci');
         }
       }
-      $this->assertTrue(!empty($string_check), 'string field has the right collation.');
-      $this->assertTrue(!empty($string_ascii_check), 'ASCII string field has the right collation.');
+      $this->assertNotEmpty($string_check, 'string field has the right collation.');
+      $this->assertNotEmpty($string_ascii_check, 'ASCII string field has the right collation.');
     }
 
     // An insert without a value for the column 'test_table' should fail.
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php
index ccc1f537affe801aa95b294bf63934f4d3bac35b..e1f3497cba5debf1dd861ee0e848c618e97c4de2 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityApiTest.php
@@ -94,7 +94,7 @@ protected function assertCRUD(string $entity_type, UserInterface $user1): void {
     $storage->delete($entities);
 
     $all = $storage->loadMultiple();
-    $this->assertTrue(empty($all), new FormattableMarkup('%entity_type: Deleted all entities.', ['%entity_type' => $entity_type]));
+    $this->assertEmpty($all, "All entities of type '$entity_type' should have been deleted.");
 
     // Verify that all data got deleted.
     $definition = \Drupal::entityTypeManager()->getDefinition($entity_type);
@@ -124,7 +124,7 @@ protected function assertCRUD(string $entity_type, UserInterface $user1): void {
 
     // Verify that entities got deleted.
     $all = $storage->loadMultiple();
-    $this->assertTrue(empty($all), new FormattableMarkup('%entity_type: Deleted all entities.', ['%entity_type' => $entity_type]));
+    $this->assertEmpty($all, "All entities of type '$entity_type' should have been deleted.");
 
     // Verify that all data got deleted from the tables.
     $definition = \Drupal::entityTypeManager()->getDefinition($entity_type);
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
index f0f5211a0bda9b1613ec938fac763973bd49664c..e55211d347d01a02e6eeb800987db971a80b607d 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
@@ -195,14 +195,14 @@ protected function doTestReadWrite($entity_type) {
     unset($entity->name->value);
     $this->assertFalse(isset($entity->name->value), new FormattableMarkup('%entity_type: Name is not set.', ['%entity_type' => $entity_type]));
     $this->assertFalse(isset($entity->name[0]->value), new FormattableMarkup('%entity_type: Name is not set.', ['%entity_type' => $entity_type]));
-    $this->assertTrue(empty($entity->name->value), new FormattableMarkup('%entity_type: Name is empty.', ['%entity_type' => $entity_type]));
-    $this->assertTrue(empty($entity->name[0]->value), new FormattableMarkup('%entity_type: Name is empty.', ['%entity_type' => $entity_type]));
+    $this->assertEmpty($entity->name->value, new FormattableMarkup('%entity_type: Name is empty.', ['%entity_type' => $entity_type]));
+    $this->assertEmpty($entity->name[0]->value, new FormattableMarkup('%entity_type: Name is empty.', ['%entity_type' => $entity_type]));
 
     $entity->name->value = 'a value';
     $this->assertTrue(isset($entity->name->value), new FormattableMarkup('%entity_type: Name is set.', ['%entity_type' => $entity_type]));
     $this->assertTrue(isset($entity->name[0]->value), new FormattableMarkup('%entity_type: Name is set.', ['%entity_type' => $entity_type]));
-    $this->assertFalse(empty($entity->name->value), new FormattableMarkup('%entity_type: Name is not empty.', ['%entity_type' => $entity_type]));
-    $this->assertFalse(empty($entity->name[0]->value), new FormattableMarkup('%entity_type: Name is not empty.', ['%entity_type' => $entity_type]));
+    $this->assertNotEmpty($entity->name->value, new FormattableMarkup('%entity_type: Name is not empty.', ['%entity_type' => $entity_type]));
+    $this->assertNotEmpty($entity->name[0]->value, new FormattableMarkup('%entity_type: Name is not empty.', ['%entity_type' => $entity_type]));
     $this->assertTrue(isset($entity->name[0]), new FormattableMarkup('%entity_type: Name string item is set.', ['%entity_type' => $entity_type]));
     $this->assertFalse(isset($entity->name[1]), new FormattableMarkup('%entity_type: Second name string item is not set as it does not exist', ['%entity_type' => $entity_type]));
     $this->assertTrue(isset($entity->name), new FormattableMarkup('%entity_type: Name field is set.', ['%entity_type' => $entity_type]));
diff --git a/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php b/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php
index 36f1f9cc83977440c549a0bc2dda78d5b27175b6..7eb64d6f3808e2bf7d20bc85c788386b961383b3 100644
--- a/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Field/FieldItemTest.php
@@ -51,7 +51,7 @@ protected function setUp(): void {
 
     $this->entityTypeManager->clearCachedDefinitions();
     $definitions = \Drupal::service('entity_field.manager')->getFieldStorageDefinitions($entity_type_id);
-    $this->assertTrue(!empty($definitions[$this->fieldName]));
+    $this->assertNotEmpty($definitions[$this->fieldName]);
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php
index 970ca6909fceb6d78037ca0c93daecf9a8ce299a..a703fe9aa2900f66df91579033d0e2577bde1510 100644
--- a/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php
@@ -146,7 +146,7 @@ public function testOptionKey() {
    */
   public function testOptionRecurse() {
     $files = $this->fileSystem->scanDirectory($this->path . '/..', '/^javascript-/', ['recurse' => FALSE]);
-    $this->assertTrue(empty($files), "Without recursion couldn't find javascript files.");
+    $this->assertEmpty($files, "Without recursion couldn't find javascript files.");
 
     $files = $this->fileSystem->scanDirectory($this->path . '/..', '/^javascript-/', ['recurse' => TRUE]);
     $this->assertCount(2, $files, 'With recursion we found the expected javascript files.');
@@ -163,7 +163,7 @@ public function testOptionMinDepth() {
     $this->assertCount(2, $files, 'No minimum-depth gets files in current directory.');
 
     $files = $this->fileSystem->scanDirectory($this->path, '/^javascript-/', ['min_depth' => 1]);
-    $this->assertTrue(empty($files), 'Minimum-depth of 1 successfully excludes files from current directory.');
+    $this->assertEmpty($files, 'Minimum-depth of 1 successfully excludes files from current directory.');
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php b/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php
index 2e7ad83046f8b1ab4e2b747ee0fa03095bd80030..6b8fd87dff31ade4ad788d6901d6c9f74072746a 100644
--- a/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Form/FormCacheTest.php
@@ -94,7 +94,7 @@ public function testNoCacheToken() {
     $cached_form_state = new FormState();
     $cached_form = \Drupal::formBuilder()->getCache($this->formBuildId, $cached_form_state);
     $this->assertEquals($this->form['#property'], $cached_form['#property']);
-    $this->assertTrue(empty($cached_form['#cache_token']), 'Form has no cache token');
+    $this->assertArrayNotHasKey('#cache_token', $cached_form, 'Form has no cache token');
     $this->assertEquals($this->formState->get('example'), $cached_form_state->get('example'));
 
     // Restore user account.
diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php
index 5b7bd8f5146a5b258dd32d3c97b9253da63cf1c5..9f52371007d4e08195fe4fa3a394fdacbe03bdbd 100644
--- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php
+++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php
@@ -148,7 +148,7 @@ public function testExpiration() {
     $all = $stores[0]->getAll();
     $this->assertCount(2, $all);
     foreach (['troubles', 'still'] as $key) {
-      $this->assertTrue(!empty($all[$key]));
+      $this->assertArrayHasKey($key, $all);
     }
 
     // Test DatabaseStorageExpirable::setWithExpireIfNotExists() will overwrite
diff --git a/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php b/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php
index e394a2d2da198a90021a25bc19674c599b51102b..aa506632c66f02d8adb003478dc351fd6eec5f78 100644
--- a/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Plugin/ContextPluginTest.php
@@ -72,7 +72,7 @@ public function testContext() {
     // Try to pass the wrong class type as a context value.
     $plugin->setContextValue('user', $node);
     $violations = $plugin->validateContexts();
-    $this->assertTrue(!empty($violations), 'The provided context value does not pass validation.');
+    $this->assertNotEmpty($violations, 'The provided context value does not pass validation.');
 
     // Set an appropriate context value and check to make sure its methods work
     // as expected.
diff --git a/core/tests/Drupal/KernelTests/Core/Theme/BaseThemeRequiredTest.php b/core/tests/Drupal/KernelTests/Core/Theme/BaseThemeRequiredTest.php
index 13734db774c75e0eafae448c7b09049b2c566e69..3bfd15948c0aaf11b5e8961a4c4f967d17117626 100644
--- a/core/tests/Drupal/KernelTests/Core/Theme/BaseThemeRequiredTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Theme/BaseThemeRequiredTest.php
@@ -49,7 +49,7 @@ public function testWildWest() {
     $theme = $this->themeManager->getActiveTheme();
     /** @var \Drupal\Core\Theme\ActiveTheme $base_theme */
     $base_themes = $theme->getBaseThemeExtensions();
-    $this->assertTrue(empty($base_themes), 'No base theme is set when a theme has opted out of using Stable.');
+    $this->assertEmpty($base_themes, 'No base theme is set when a theme has opted out of using Stable.');
   }
 
 }
diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
index 378576dbcd5869e0fa954ff0a05c42dc8cc2bccf..942e9f537790202d70e805ea278d15a201d80872 100644
--- a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
+++ b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php
@@ -320,11 +320,11 @@ protected function tearDown(): void {
         ':table_name' => '%',
         ':pattern' => 'sqlite_%',
       ])->fetchAllKeyed(0, 0);
-      $this->assertTrue(empty($result), 'All test tables have been removed.');
+      $this->assertEmpty($result, 'All test tables have been removed.');
     }
     else {
       $tables = $connection->schema()->findTables($this->databasePrefix . '%');
-      $this->assertTrue(empty($tables), 'All test tables have been removed.');
+      $this->assertEmpty($tables, 'All test tables have been removed.');
     }
   }
 
diff --git a/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php b/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php
index c329a7ddeb3a08fb4ce49289dc95cb4ffb2f70ae..710a2770e68575eba4ef0c858d65e45b9ec0cb0b 100644
--- a/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php
+++ b/core/tests/Drupal/Tests/Component/Discovery/YamlDirectoryDiscoveryTest.php
@@ -87,7 +87,7 @@ public function testDiscovery() {
     $this->assertSame(['id' => 'item3', 'name' => 'test2 item 3', YamlDirectoryDiscovery::FILE_KEY => 'vfs://modules/test_2/subdir1/item_3.test.yml'], $data['test_2']['item3']);
     $this->assertCount(1, $data['test_2']);
 
-    $this->assertTrue(empty($data['test_3']), 'test_3 provides 0 items');
+    $this->assertArrayNotHasKey('test_3', $data, 'test_3 provides 0 items');
 
     $this->assertSame(['id' => 'item4', 'name' => 'test4 item 4', YamlDirectoryDiscovery::FILE_KEY => 'vfs://modules/test_4/subdir1/item_4.test.yml'], $data['test_4']['item4']);
     $this->assertSame(['id' => 'item5', 'name' => 'test4 item 5', YamlDirectoryDiscovery::FILE_KEY => 'vfs://modules/test_4/subdir1/item_5.test.yml'], $data['test_4']['item5']);
diff --git a/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php b/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php
index 3f41a393002a61291b106c2cceceedc7341a39d3..c3c2cbc0021af25e98aec6e17df7501d4f23d5ef 100644
--- a/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/Enhancer/EntityRouteEnhancerTest.php
@@ -85,7 +85,7 @@ public function testEnhancer() {
     $defaults = $route_enhancer->enhance($defaults, $request);
     $this->assertEquals('\Drupal\Core\Entity\Controller\EntityViewController::view', $defaults['_controller'], 'The entity view controller was not set.');
     $this->assertEquals('Mock entity', $defaults['_entity']);
-    $this->assertTrue(empty($defaults['view_mode']));
+    $this->assertArrayNotHasKey('view_mode', $defaults);
     $this->assertFalse(isset($defaults['_entity_view']));
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php
index ae0f753ef7ecd8d7b2a47d62e492ff248c90dfb2..96fd9fd76a2052be552926e78ea4eb15be45d6bd 100644
--- a/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php
@@ -45,7 +45,7 @@ protected function setUp(): void {
   public function testInfoParserNonExisting() {
     vfsStream::setup('modules');
     $info = $this->infoParser->parse(vfsStream::url('modules') . '/does_not_exist.info.txt');
-    $this->assertTrue(empty($info), 'Non existing info.yml returns empty array.');
+    $this->assertEmpty($info, 'Non existing info.yml returns empty array.');
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php b/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php
index d47f35141efcf1730ddcd3fc14039a031aedb197..3979f2cc07331cdb29caf76756f821908197d9c8 100644
--- a/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/MetadataBubblingUrlGeneratorTest.php
@@ -56,7 +56,7 @@ public function testUrlBubbleableMetadataBubbling($collect_bubbleable_metadata,
     $this->renderer->expects($this->exactly($invocations))
       ->method('render')
       ->willReturnCallback(function ($build) use ($self) {
-        $self->assertTrue(!empty($build['#cache']));
+        $this->assertArrayHasKey('#cache', $build);
       });
 
     $url = new Url('test_1', [], $options);
diff --git a/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php
index 69fa66bdd4d7414b0198d36eb4afcabbd262a2db..70b6a83dc3a0c46ff431675471c16905e8604bc9 100644
--- a/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php
+++ b/core/tests/Drupal/Tests/Core/Render/RendererRecursionTest.php
@@ -122,7 +122,7 @@ public function testRenderRecursionWithNestedRenderPlain() {
     $output = $renderer->renderRoot($page);
     $this->assertEquals('<p>This is a rendered placeholder!</p>' . $parent_markup, $output, 'Rendered output as expected, with the placeholder replaced.');
     $this->assertNotContains('test:complex_child', $page['#cache']['tags'], 'Cache tag bubbling not performed.');
-    $this->assertTrue(empty($page['#attached']), 'Asset bubbling not performed.');
+    $this->assertEmpty($page['#attached'], 'Asset bubbling not performed.');
   }
 
 }