diff --git a/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php
index 0378cf733cf0b93941247277675f12eb44769719..19f03e726fd1d274eb2cc56167c564913fff4a6a 100644
--- a/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php
+++ b/core/modules/aggregator/tests/src/Functional/AggregatorAdminTest.php
@@ -72,7 +72,7 @@ public function testOverviewPage() {
 
     $result = $this->xpath('//table/tbody/tr');
     // Check if the amount of feeds in the overview matches the amount created.
-    $this->assertEqual(1, count($result), 'Created feed is found in the overview');
+    $this->assertCount(1, $result, 'Created feed is found in the overview');
     // Check if the fields in the table match with what's expected.
     $link = $this->xpath('//table/tbody/tr//td[1]/a');
     $this->assertEquals($feed->label(), $link[0]->getText());
diff --git a/core/modules/aggregator/tests/src/Kernel/FeedValidationTest.php b/core/modules/aggregator/tests/src/Kernel/FeedValidationTest.php
index 1d0f6792dda180e4e7d309293ec3e7b2499b68c4..efb68abeab33e5c9d9f639e74af3502931e2a7be 100644
--- a/core/modules/aggregator/tests/src/Kernel/FeedValidationTest.php
+++ b/core/modules/aggregator/tests/src/Kernel/FeedValidationTest.php
@@ -39,7 +39,7 @@ public function testValidation() {
     ]);
 
     $violations = $feed->validate();
-    $this->assertEqual(count($violations), 0);
+    $this->assertCount(0, $violations);
 
     $feed->save();
 
@@ -53,7 +53,7 @@ public function testValidation() {
 
     $violations = $feed->validate();
 
-    $this->assertEqual(count($violations), 2);
+    $this->assertCount(2, $violations);
     $this->assertEqual($violations[0]->getPropertyPath(), 'title');
     $this->assertEqual($violations[0]->getMessage(), t('A feed named %value already exists. Enter a unique title.', [
       '%value' => $feed->label(),
diff --git a/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php b/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php
index 6963759c3f3af60ab763973977146ee852c29bac..0647b16cb2465f347c6902c9c959820da5646a19 100644
--- a/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php
+++ b/core/modules/ban/tests/src/Functional/IpAddressBlockingTest.php
@@ -93,7 +93,7 @@ public function testIPAddressValidation() {
     $query->fields('bip', ['iid']);
     $query->condition('bip.ip', $ip);
     $ip_count = $query->execute()->fetchAll();
-    $this->assertEqual(1, count($ip_count));
+    $this->assertCount(1, $ip_count);
     $ip = '';
     $banIp->banIp($ip);
     $banIp->banIp($ip);
@@ -101,7 +101,7 @@ public function testIPAddressValidation() {
     $query->fields('bip', ['iid']);
     $query->condition('bip.ip', $ip);
     $ip_count = $query->execute()->fetchAll();
-    $this->assertEqual(1, count($ip_count));
+    $this->assertCount(1, $ip_count);
   }
 
 }
diff --git a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
index 83f82db8145d55f19d839b89966e9370c234aeea..76c4c96ecd844ee63c24e4063cda5a2d854f1b61 100644
--- a/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
+++ b/core/modules/big_pipe/tests/src/Functional/BigPipeTest.php
@@ -371,7 +371,7 @@ protected function assertBigPipePlaceholders(array $expected_big_pipe_placeholde
       $expected_placeholder_replacement = '<script type="application/vnd.drupal-ajax" data-big-pipe-replacement-for-placeholder-with-id="' . $big_pipe_placeholder_id . '">';
       $result = $this->xpath('//script[@data-big-pipe-replacement-for-placeholder-with-id=:id]', [':id' => Html::decodeEntities($big_pipe_placeholder_id)]);
       if ($expected_ajax_response === NULL) {
-        $this->assertEqual(0, count($result));
+        $this->assertCount(0, $result);
         $this->assertNoRaw($expected_placeholder_replacement);
         continue;
       }
diff --git a/core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php b/core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php
index 733d265ddd1b6ffdacd752039346657240a3dc6f..dd41f836a47cd5cf28ebc2813b1505d2d02418db 100644
--- a/core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php
+++ b/core/modules/big_pipe/tests/src/Unit/Render/Placeholder/BigPipeStrategyTest.php
@@ -54,7 +54,7 @@ public function testProcessPlaceholders(array $placeholders, $method, $route_mat
       }
     }
     else {
-      $this->assertSame(0, count($processed_placeholders));
+      $this->assertCount(0, $processed_placeholders);
     }
   }
 
diff --git a/core/modules/block/tests/src/Functional/BlockTest.php b/core/modules/block/tests/src/Functional/BlockTest.php
index c69263454e10ab101bc5dbdcace22d1a33e788fa..fda29bec0e5653182f2bb7b69f20528e29d8163b 100644
--- a/core/modules/block/tests/src/Functional/BlockTest.php
+++ b/core/modules/block/tests/src/Functional/BlockTest.php
@@ -155,7 +155,7 @@ public function testAddBlockFromLibraryWithWeight() {
         'theme' => $default_theme,
       ]);
       $links = $this->xpath('//a[contains(@href, :href)]', [':href' => $add_url->toString()]);
-      $this->assertEqual(1, count($links), 'Found one matching link.');
+      $this->assertCount(1, $links, 'Found one matching link.');
       $this->assertEqual(t('Place block'), $links[0]->getText(), 'Found the expected link text.');
 
       list($path, $query_string) = explode('?', $links[0]->getAttribute('href'), 2);
diff --git a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php
index bac85959be059d0ec9940ea2376ef8d14031a689..c6af3eacf6627421eb828950527c6e2a0f328443 100644
--- a/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php
+++ b/core/modules/block/tests/src/Functional/Views/DisplayBlockTest.php
@@ -297,14 +297,14 @@ public function testBlockEmptyRendering() {
 
     $block = $this->drupalPlaceBlock('views_block:test_view_block-block_1', ['label' => 'test_view_block-block_1:1', 'views_label' => 'Custom title']);
     $this->drupalGet('');
-    $this->assertEqual(1, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]')));
+    $this->assertCount(1, $this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'));
 
     $display = &$view->getDisplay('block_1');
     $display['display_options']['block_hide_empty'] = TRUE;
     $view->save();
 
     $this->drupalGet($url);
-    $this->assertEqual(0, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]')));
+    $this->assertCount(0, $this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'));
     // Ensure that the view cacheability metadata is propagated even, for an
     // empty block.
     $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block', 'http_response', 'rendered']));
@@ -324,7 +324,7 @@ public function testBlockEmptyRendering() {
     $view->save();
 
     $this->drupalGet($url);
-    $this->assertEqual(1, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]')));
+    $this->assertCount(1, $this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'));
     $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block', 'http_response', 'rendered']));
     $this->assertCacheContexts(['url.query_args:_wrapper_format']);
 
@@ -342,7 +342,7 @@ public function testBlockEmptyRendering() {
     $view->save();
 
     $this->drupalGet($url);
-    $this->assertEqual(0, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]')));
+    $this->assertCount(0, $this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'));
     $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block', 'http_response', 'rendered']));
     $this->assertCacheContexts(['url.query_args:_wrapper_format']);
 
@@ -359,7 +359,7 @@ public function testBlockEmptyRendering() {
     $view->save();
 
     $this->drupalGet($url);
-    $this->assertEqual(1, count($this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]')));
+    $this->assertCount(1, $this->xpath('//div[contains(@class, "block-views-blocktest-view-block-block-1")]'));
     $this->assertCacheTags(array_merge($block->getCacheTags(), ['block_view', 'config:block_list', 'config:views.view.test_view_block', 'http_response', 'rendered']));
     $this->assertCacheContexts(['url.query_args:_wrapper_format']);
   }
diff --git a/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php b/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php
index fa9a78160f68478dd1c09cecbd7ed1849d34322a..c5a80529148125d7ae111686dcd4abd12b06c3ec 100644
--- a/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php
+++ b/core/modules/block/tests/src/FunctionalJavascript/BlockFilterTest.php
@@ -67,7 +67,7 @@ public function testBlockFilter() {
     $filter->setValue('Powered by');
     $session->wait(10000, 'jQuery("#drupal-live-announce").html().indexOf("block is available") > -1');
     $visible_rows = $this->filterVisibleElements($block_rows);
-    $this->assertEquals(1, count($visible_rows));
+    $this->assertCount(1, $visible_rows);
     $expected_message = '1 block is available in the modified list.';
     $assertSession->elementTextContains('css', '#drupal-live-announce', $expected_message);
 
@@ -75,7 +75,7 @@ public function testBlockFilter() {
     $filter->setValue('Pan-Galactic Gargle Blaster');
     $session->wait(10000, 'jQuery("#drupal-live-announce").html().indexOf("0 blocks are available") > -1');
     $visible_rows = $this->filterVisibleElements($block_rows);
-    $this->assertEquals(0, count($visible_rows));
+    $this->assertCount(0, $visible_rows);
     $expected_message = '0 blocks are available in the modified list.';
     $assertSession->elementTextContains('css', '#drupal-live-announce', $expected_message);
   }
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
index d12c3833a738aecd9acad75b27bb3e566af20824..ad11e5f4b7d94bcf788be919c923f7bd5b2b16bf 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentCreationTest.php
@@ -242,7 +242,7 @@ public function testBlockDelete() {
     $block = BlockContent::load(1);
 
     // Test getInstances method.
-    $this->assertEqual(1, count($block->getInstances()));
+    $this->assertCount(1, $block->getInstances());
 
     // Navigate to home page.
     $this->drupalGet('');
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php
index a865e7e83130375e7192b7537370901f4fe96ee1..e50ee168f46a41408e56ee950ef0fda1f353304c 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentListTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentListTest.php
@@ -43,7 +43,7 @@ public function testListing() {
 
     // Test the table header.
     $elements = $this->xpath('//div[@class="layout-content"]//table/thead/tr/th');
-    $this->assertEqual(count($elements), 2, 'Correct number of table header cells found.');
+    $this->assertCount(2, $elements, 'Correct number of table header cells found.');
 
     // Test the contents of each th cell.
     $expected_items = [t('Block description'), t('Operations')];
@@ -69,7 +69,7 @@ public function testListing() {
 
     // Check the number of table row cells.
     $elements = $this->xpath('//div[@class="layout-content"]//table/tbody/tr[@class="odd"]/td');
-    $this->assertEqual(count($elements), 2, 'Correct number of table row cells found.');
+    $this->assertCount(2, $elements, 'Correct number of table row cells found.');
     // Check the contents of each row cell. The first cell contains the label,
     // the second contains the machine name, and the third contains the
     // operations list.
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php
index a151cf485207d55d81ca3c667b33238c6d4d7043..381bd4470058ff4188643b428fac364e1b924306 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentListViewsTest.php
@@ -50,7 +50,7 @@ public function testListing() {
 
     // Test the table header.
     $elements = $this->xpath('//div[@class="layout-content"]//table/thead/tr/th');
-    $this->assertEqual(count($elements), 4, 'Correct number of table header cells found.');
+    $this->assertCount(4, $elements, 'Correct number of table header cells found.');
 
     // Test the contents of each th cell.
     $expected_items = ['Block description', 'Block type', 'Updated Sort ascending', 'Operations'];
@@ -81,7 +81,7 @@ public function testListing() {
 
     // Check the number of table row cells.
     $elements = $this->xpath('//div[@class="layout-content"]//table/tbody/tr/td');
-    $this->assertEqual(count($elements), 4, 'Correct number of table row cells found.');
+    $this->assertCount(4, $elements, 'Correct number of table row cells found.');
     // Check the contents of each row cell. The first cell contains the label,
     // the second contains the machine name, and the third contains the
     // operations list.
diff --git a/core/modules/block_content/tests/src/Functional/BlockContentValidationTest.php b/core/modules/block_content/tests/src/Functional/BlockContentValidationTest.php
index 293234ba523576d6bf87e94d684a726553ca1e8a..c89887c35bb13368f1827bb6064c38a7a9c83637 100644
--- a/core/modules/block_content/tests/src/Functional/BlockContentValidationTest.php
+++ b/core/modules/block_content/tests/src/Functional/BlockContentValidationTest.php
@@ -26,7 +26,7 @@ public function testValidation() {
     // Validate the block.
     $violations = $block->validate();
     // Make sure we have no violations.
-    $this->assertEqual(count($violations), 0);
+    $this->assertCount(0, $violations);
     // Save the block.
     $block->save();
 
@@ -35,7 +35,7 @@ public function testValidation() {
     // Validate this block.
     $violations = $block->validate();
     // Make sure we have 1 violation.
-    $this->assertEqual(count($violations), 1);
+    $this->assertCount(1, $violations);
     // Make sure the violation is on the info property
     $this->assertEqual($violations[0]->getPropertyPath(), 'info');
     // Make sure the message is correct.
diff --git a/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php b/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php
index 59c15d441a1d6c929fc15e4d673372bf6111a246..47c90e0ab9a88a103d4f6e5fcf0b877df436b9b9 100644
--- a/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php
+++ b/core/modules/book/tests/src/Functional/BookBreadcrumbTest.php
@@ -156,7 +156,7 @@ public function testBreadcrumbTitleUpdates() {
       $got_breadcrumb[] = $link->getText();
     }
     // Home link and four parent book nodes should be in the breadcrumb.
-    $this->assertEqual(5, count($got_breadcrumb));
+    $this->assertCount(5, $got_breadcrumb);
     $this->assertEqual($nodes[3]->getTitle(), end($got_breadcrumb));
     $edit = [
       'title[0][value]' => 'Updated node5 title',
@@ -169,7 +169,7 @@ public function testBreadcrumbTitleUpdates() {
     foreach ($links as $link) {
       $got_breadcrumb[] = $link->getText();
     }
-    $this->assertEqual(5, count($got_breadcrumb));
+    $this->assertCount(5, $got_breadcrumb);
     $this->assertEqual($edit['title[0][value]'], end($got_breadcrumb));
   }
 
@@ -190,7 +190,7 @@ public function testBreadcrumbAccessUpdates() {
     foreach ($links as $link) {
       $got_breadcrumb[] = $link->getText();
     }
-    $this->assertEqual(5, count($got_breadcrumb));
+    $this->assertCount(5, $got_breadcrumb);
     $this->assertEqual($edit['title[0][value]'], end($got_breadcrumb));
     $config = $this->container->get('config.factory')->getEditable('book_breadcrumb_test.settings');
     $config->set('hide', TRUE)->save();
@@ -200,7 +200,7 @@ public function testBreadcrumbAccessUpdates() {
     foreach ($links as $link) {
       $got_breadcrumb[] = $link->getText();
     }
-    $this->assertEqual(4, count($got_breadcrumb));
+    $this->assertCount(4, $got_breadcrumb);
     $this->assertEqual($nodes[2]->getTitle(), end($got_breadcrumb));
     $this->drupalGet($nodes[3]->toUrl());
     $this->assertResponse(403);
diff --git a/core/modules/comment/tests/src/Functional/CommentCSSTest.php b/core/modules/comment/tests/src/Functional/CommentCSSTest.php
index c703ecfe2065049cc9c794fa40c1d0eca3374449..a4a929132cd2f496426f78bbfdff41189a2958a0 100644
--- a/core/modules/comment/tests/src/Functional/CommentCSSTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentCSSTest.php
@@ -88,7 +88,7 @@ public function testCommentClasses() {
 
       // Verify the data-history-node-id attribute, which is necessary for the
       // by-viewer class and the "new" indicator, see below.
-      $this->assertIdentical(1, count($this->xpath('//*[@data-history-node-id="' . $node->id() . '"]')), 'data-history-node-id attribute is set on node.');
+      $this->assertCount(1, $this->xpath('//*[@data-history-node-id="' . $node->id() . '"]'), 'data-history-node-id attribute is set on node.');
 
       // Verify classes if the comment is visible for the current user.
       if ($case['comment_status'] == CommentInterface::PUBLISHED || $case['user'] == 'admin') {
@@ -114,7 +114,7 @@ public function testCommentClasses() {
         // drupal.comment-by-viewer library to add a by-viewer when the current
         // user (the viewer) was the author of the comment. We do this in Java-
         // Script to prevent breaking the render cache.
-        $this->assertIdentical(1, count($this->xpath('//*[contains(@class, "comment") and @data-comment-user-id="' . $case['comment_uid'] . '"]')), 'data-comment-user-id attribute is set on comment.');
+        $this->assertCount(1, $this->xpath('//*[contains(@class, "comment") and @data-comment-user-id="' . $case['comment_uid'] . '"]'), 'data-comment-user-id attribute is set on comment.');
         $this->assertRaw(drupal_get_path('module', 'comment') . '/js/comment-by-viewer.js', 'drupal.comment-by-viewer library is present.');
       }
 
@@ -132,7 +132,7 @@ public function testCommentClasses() {
       // comment that was created or changed after the last time the current
       // user read the corresponding node.
       if ($case['comment_status'] == CommentInterface::PUBLISHED || $case['user'] == 'admin') {
-        $this->assertIdentical(1, count($this->xpath('//*[contains(@class, "comment")]/*[@data-comment-timestamp="' . $comment->getChangedTime() . '"]')), 'data-comment-timestamp attribute is set on comment');
+        $this->assertCount(1, $this->xpath('//*[contains(@class, "comment")]/*[@data-comment-timestamp="' . $comment->getChangedTime() . '"]'), 'data-comment-timestamp attribute is set on comment');
         $expectedJS = ($case['user'] !== 'anonymous');
         $this->assertIdentical($expectedJS, isset($settings['ajaxPageState']['libraries']) && in_array('comment/drupal.comment-new-indicator', explode(',', $settings['ajaxPageState']['libraries'])), 'drupal.comment-new-indicator library is present.');
       }
diff --git a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php
index bb4b7ee7341f373fd07d9634702c7a86ce28e1e4..e5a3fe9d808e131b60c6228a420029b5caa7ae5d 100644
--- a/core/modules/comment/tests/src/Functional/CommentFieldsTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentFieldsTest.php
@@ -86,13 +86,13 @@ public function testCommentFieldDelete() {
 
     $this->drupalGet('node/' . $node->nid->value);
     $elements = $this->cssSelect('.field--type-comment');
-    $this->assertEqual(2, count($elements), 'There are two comment fields on the node.');
+    $this->assertCount(2, $elements, 'There are two comment fields on the node.');
 
     // Delete the first comment field.
     FieldStorageConfig::loadByName('node', 'comment')->delete();
     $this->drupalGet('node/' . $node->nid->value);
     $elements = $this->cssSelect('.field--type-comment');
-    $this->assertEqual(1, count($elements), 'There is one comment field on the node.');
+    $this->assertCount(1, $elements, 'There is one comment field on the node.');
   }
 
   /**
diff --git a/core/modules/comment/tests/src/Functional/CommentNewIndicatorTest.php b/core/modules/comment/tests/src/Functional/CommentNewIndicatorTest.php
index 2380f176beb3c2bc76bb027a19f94d79fa0f69ae..5a9b03442fd27381627780790c696a43d7809e27 100644
--- a/core/modules/comment/tests/src/Functional/CommentNewIndicatorTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentNewIndicatorTest.php
@@ -66,7 +66,7 @@ public function testCommentNewCommentsIndicator() {
     // used by the drupal.node-new-comments-link library to determine whether
     // a "x new comments" link might be necessary or not. We do this in
     // JavaScript to prevent breaking the render cache.
-    $this->assertIdentical(0, count($this->xpath('//*[@data-history-node-last-comment-timestamp]')), 'data-history-node-last-comment-timestamp attribute is not set.');
+    $this->assertCount(0, $this->xpath('//*[@data-history-node-last-comment-timestamp]'), 'data-history-node-last-comment-timestamp attribute is not set.');
 
     // Create a new comment. This helper function may be run with different
     // comment settings so use $comment->save() to avoid complex setup.
@@ -94,8 +94,8 @@ public function testCommentNewCommentsIndicator() {
     // value, the drupal.node-new-comments-link library would determine that the
     // node received a comment after the user last viewed it, and hence it would
     // perform an HTTP request to render the "new comments" node link.
-    $this->assertIdentical(1, count($this->xpath('//*[@data-history-node-last-comment-timestamp="' . $comment->getChangedTime() . '"]')), 'data-history-node-last-comment-timestamp attribute is set to the correct value.');
-    $this->assertIdentical(1, count($this->xpath('//*[@data-history-node-field-name="comment"]')), 'data-history-node-field-name attribute is set to the correct value.');
+    $this->assertCount(1, $this->xpath('//*[@data-history-node-last-comment-timestamp="' . $comment->getChangedTime() . '"]'), 'data-history-node-last-comment-timestamp attribute is set to the correct value.');
+    $this->assertCount(1, $this->xpath('//*[@data-history-node-field-name="comment"]'), 'data-history-node-field-name attribute is set to the correct value.');
     // The data will be pre-seeded on this particular page in drupalSettings, to
     // avoid the need for the client to make a separate request to the server.
     $settings = $this->getDrupalSettings();
diff --git a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
index 6d0d03c56946d4081a7eaab6d53c26ba9ec197ed..2d2073b1155a43a382f93a908e810377fc963268 100644
--- a/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
+++ b/core/modules/comment/tests/src/Functional/CommentPreviewTest.php
@@ -113,7 +113,7 @@ public function testCommentPreviewDuplicateSubmission() {
     $this->drupalPostForm(NULL, [], 'Save');
     $this->assertText('Your comment has been posted.');
     $elements = $this->xpath('//section[contains(@class, "comment-wrapper")]/article');
-    $this->assertEqual(1, count($elements));
+    $this->assertCount(1, $elements);
 
     // Go back and re-submit the form.
     $this->getSession()->getDriver()->back();
@@ -121,7 +121,7 @@ public function testCommentPreviewDuplicateSubmission() {
     $submit_button->click();
     $this->assertText('Your comment has been posted.');
     $elements = $this->xpath('//section[contains(@class, "comment-wrapper")]/article');
-    $this->assertEqual(2, count($elements));
+    $this->assertCount(2, $elements);
   }
 
   /**
diff --git a/core/modules/comment/tests/src/Functional/Views/CommentOperationsTest.php b/core/modules/comment/tests/src/Functional/Views/CommentOperationsTest.php
index ecd15d2a97ff355eae858a5e2c71e85d68ea1e06..6cb28c85be4821620b0da006da910035a23db3ef 100644
--- a/core/modules/comment/tests/src/Functional/Views/CommentOperationsTest.php
+++ b/core/modules/comment/tests/src/Functional/Views/CommentOperationsTest.php
@@ -30,9 +30,9 @@ public function testCommentOperations() {
     $this->drupalGet('test-comment-operations');
     $this->assertResponse(200);
     $operation = $this->cssSelect('.views-field-operations li.edit a');
-    $this->assertEqual(count($operation), 1, 'Found edit operation for comment.');
+    $this->assertCount(1, $operation, 'Found edit operation for comment.');
     $operation = $this->cssSelect('.views-field-operations li.delete a');
-    $this->assertEqual(count($operation), 1, 'Found delete operation for comment.');
+    $this->assertCount(1, $operation, 'Found delete operation for comment.');
   }
 
 }
diff --git a/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php b/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php
index d8c68ca47f13cc1bef4ede62a7d72cd8217165d7..d8ba9d93fa051566a3c24d33acbcffff4c2169c1 100644
--- a/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php
+++ b/core/modules/comment/tests/src/Functional/Views/CommentRestExportTest.php
@@ -66,7 +66,7 @@ public function testCommentRestExport() {
     $contents = Json::decode($this->getSession()->getPage()->getContent());
     $this->assertEqual($contents[0]['subject'], 'How much wood would a woodchuck chuck');
     $this->assertEqual($contents[1]['subject'], 'A lot, apparently');
-    $this->assertEqual(count($contents), 2);
+    $this->assertCount(2, $contents);
 
     // Ensure field-level access is respected - user shouldn't be able to see
     // mail or hostname fields.
diff --git a/core/modules/comment/tests/src/Functional/Views/CommentRowTest.php b/core/modules/comment/tests/src/Functional/Views/CommentRowTest.php
index 8cf2121a5eac4f43aae08b07967ff7920154d5d7..7b9654900591099d1d08db5a910209b5050a031d 100644
--- a/core/modules/comment/tests/src/Functional/Views/CommentRowTest.php
+++ b/core/modules/comment/tests/src/Functional/Views/CommentRowTest.php
@@ -28,7 +28,7 @@ public function testCommentRow() {
     $this->drupalGet('test-comment-row');
 
     $result = $this->xpath('//article[contains(@class, "comment")]');
-    $this->assertEqual(1, count($result), 'One rendered comment found.');
+    $this->assertCount(1, $result, 'One rendered comment found.');
   }
 
 }
diff --git a/core/modules/comment/tests/src/Functional/Views/NodeCommentsTest.php b/core/modules/comment/tests/src/Functional/Views/NodeCommentsTest.php
index 6b98377cf88150cbff6b0aba4b3992490e613907..a6916720d4b0b46a460b0d5851e0b337f496cb18 100644
--- a/core/modules/comment/tests/src/Functional/Views/NodeCommentsTest.php
+++ b/core/modules/comment/tests/src/Functional/Views/NodeCommentsTest.php
@@ -35,7 +35,7 @@ public function testNewComments() {
     $this->drupalGet('test-new-comments');
     $this->assertResponse(200);
     $new_comments = $this->cssSelect(".views-field-new-comments a:contains('1')");
-    $this->assertEqual(count($new_comments), 1, 'Found the number of new comments for a certain node.');
+    $this->assertCount(1, $new_comments, 'Found the number of new comments for a certain node.');
   }
 
 }
diff --git a/core/modules/comment/tests/src/Functional/Views/RowRssTest.php b/core/modules/comment/tests/src/Functional/Views/RowRssTest.php
index f8a24afa4e8706f573733f7fa9cf367576bebf6e..ea0b43e75f36f0f44f954a68809b9b3971f5a7d1 100644
--- a/core/modules/comment/tests/src/Functional/Views/RowRssTest.php
+++ b/core/modules/comment/tests/src/Functional/Views/RowRssTest.php
@@ -31,7 +31,7 @@ public function testRssRow() {
     // Because the response is XML we can't use the page which depends on an
     // HTML tag being present.
     $result = $this->getSession()->getDriver()->find('//item');
-    $this->assertEqual(count($result), 1, 'Just one comment was found in the rss output.');
+    $this->assertCount(1, $result, 'Just one comment was found in the rss output.');
 
     $this->assertEqual($result[0]->find('xpath', '//pubDate')->getHtml(), gmdate('r', $this->comment->getCreatedTime()), 'The right pubDate appears in the rss output.');
   }
diff --git a/core/modules/comment/tests/src/Kernel/CommentValidationTest.php b/core/modules/comment/tests/src/Kernel/CommentValidationTest.php
index 8b9a68727c8d5709648802c881279d0b5616a71c..96289c155e1abfd94995734ef38917f9d29165bd 100644
--- a/core/modules/comment/tests/src/Kernel/CommentValidationTest.php
+++ b/core/modules/comment/tests/src/Kernel/CommentValidationTest.php
@@ -84,7 +84,7 @@ public function testValidation() {
     ]);
 
     $violations = $comment->validate();
-    $this->assertEqual(count($violations), 0, 'No violations when validating a default comment.');
+    $this->assertCount(0, $violations, 'No violations when validating a default comment.');
 
     $comment->set('subject', $this->randomString(65));
     $this->assertLengthViolation($comment, 'subject', 64);
@@ -99,7 +99,7 @@ public function testValidation() {
     $comment->set('name', 'test');
     $comment->set('uid', 0);
     $violations = $comment->validate();
-    $this->assertEqual(count($violations), 1, "Violation found on author name collision");
+    $this->assertCount(1, $violations, "Violation found on author name collision");
     $this->assertEqual($violations[0]->getPropertyPath(), "name");
     $this->assertEqual($violations[0]->getMessage(), t('The name you used (%name) belongs to a registered user.', ['%name' => 'test']));
 
@@ -107,7 +107,7 @@ public function testValidation() {
     $comment->set('name', 'valid unused name');
     $comment->set('mail', 'invalid');
     $violations = $comment->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when email is invalid');
+    $this->assertCount(1, $violations, 'Violation found when email is invalid');
     $this->assertEqual($violations[0]->getPropertyPath(), 'mail.0.value');
     $this->assertEqual($violations[0]->getMessage(), t('This value is not a valid email address.'));
 
@@ -117,7 +117,7 @@ public function testValidation() {
 
     $comment->set('homepage', 'invalid');
     $violations = $comment->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when homepage is invalid');
+    $this->assertCount(1, $violations, 'Violation found when homepage is invalid');
     $this->assertEqual($violations[0]->getPropertyPath(), 'homepage.0.value');
 
     // @todo This message should be improved in
@@ -150,7 +150,7 @@ public function testValidation() {
       'name' => '',
     ]);
     $violations = $comment->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when name is required, but empty and UID is anonymous.');
+    $this->assertCount(1, $violations, 'Violation found when name is required, but empty and UID is anonymous.');
     $this->assertEqual($violations[0]->getPropertyPath(), 'name');
     $this->assertEqual($violations[0]->getMessage(), t('You have to specify a valid author.'));
 
@@ -163,7 +163,7 @@ public function testValidation() {
       'uid' => $user->id(),
     ]);
     $violations = $comment->validate();
-    $this->assertEqual(count($violations), 0, 'No violations when validating a default comment with an author.');
+    $this->assertCount(0, $violations, 'No violations when validating a default comment with an author.');
 
     // Test specifying a wrong author name does not work.
     $comment = $this->entityTypeManager->getStorage('comment')->create([
@@ -175,7 +175,7 @@ public function testValidation() {
       'name' => 'not-test',
     ]);
     $violations = $comment->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when author name and comment author do not match.');
+    $this->assertCount(1, $violations, 'Violation found when author name and comment author do not match.');
     $this->assertEqual($violations[0]->getPropertyPath(), 'name');
     $this->assertEqual($violations[0]->getMessage(), t('The specified author name does not match the comment author.'));
   }
@@ -192,7 +192,7 @@ public function testValidation() {
    */
   protected function assertLengthViolation(CommentInterface $comment, $field_name, $length) {
     $violations = $comment->validate();
-    $this->assertEqual(count($violations), 1, "Violation found when $field_name is too long.");
+    $this->assertCount(1, $violations, "Violation found when $field_name is too long.");
     $this->assertEqual($violations[0]->getPropertyPath(), "$field_name.0.value");
     $field_label = $comment->get($field_name)->getFieldDefinition()->getLabel();
     $this->assertEqual($violations[0]->getMessage(), t('%name: may not be longer than @max characters.', ['%name' => $field_label, '@max' => $length]));
diff --git a/core/modules/comment/tests/src/Kernel/Views/CommentAdminViewTest.php b/core/modules/comment/tests/src/Kernel/Views/CommentAdminViewTest.php
index fe23816543a9f4195f4712a31d1db1fadcc0e8f2..4431bb6e679ad3b3ae5dcb42299ec090f5f9c85d 100644
--- a/core/modules/comment/tests/src/Kernel/Views/CommentAdminViewTest.php
+++ b/core/modules/comment/tests/src/Kernel/Views/CommentAdminViewTest.php
@@ -164,7 +164,7 @@ protected function doTestFilters($display_id) {
     $this->assertField('langcode');
 
     $elements = $this->cssSelect('input[type="checkbox"]');
-    $this->assertEquals(2, count($elements), 'There are two comments on the page.');
+    $this->assertCount(2, $elements, 'There are two comments on the page.');
     $this->assertText($comment->label());
     $this->assertText($comment_anonymous->label());
     $executable->destroy();
@@ -176,7 +176,7 @@ protected function doTestFilters($display_id) {
     $this->verbose($this->getRawContent());
 
     $elements = $this->cssSelect('input[type="checkbox"]');
-    $this->assertEquals(1, count($elements), 'Only anonymous comment is visible.');
+    $this->assertCount(1, $elements, 'Only anonymous comment is visible.');
     $this->assertNoText($comment->label());
     $this->assertText($comment_anonymous->label());
     $executable->destroy();
@@ -187,7 +187,7 @@ protected function doTestFilters($display_id) {
     $this->verbose($this->getRawContent());
 
     $elements = $this->cssSelect('input[type="checkbox"]');
-    $this->assertEquals(1, count($elements), 'Only admin comment is visible.');
+    $this->assertCount(1, $elements, 'Only admin comment is visible.');
     $this->assertText($comment->label());
     $this->assertNoText($comment_anonymous->label());
     $executable->destroy();
@@ -199,7 +199,7 @@ protected function doTestFilters($display_id) {
     $this->verbose($this->getRawContent());
 
     $elements = $this->cssSelect('input[type="checkbox"]');
-    $this->assertEquals(1, count($elements), 'Only anonymous comment is visible.');
+    $this->assertCount(1, $elements, 'Only anonymous comment is visible.');
     $this->assertNoText($comment->label());
     $this->assertText($comment_anonymous->label());
     $executable->destroy();
@@ -211,7 +211,7 @@ protected function doTestFilters($display_id) {
     $this->verbose($this->getRawContent());
 
     $elements = $this->cssSelect('input[type="checkbox"]');
-    $this->assertEquals(1, count($elements), 'Only admin comment is visible.');
+    $this->assertCount(1, $elements, 'Only admin comment is visible.');
     $this->assertText($comment->label());
     $this->assertNoText($comment_anonymous->label());
     $executable->destroy();
@@ -223,7 +223,7 @@ protected function doTestFilters($display_id) {
     $this->verbose($this->getRawContent());
 
     $elements = $this->cssSelect('input[type="checkbox"]');
-    $this->assertEquals(2, count($elements), 'Both comments are visible.');
+    $this->assertCount(2, $elements, 'Both comments are visible.');
     $this->assertText($comment->label());
     $this->assertText($comment_anonymous->label());
     $executable->destroy();
@@ -258,7 +258,7 @@ protected function doTestFilters($display_id) {
     $this->verbose($this->getRawContent());
 
     $elements = $this->cssSelect('input[type="checkbox"]');
-    $this->assertEquals(2, count($elements), 'Both comments are visible.');
+    $this->assertCount(2, $elements, 'Both comments are visible.');
     $this->assertNoText($comment->label());
     $this->assertNoText($comment_anonymous->label());
     $this->assertText($comment_translation->label());
diff --git a/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php b/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php
index 2e6a06f2334ed2633cd445c6fe5f7f5a76b0c80e..5fe5916ad91ad243b1de90db6b930b818deb889d 100644
--- a/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php
+++ b/core/modules/config_translation/tests/src/Functional/ConfigTranslationOverviewTest.php
@@ -87,7 +87,7 @@ public function testMapperListPage() {
     // Make sure there is only a single operation for each dropbutton, either
     // 'List' or 'Translate'.
     foreach ($this->cssSelect('ul.dropbutton') as $i => $dropbutton) {
-      $this->assertIdentical(1, count($dropbutton->findAll('xpath', 'li')));
+      $this->assertCount(1, $dropbutton->findAll('xpath', 'li'));
       $this->assertTrue(($dropbutton->getText() === 'Translate') || ($dropbutton->getText() === 'List'));
     }
 
@@ -113,7 +113,7 @@ public function testMapperListPage() {
       // Make sure there is only a single 'Translate' operation for each
       // dropbutton.
       foreach ($this->cssSelect('ul.dropbutton') as $i => $dropbutton) {
-        $this->assertIdentical(1, count($dropbutton->findAll('xpath', 'li')));
+        $this->assertCount(1, $dropbutton->findAll('xpath', 'li'));
         $this->assertIdentical('Translate', $dropbutton->getText());
       }
 
diff --git a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php
index 6eab92c93ae73980fa698227f3e004b88987c45c..5a978ac6150c138763879083c0135f3d44b77389 100644
--- a/core/modules/contact/tests/src/Functional/ContactPersonalTest.php
+++ b/core/modules/contact/tests/src/Functional/ContactPersonalTest.php
@@ -78,7 +78,7 @@ public function testSendPersonalContactMessage() {
     $this->assertEscaped($mail);
     $message = $this->submitPersonalContact($this->contactUser);
     $mails = $this->getMails();
-    $this->assertEqual(1, count($mails));
+    $this->assertCount(1, $mails);
     $mail = $mails[0];
     $this->assertEqual($mail['to'], $this->contactUser->getEmail());
     $this->assertEqual($mail['from'], $this->config('system.site')->get('mail'));
diff --git a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php
index 47a86b450a908ff728d67223655866c428dc4e83..97f8254e97a83c53ffa0dfa5eeebefccf1cba119 100644
--- a/core/modules/contact/tests/src/Functional/ContactSitewideTest.php
+++ b/core/modules/contact/tests/src/Functional/ContactSitewideTest.php
@@ -377,7 +377,7 @@ public function testSiteWideContact() {
     ];
     $this->drupalPostForm(NULL, $edit, t('Send message'));
     $result = $this->xpath('//div[@role=:role]', [':role' => 'contentinfo']);
-    $this->assertEqual(count($result), 0, 'Messages not found.');
+    $this->assertCount(0, $result, 'Messages not found.');
     $this->assertUrl('user/' . $admin_user->id());
 
     // Test preview and visibility of the message field and label. Submit the
@@ -442,7 +442,7 @@ public function testAutoReply() {
 
     // We are testing the auto-reply, so there should be one email going to the sender.
     $captured_emails = $this->getMails(['id' => 'contact_page_autoreply', 'to' => $email]);
-    $this->assertEqual(count($captured_emails), 1);
+    $this->assertCount(1, $captured_emails);
     $this->assertEqual(trim($captured_emails[0]['body']), trim(MailFormatHelper::htmlToText($foo_autoreply)));
 
     // Test the auto-reply for form 'bar'.
@@ -451,14 +451,14 @@ public function testAutoReply() {
 
     // Auto-reply for form 'bar' should result in one auto-reply email to the sender.
     $captured_emails = $this->getMails(['id' => 'contact_page_autoreply', 'to' => $email]);
-    $this->assertEqual(count($captured_emails), 1);
+    $this->assertCount(1, $captured_emails);
     $this->assertEqual(trim($captured_emails[0]['body']), trim(MailFormatHelper::htmlToText($bar_autoreply)));
 
     // Verify that no auto-reply is sent when the auto-reply field is left blank.
     $email = $this->randomMachineName(32) . '@example.com';
     $this->submitContact($this->randomMachineName(16), $email, $this->randomString(64), 'no_autoreply', $this->randomString(128));
     $captured_emails = $this->getMails(['id' => 'contact_page_autoreply', 'to' => $email]);
-    $this->assertEqual(count($captured_emails), 0);
+    $this->assertCount(0, $captured_emails);
 
     // Verify that the current error message doesn't show, that the auto-reply
     // doesn't get sent and the correct silent error gets logged.
@@ -470,7 +470,7 @@ public function testAutoReply() {
     $this->submitContact($this->randomMachineName(16), $email, $this->randomString(64), 'foo', $this->randomString(128));
     $this->assertNoText('Unable to send email. Contact the site administrator if the problem persists.');
     $captured_emails = $this->getMails(['id' => 'contact_page_autoreply', 'to' => $email]);
-    $this->assertEqual(count($captured_emails), 0);
+    $this->assertCount(0, $captured_emails);
     $this->drupalLogin($admin_user);
     $this->drupalGet('admin/reports/dblog');
     $this->assertRaw('Error sending auto-reply, missing sender e-mail address in foo');
diff --git a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
index 611472bb5b16aced58d82dc4b0153f70e342644e..078e0196ae201c684194d12d3bbf591465a8d9d9 100644
--- a/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
+++ b/core/modules/datetime/tests/src/Functional/DateTimeFieldTest.php
@@ -905,7 +905,7 @@ public function testDateStorageSettings() {
     $this->drupalPostForm('node/add/date_content', $edit, t('Save'));
     $this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name . '/storage');
     $result = $this->xpath("//*[@id='edit-settings-datetime-type' and contains(@disabled, 'disabled')]");
-    $this->assertEqual(count($result), 1, "Changing datetime setting is disabled.");
+    $this->assertCount(1, $result, "Changing datetime setting is disabled.");
     $this->assertText('There is data for this field in the database. The field settings can no longer be changed.');
   }
 
diff --git a/core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php b/core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php
index 7a42aead14b0752368821947bc10612daba0fc79..a2a0c2ec7eccc75cfb52cd76b47005ada6057c49 100644
--- a/core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php
+++ b/core/modules/datetime/tests/src/Functional/Views/FilterDateTest.php
@@ -140,13 +140,13 @@ public function testExposedGroupedFilters() {
     $this->getSession()->getPage()->findField($this->fieldName . '_value')->selectOption(1);
     $this->getSession()->getPage()->pressButton('Apply');
     $results = $this->cssSelect('.view-content .field-content');
-    $this->assertEquals(1, count($results));
+    $this->assertCount(1, $results);
 
     // Filter the Preview by 'not empty'.
     $this->getSession()->getPage()->findField($this->fieldName . '_value')->selectOption(2);
     $this->getSession()->getPage()->pressButton('Apply');
     $results = $this->cssSelect('.view-content .field-content');
-    $this->assertEquals(3, count($results));
+    $this->assertCount(3, $results);
   }
 
 }
diff --git a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
index bc412837de9a307f33b75eea95fe9ea0c99d8907..08bae76b4eb9fde0b48703a57ec2c8c1cf59a6eb 100644
--- a/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
+++ b/core/modules/datetime_range/tests/src/Functional/DateRangeFieldTest.php
@@ -1399,7 +1399,7 @@ public function testDateStorageSettings() {
     $this->drupalPostForm('node/add/date_content', $edit, t('Save'));
     $this->drupalGet('admin/structure/types/manage/date_content/fields/node.date_content.' . $field_name . '/storage');
     $result = $this->xpath("//*[@id='edit-settings-datetime-type' and contains(@disabled, 'disabled')]");
-    $this->assertEqual(count($result), 1, "Changing datetime setting is disabled.");
+    $this->assertCount(1, $result, "Changing datetime setting is disabled.");
     $this->assertText('There is data for this field in the database. The field settings can no longer be changed.');
   }
 
diff --git a/core/modules/editor/tests/src/Functional/QuickEditIntegrationLoadingTest.php b/core/modules/editor/tests/src/Functional/QuickEditIntegrationLoadingTest.php
index 4f4365e03b0e496f94779205b8eaa94c2cf6965c..076d4ac8d5375e96a49aef7c694030c1dcc3d3de 100644
--- a/core/modules/editor/tests/src/Functional/QuickEditIntegrationLoadingTest.php
+++ b/core/modules/editor/tests/src/Functional/QuickEditIntegrationLoadingTest.php
@@ -139,7 +139,7 @@ public function testUserWithPermission() {
 
     $this->assertEquals(200, $response->getStatusCode());
     $ajax_commands = Json::decode($response->getBody());
-    $this->assertIdentical(1, count($ajax_commands), 'The untransformed text POST request results in one AJAX command.');
+    $this->assertCount(1, $ajax_commands, 'The untransformed text POST request results in one AJAX command.');
     $this->assertIdentical('editorGetUntransformedText', $ajax_commands[0]['command'], 'The first AJAX command is an editorGetUntransformedText command.');
     $this->assertIdentical('<p>Do you also love Drupal?</p><img src="druplicon.png" data-caption="Druplicon" />', $ajax_commands[0]['data'], 'The editorGetUntransformedText command contains the expected data.');
   }
diff --git a/core/modules/field/tests/src/Functional/Boolean/BooleanFormatterSettingsTest.php b/core/modules/field/tests/src/Functional/Boolean/BooleanFormatterSettingsTest.php
index 4d8998dedbcabf1edfecea4f76454506d631f35c..31dd85d345761e980cd6f18371ed524b1ffcc655 100644
--- a/core/modules/field/tests/src/Functional/Boolean/BooleanFormatterSettingsTest.php
+++ b/core/modules/field/tests/src/Functional/Boolean/BooleanFormatterSettingsTest.php
@@ -127,7 +127,7 @@ public function testBooleanFormatterSettings() {
         ':class' => 'field-plugin-summary',
         ':text' => (string) t('Display: @true_label / @false_label', ['@true_label' => $values[0], '@false_label' => $values[1]]),
       ]);
-      $this->assertEqual(count($result), 1, "Boolean formatter settings summary exist.");
+      $this->assertCount(1, $result, "Boolean formatter settings summary exist.");
     }
   }
 
diff --git a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
index 7dd622bec1a075f1893c586714b1f746dfff5aaf..6b8103178e01dee3371dc2133e7a6e8df3b30066 100644
--- a/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
+++ b/core/modules/field/tests/src/Functional/EntityReference/EntityReferenceAdminTest.php
@@ -210,7 +210,7 @@ public function testFieldAdminHandler() {
       ->condition('vid', 'tags')
       ->accessCheck(FALSE)
       ->execute();
-    $this->assertIdentical(0, count($result), "No taxonomy terms exist with the name '$term_name'.");
+    $this->assertCount(0, $result, "No taxonomy terms exist with the name '$term_name'.");
     $edit = [
       // This must be set before new entities will be auto-created.
       'settings[handler_settings][auto_create]' => 1,
@@ -228,7 +228,7 @@ public function testFieldAdminHandler() {
       ->condition('vid', 'tags')
       ->accessCheck(FALSE)
       ->execute();
-    $this->assertIdentical(1, count($result), 'Taxonomy term was auto created when set as field default.');
+    $this->assertCount(1, $result, 'Taxonomy term was auto created when set as field default.');
   }
 
   /**
diff --git a/core/modules/field/tests/src/Functional/NestedFormTest.php b/core/modules/field/tests/src/Functional/NestedFormTest.php
index d8f388e44f5f4cdb3852f2b49a624149662d0c14..8cf509ece9d99db2e367a8c608624ee0eb61d483 100644
--- a/core/modules/field/tests/src/Functional/NestedFormTest.php
+++ b/core/modules/field/tests/src/Functional/NestedFormTest.php
@@ -199,7 +199,7 @@ public function testNestedEntityFormEntityLevelValidation() {
     $page->pressButton(t('Save'));
 
     $elements = $this->cssSelect('.entity-2.error');
-    $this->assertEqual(1, count($elements), 'The whole nested entity form has been correctly flagged with an error class.');
+    $this->assertCount(1, $elements, 'The whole nested entity form has been correctly flagged with an error class.');
   }
 
 }
diff --git a/core/modules/field/tests/src/Kernel/BulkDeleteTest.php b/core/modules/field/tests/src/Kernel/BulkDeleteTest.php
index 7830fd38e98790d5b17645f8317fed4b0b1b65f0..95600b43cc8e2116bd3195925ec5e456379e528a 100644
--- a/core/modules/field/tests/src/Kernel/BulkDeleteTest.php
+++ b/core/modules/field/tests/src/Kernel/BulkDeleteTest.php
@@ -170,7 +170,7 @@ public function testDeleteField() {
       ->getQuery()
       ->condition('type', $bundle)
       ->execute();
-    $this->assertEqual(count($found), 10, 'Correct number of entities found before deleting');
+    $this->assertCount(10, $found, 'Correct number of entities found before deleting');
 
     // Delete the field.
     $field = FieldConfig::loadByName($this->entityTypeId, $bundle, $field_name);
@@ -178,7 +178,7 @@ public function testDeleteField() {
 
     // The field still exists, deleted.
     $fields = \Drupal::entityTypeManager()->getStorage('field_config')->loadByProperties(['field_storage_uuid' => $field_storage->uuid(), 'deleted' => TRUE, 'include_deleted' => TRUE]);
-    $this->assertEqual(count($fields), 1, 'There is one deleted field');
+    $this->assertCount(1, $fields, 'There is one deleted field');
     $field = $fields[$field->uuid()];
     $this->assertEqual($field->getTargetBundle(), $bundle, 'The deleted field is for the correct bundle');
 
@@ -293,7 +293,7 @@ public function testPurgeWithDeletedAndActiveField() {
 
     // The field has been removed from the system.
     $fields = \Drupal::entityTypeManager()->getStorage('field_config')->loadByProperties(['field_storage_uuid' => $deleted_field_storage->uuid(), 'deleted' => TRUE, 'include_deleted' => TRUE]);
-    $this->assertEqual(count($fields), 0, 'The field is gone');
+    $this->assertCount(0, $fields, 'The field is gone');
 
     // Verify there are still 10 entries in the main table.
     $count = \Drupal::database()
@@ -324,7 +324,7 @@ public function testPurgeField() {
 
     // No field hooks were called.
     $mem = field_test_memorize();
-    $this->assertEqual(count($mem), 0, 'No field hooks were called');
+    $this->assertCount(0, $mem, 'No field hooks were called');
 
     $batch_size = 2;
     for ($count = 8; $count >= 0; $count -= $batch_size) {
@@ -352,14 +352,14 @@ public function testPurgeField() {
 
     // The field still exists, deleted.
     $fields = \Drupal::entityTypeManager()->getStorage('field_config')->loadByProperties(['field_storage_uuid' => $field_storage->uuid(), 'deleted' => TRUE, 'include_deleted' => TRUE]);
-    $this->assertEqual(count($fields), 1, 'There is one deleted field');
+    $this->assertCount(1, $fields, 'There is one deleted field');
 
     // Purge the field.
     field_purge_batch($batch_size);
 
     // The field is gone.
     $fields = \Drupal::entityTypeManager()->getStorage('field_config')->loadByProperties(['field_storage_uuid' => $field_storage->uuid(), 'deleted' => TRUE, 'include_deleted' => TRUE]);
-    $this->assertEqual(count($fields), 0, 'The field is gone');
+    $this->assertCount(0, $fields, 'The field is gone');
 
     // The field storage still exists, not deleted, because it has a second
     // field.
@@ -385,7 +385,7 @@ public function testPurgeFieldStorage() {
 
     // Assert that FieldItemInterface::delete() was not called yet.
     $mem = field_test_memorize();
-    $this->assertEqual(count($mem), 0, 'No field hooks were called.');
+    $this->assertCount(0, $mem, 'No field hooks were called.');
 
     // Purge the data.
     field_purge_batch(10);
@@ -410,7 +410,7 @@ public function testPurgeFieldStorage() {
 
     // The field is gone.
     $fields = \Drupal::entityTypeManager()->getStorage('field_config')->loadByProperties(['uuid' => $field->uuid(), 'include_deleted' => TRUE]);
-    $this->assertEqual(count($fields), 0, 'The field is purged.');
+    $this->assertCount(0, $fields, 'The field is purged.');
     // The field storage still exists, not deleted.
     $storages = \Drupal::entityTypeManager()->getStorage('field_storage_config')->loadByProperties(['uuid' => $field_storage->uuid(), 'include_deleted' => TRUE]);
     $this->assertTrue(isset($storages[$field_storage->uuid()]) && !$storages[$field_storage->uuid()]->isDeleted(), 'The field storage exists and is not deleted');
@@ -422,7 +422,7 @@ public function testPurgeFieldStorage() {
 
     // Assert that FieldItemInterface::delete() was not called yet.
     $mem = field_test_memorize();
-    $this->assertEqual(count($mem), 0, 'No field hooks were called.');
+    $this->assertCount(0, $mem, 'No field hooks were called.');
 
     // Purge the data.
     field_purge_batch(10);
@@ -447,9 +447,9 @@ public function testPurgeFieldStorage() {
 
     // The field and the storage are gone.
     $fields = \Drupal::entityTypeManager()->getStorage('field_config')->loadByProperties(['uuid' => $field->uuid(), 'include_deleted' => TRUE]);
-    $this->assertEqual(count($fields), 0, 'The field is purged.');
+    $this->assertCount(0, $fields, 'The field is purged.');
     $storages = \Drupal::entityTypeManager()->getStorage('field_storage_config')->loadByProperties(['uuid' => $field_storage->uuid(), 'include_deleted' => TRUE]);
-    $this->assertEqual(count($storages), 0, 'The field storage is purged.');
+    $this->assertCount(0, $storages, 'The field storage is purged.');
   }
 
 }
diff --git a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php
index d509463d5e594999ae28d483ad1d194c6f2210f1..78ad5d8e9511ba06619a15938f1233752203eda9 100644
--- a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php
+++ b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php
@@ -422,7 +422,7 @@ public function testAutocreateValidation() {
     ]);
     $errors = $entity->validate();
     // Using target_id of NULL is valid with an unsaved entity.
-    $this->assertEqual(0, count($errors));
+    $this->assertCount(0, $errors);
     // Using target_id of NULL is not valid with a saved entity.
     $term->save();
     $entity = EntityTest::create([
@@ -432,13 +432,13 @@ public function testAutocreateValidation() {
       ],
     ]);
     $errors = $entity->validate();
-    $this->assertEqual(1, count($errors));
+    $this->assertCount(1, $errors);
     $this->assertEqual($errors[0]->getMessage(), 'This value should not be null.');
     $this->assertEqual($errors[0]->getPropertyPath(), 'field_test_taxonomy_term.0');
     // This should rectify the issue, favoring the entity over the target_id.
     $entity->save();
     $errors = $entity->validate();
-    $this->assertEqual(0, count($errors));
+    $this->assertCount(0, $errors);
 
     // Test with an unpublished and unsaved node.
     $title = $this->randomString();
@@ -455,14 +455,14 @@ public function testAutocreateValidation() {
     ]);
 
     $errors = $entity->validate();
-    $this->assertEqual(1, count($errors));
+    $this->assertCount(1, $errors);
     $this->assertEqual($errors[0]->getMessage(), new FormattableMarkup('This entity (%type: %label) cannot be referenced.', ['%type' => 'node', '%label' => $title]));
     $this->assertEqual($errors[0]->getPropertyPath(), 'field_test_node.0.entity');
 
     // Publish the node and try again.
     $node->setPublished();
     $errors = $entity->validate();
-    $this->assertEqual(0, count($errors));
+    $this->assertCount(0, $errors);
 
     // Test with a mix of valid and invalid nodes.
     $unsaved_unpublished_node_title = $this->randomString();
@@ -503,7 +503,7 @@ public function testAutocreateValidation() {
     ]);
 
     $errors = $entity->validate();
-    $this->assertEqual(2, count($errors));
+    $this->assertCount(2, $errors);
     $this->assertEqual($errors[0]->getMessage(), new FormattableMarkup('This entity (%type: %label) cannot be referenced.', ['%type' => 'node', '%label' => $unsaved_unpublished_node_title]));
     $this->assertEqual($errors[0]->getPropertyPath(), 'field_test_node.0.entity');
     $this->assertEqual($errors[1]->getMessage(), new FormattableMarkup('This entity (%type: %label) cannot be referenced.', ['%type' => 'node', '%label' => $saved_unpublished_node->id()]));
@@ -513,14 +513,14 @@ public function testAutocreateValidation() {
     $saved_unpublished_node->setPublished();
     $saved_unpublished_node->save();
     $errors = $entity->validate();
-    $this->assertEqual(1, count($errors));
+    $this->assertCount(1, $errors);
     $this->assertEqual($errors[0]->getMessage(), new FormattableMarkup('This entity (%type: %label) cannot be referenced.', ['%type' => 'node', '%label' => $unsaved_unpublished_node_title]));
     $this->assertEqual($errors[0]->getPropertyPath(), 'field_test_node.0.entity');
 
     // Publish the last invalid node and try again.
     $unsaved_unpublished_node->setPublished();
     $errors = $entity->validate();
-    $this->assertEqual(0, count($errors));
+    $this->assertCount(0, $errors);
 
     // Test with an unpublished and unsaved comment.
     $title = $this->randomString();
@@ -537,14 +537,14 @@ public function testAutocreateValidation() {
     ]);
 
     $errors = $entity->validate();
-    $this->assertEqual(1, count($errors));
+    $this->assertCount(1, $errors);
     $this->assertEqual($errors[0]->getMessage(), new FormattableMarkup('This entity (%type: %label) cannot be referenced.', ['%type' => 'comment', '%label' => $title]));
     $this->assertEqual($errors[0]->getPropertyPath(), 'field_test_comment.0.entity');
 
     // Publish the comment and try again.
     $comment->setPublished();
     $errors = $entity->validate();
-    $this->assertEqual(0, count($errors));
+    $this->assertCount(0, $errors);
 
     // Test with an inactive and unsaved user.
     $name = $this->randomString();
@@ -560,14 +560,14 @@ public function testAutocreateValidation() {
     ]);
 
     $errors = $entity->validate();
-    $this->assertEqual(1, count($errors));
+    $this->assertCount(1, $errors);
     $this->assertEqual($errors[0]->getMessage(), new FormattableMarkup('This entity (%type: %label) cannot be referenced.', ['%type' => 'user', '%label' => $name]));
     $this->assertEqual($errors[0]->getPropertyPath(), 'field_test_user.0.entity');
 
     // Activate the user and try again.
     $user->activate();
     $errors = $entity->validate();
-    $this->assertEqual(0, count($errors));
+    $this->assertCount(0, $errors);
 
     // Test with a temporary and unsaved file.
     $filename = $this->randomMachineName() . '.txt';
@@ -583,14 +583,14 @@ public function testAutocreateValidation() {
     ]);
 
     $errors = $entity->validate();
-    $this->assertEqual(1, count($errors));
+    $this->assertCount(1, $errors);
     $this->assertEqual($errors[0]->getMessage(), new FormattableMarkup('This entity (%type: %label) cannot be referenced.', ['%type' => 'file', '%label' => $filename]));
     $this->assertEqual($errors[0]->getPropertyPath(), 'field_test_file.0.entity');
 
     // Set the file as permanent and try again.
     $file->setPermanent();
     $errors = $entity->validate();
-    $this->assertEqual(0, count($errors));
+    $this->assertCount(0, $errors);
   }
 
 }
diff --git a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
index ebb080c46ebccdec083cb76986d7424338cb99f4..6a92626c379b94086fc46ec6da35c67ab4ec44a1 100644
--- a/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldAttachStorageTest.php
@@ -355,8 +355,8 @@ public function testEntityDeleteBundle() {
     $entity = $this->entitySaveReload($entity);
 
     // Verify the fields are present on load
-    $this->assertEqual(count($entity->{$this->fieldTestData->field_name}), 4, 'First field got loaded');
-    $this->assertEqual(count($entity->{$field_name}), 1, 'Second field got loaded');
+    $this->assertCount(4, $entity->{$this->fieldTestData->field_name}, 'First field got loaded');
+    $this->assertCount(1, $entity->{$field_name}, 'Second field got loaded');
 
     // Delete the bundle.
     entity_test_delete_bundle($this->fieldTestData->field->getTargetBundle(), $entity_type);
diff --git a/core/modules/field/tests/src/Kernel/FieldCrudTest.php b/core/modules/field/tests/src/Kernel/FieldCrudTest.php
index b88b876f555533437d09153eb7091739d56774c8..d964baadf646a37e02aa9e9b4bfd120f33110c88 100644
--- a/core/modules/field/tests/src/Kernel/FieldCrudTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldCrudTest.php
@@ -290,7 +290,7 @@ public function testDeleteFieldNoData() {
     // Make sure the field was deleted without being marked for purging as there
     // was no data.
     $fields = \Drupal::entityTypeManager()->getStorage('field_config')->loadByProperties(['entity_type' => 'entity_test', 'field_name' => $this->fieldDefinition['field_name'], 'bundle' => $this->fieldDefinition['bundle'], 'include_deleted' => TRUE]);
-    $this->assertEquals(0, count($fields), 'A deleted field is marked for deletion.');
+    $this->assertCount(0, $fields, 'A deleted field is marked for deletion.');
 
     // Try to load the field normally and make sure it does not show up.
     $field = FieldConfig::load('entity_test.' . '.' . $this->fieldDefinition['bundle'] . '.' . $this->fieldDefinition['field_name']);
diff --git a/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php b/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php
index af12c239672355ab0f0d283d602edd4d70ca3289..c7138e0e6a0cf22268b0ce452857bac33126ead1 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportCreateTest.php
@@ -58,14 +58,14 @@ public function testImportCreateDefault() {
       ->condition('entity_type', 'entity_test')
       ->condition('bundle', 'entity_test')
       ->execute();
-    $this->assertEqual(count($ids), 2);
+    $this->assertCount(2, $ids);
     $this->assertTrue(isset($ids['entity_test.entity_test.field_test_import']));
     $this->assertTrue(isset($ids['entity_test.entity_test.field_test_import_2']));
     $ids = \Drupal::entityQuery('field_config')
       ->condition('entity_type', 'entity_test')
       ->condition('bundle', 'test_bundle')
       ->execute();
-    $this->assertEqual(count($ids), 1);
+    $this->assertCount(1, $ids);
     $this->assertTrue(isset($ids['entity_test.test_bundle.field_test_import_2']));
   }
 
diff --git a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
index a0f77801f1fc949fc412759a5851dbcfb23aa74a..52829231311459d517eab7f1659a1af3d441ac61 100644
--- a/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldImportDeleteTest.php
@@ -76,7 +76,7 @@ public function testImportDelete() {
     $this->assertTrue($sync->delete($field_config_name_2b), new FormattableMarkup('Deleted field: @field', ['@field' => $field_config_name_2b]));
 
     $deletes = $this->configImporter()->getUnprocessedConfiguration('delete');
-    $this->assertEqual(count($deletes), 5, 'Importing configuration will delete 3 fields and 2 field storages.');
+    $this->assertCount(5, $deletes, 'Importing configuration will delete 3 fields and 2 field storages.');
 
     // Import the content of the sync directory.
     $this->configImporter()->import();
diff --git a/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php b/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php
index df5ed51c523e8e7bcca6807426af8615a3d3490e..33d69abd704fd36bcbcf14fa0c0509cba227c27c 100644
--- a/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldStorageCrudTest.php
@@ -324,12 +324,12 @@ public function testDeleteNoData() {
 
     // Make sure that the field storage is deleted as it had no data.
     $field_storages = $field_storage_config_storage->loadByProperties(['field_name' => $field_storage_definition['field_name'], 'include_deleted' => TRUE]);
-    $this->assertEquals(0, count($field_storages), 'Field storage was deleted');
+    $this->assertCount(0, $field_storages, 'Field storage was deleted');
 
     // Make sure that this field is marked as deleted when it is
     // specifically loaded.
     $fields = \Drupal::entityTypeManager()->getStorage('field_config')->loadByProperties(['entity_type' => 'entity_test', 'field_name' => $field_definition['field_name'], 'bundle' => $field_definition['bundle'], 'include_deleted' => TRUE]);
-    $this->assertEquals(0, count($fields), 'Field storage was deleted');
+    $this->assertCount(0, $fields, 'Field storage was deleted');
 
     // 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']);
diff --git a/core/modules/field/tests/src/Kernel/FieldValidationTest.php b/core/modules/field/tests/src/Kernel/FieldValidationTest.php
index b96ec8df208d57ee749924bf6196c19f0d59eaf2..85c1415e915616444a79bbc28759ed75068e0a71 100644
--- a/core/modules/field/tests/src/Kernel/FieldValidationTest.php
+++ b/core/modules/field/tests/src/Kernel/FieldValidationTest.php
@@ -54,7 +54,7 @@ public function testCardinalityConstraint() {
     $violations = $entity->{$this->fieldTestData->field_name}->validate();
 
     // Check that the expected constraint violations are reported.
-    $this->assertEqual(count($violations), 1);
+    $this->assertCount(1, $violations);
     $this->assertEqual($violations[0]->getPropertyPath(), '');
     $this->assertEqual($violations[0]->getMessage(), t('%name: this field cannot hold more than @count values.', ['%name' => $this->fieldTestData->field->getLabel(), '@count' => $cardinality]));
   }
diff --git a/core/modules/field/tests/src/Kernel/Number/NumberItemTest.php b/core/modules/field/tests/src/Kernel/Number/NumberItemTest.php
index ca610e4674d58a4a0c9c0790534f566225d69bd9..8f830f8d94b9649a51dba29f6ca92ec21d3e42b7 100644
--- a/core/modules/field/tests/src/Kernel/Number/NumberItemTest.php
+++ b/core/modules/field/tests/src/Kernel/Number/NumberItemTest.php
@@ -53,7 +53,7 @@ public function testNumberItem() {
     $entity->field_float = $float;
     $entity->field_decimal = '20-40';
     $violations = $entity->validate();
-    $this->assertIdentical(1, count($violations), 'Wrong decimal value causes validation error');
+    $this->assertCount(1, $violations, 'Wrong decimal value causes validation error');
     $decimal = '31.3';
     $entity->field_decimal = $decimal;
     $entity->name->value = $this->randomMachineName();
diff --git a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php
index fe1c625409141132f62a21176773c27f3e5fdeec..eb29d644a9a23d93bed2aa5a90f2e182a6aea2b5 100644
--- a/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php
+++ b/core/modules/file/tests/src/Functional/FileFieldWidgetTest.php
@@ -399,7 +399,7 @@ public function testWidgetElement() {
     $elements = $this->xpath($xpath);
 
     // If the field has no item, the table should not be visible.
-    $this->assertIdentical(count($elements), 0);
+    $this->assertCount(0, $elements);
 
     // Upload a file.
     $edit['files[' . $field_name . '_0][]'] = $this->container->get('file_system')->realpath($file->getFileUri());
@@ -408,7 +408,7 @@ public function testWidgetElement() {
     $elements = $this->xpath($xpath);
 
     // If the field has at least a item, the table should be visible.
-    $this->assertIdentical(count($elements), 1);
+    $this->assertCount(1, $elements);
 
     // Test for AJAX error when using progress bar on file field widget.
     $http_client = $this->getHttpClient();
diff --git a/core/modules/file/tests/src/Functional/FileListingTest.php b/core/modules/file/tests/src/Functional/FileListingTest.php
index 766456bb3f4cf24f1200e125614ecd8df8b441dd..c0cb7f92b357b81777f442cde555d0069395a76a 100644
--- a/core/modules/file/tests/src/Functional/FileListingTest.php
+++ b/core/modules/file/tests/src/Functional/FileListingTest.php
@@ -134,7 +134,7 @@ public function testFileListingPages() {
     $this->assertRaw('admin/content/files/usage/' . $file->id() . '">' . $usage);
 
     $result = $this->xpath("//td[contains(@class, 'views-field-status') and contains(text(), :value)]", [':value' => 'Temporary']);
-    $this->assertEqual(1, count($result), 'Unused file marked as temporary.');
+    $this->assertCount(1, $result, 'Unused file marked as temporary.');
 
     // Test file usage page.
     foreach ($nodes as $node) {
diff --git a/core/modules/file/tests/src/Functional/FilePrivateTest.php b/core/modules/file/tests/src/Functional/FilePrivateTest.php
index 69f540662b0899b8bfe4d5a769a7492e6a6e8672..9b2a3977634c05423881eda5761a4a0f9b28be9a 100644
--- a/core/modules/file/tests/src/Functional/FilePrivateTest.php
+++ b/core/modules/file/tests/src/Functional/FilePrivateTest.php
@@ -146,7 +146,7 @@ public function testPrivateFile() {
     /** @var \Drupal\file\FileStorageInterface $file_storage */
     $file_storage = $this->container->get('entity_type.manager')->getStorage('file');
     $files = $file_storage->loadByProperties(['uid' => 0]);
-    $this->assertEqual(1, count($files), 'Loaded one anonymous file.');
+    $this->assertCount(1, $files, 'Loaded one anonymous file.');
     $file = end($files);
     $this->assertTrue($file->isTemporary(), 'File is temporary.');
     $usage = $this->container->get('file.usage')->listUsage($file);
diff --git a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php
index 3389ae2151686c1d8510e69922f70c792eb01cbf..6b8211be6aa22e8cade0fab99bca14229fab3f8f 100644
--- a/core/modules/file/tests/src/Functional/SaveUploadFormTest.php
+++ b/core/modules/file/tests/src/Functional/SaveUploadFormTest.php
@@ -487,7 +487,7 @@ public function testCombinedErrorMessages() {
    * Tests highlighting of file upload field when it has an error.
    */
   public function testUploadFieldIsHighlighted() {
-    $this->assertEqual(0, count($this->cssSelect('input[name="files[file_test_upload][]"].error')), 'Successful file upload has no error.');
+    $this->assertCount(0, $this->cssSelect('input[name="files[file_test_upload][]"].error'), 'Successful file upload has no error.');
 
     /** @var \Drupal\Core\File\FileSystemInterface $file_system */
     $file_system = \Drupal::service('file_system');
@@ -498,7 +498,7 @@ public function testUploadFieldIsHighlighted() {
     $this->drupalPostForm('file-test/save_upload_from_form_test', $edit, t('Submit'));
     $this->assertResponse(200, 'Received a 200 response for posted test file.');
     $this->assertRaw(t('Epic upload FAIL!'), 'Found the failure message.');
-    $this->assertEqual(1, count($this->cssSelect('input[name="files[file_test_upload][]"].error')), 'File upload field has error.');
+    $this->assertCount(1, $this->cssSelect('input[name="files[file_test_upload][]"].error'), 'File upload field has error.');
   }
 
 }
diff --git a/core/modules/file/tests/src/Kernel/LoadTest.php b/core/modules/file/tests/src/Kernel/LoadTest.php
index 988a7628bb6e6d3eeb73647a49dd3f6fab6157aa..84de3e391d2db9b7cdf52a7dc591db9cffb8100f 100644
--- a/core/modules/file/tests/src/Kernel/LoadTest.php
+++ b/core/modules/file/tests/src/Kernel/LoadTest.php
@@ -66,7 +66,7 @@ public function testMultiple() {
     file_test_reset();
     $by_path_files = \Drupal::entityTypeManager()->getStorage('file')->loadByProperties(['uri' => $file->getFileUri()]);
     $this->assertFileHookCalled('load');
-    $this->assertEqual(1, count($by_path_files), '\Drupal::entityTypeManager()->getStorage(\'file\')->loadByProperties() returned an array of the correct size.');
+    $this->assertCount(1, $by_path_files, '\Drupal::entityTypeManager()->getStorage(\'file\')->loadByProperties() returned an array of the correct size.');
     $by_path_file = reset($by_path_files);
     $this->assertTrue($by_path_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
     $this->assertEqual($by_path_file->id(), $file->id(), 'Loading by filepath got the correct fid.', 'File');
@@ -75,7 +75,7 @@ public function testMultiple() {
     file_test_reset();
     $by_fid_files = File::loadMultiple([$file->id()]);
     $this->assertFileHooksCalled([]);
-    $this->assertEqual(1, count($by_fid_files), '\Drupal\file\Entity\File::loadMultiple() returned an array of the correct size.');
+    $this->assertCount(1, $by_fid_files, '\Drupal\file\Entity\File::loadMultiple() returned an array of the correct size.');
     $by_fid_file = reset($by_fid_files);
     $this->assertTrue($by_fid_file->file_test['loaded'], 'file_test_file_load() was able to modify the file during load.');
     $this->assertEqual($by_fid_file->getFileUri(), $file->getFileUri(), 'Loading by fid got the correct filepath.', 'File');
diff --git a/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php b/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php
index ddcfb533ed1b6d3b927e1bf2c5fc0e216a945675..d4f37f4d2d6dbd7ef88d0d8bb880579f43e2fad2 100644
--- a/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php
+++ b/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateFileTest.php
@@ -133,7 +133,7 @@ public function testFiles() {
     // then it would have an fid of 9.
     $this->assertNull(File::load(9));
 
-    $this->assertEquals(8, count(File::loadMultiple()));
+    $this->assertCount(8, File::loadMultiple());
   }
 
   /**
diff --git a/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadTest.php b/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadTest.php
index ab054bdf6bd00eda3d7891080274b73ae37a4480..85ec95ec45e0f6d1cf0148807ccbc5f2a1b54637 100644
--- a/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadTest.php
+++ b/core/modules/file/tests/src/Kernel/Migrate/d6/MigrateUploadTest.php
@@ -74,14 +74,14 @@ public function testUpload() {
     $nodes = Node::loadMultiple([1, 2, 12]);
     $node = $nodes[1];
     $this->assertEquals('en', $node->langcode->value);
-    $this->assertIdentical(1, count($node->upload));
+    $this->assertCount(1, $node->upload);
     $this->assertIdentical('1', $node->upload[0]->target_id);
     $this->assertIdentical('file 1-1-1', $node->upload[0]->description);
     $this->assertFalse($node->upload[0]->isDisplayed());
 
     $node = $nodes[2];
     $this->assertEquals('en', $node->langcode->value);
-    $this->assertIdentical(2, count($node->upload));
+    $this->assertCount(2, $node->upload);
     $this->assertIdentical('3', $node->upload[0]->target_id);
     $this->assertIdentical('file 2-3-3', $node->upload[0]->description);
     $this->assertFalse($node->upload[0]->isDisplayed());
@@ -91,7 +91,7 @@ public function testUpload() {
 
     $node = $nodes[12];
     $this->assertEquals('zu', $node->langcode->value);
-    $this->assertEquals(1, count($node->upload));
+    $this->assertCount(1, $node->upload);
     $this->assertEquals('3', $node->upload[0]->target_id);
     $this->assertEquals('file 12-15-3', $node->upload[0]->description);
     $this->assertEquals(FALSE, $node->upload[0]->isDisplayed());
diff --git a/core/modules/file/tests/src/Kernel/SaveTest.php b/core/modules/file/tests/src/Kernel/SaveTest.php
index 73e8b25a53278f3d460ace6d454508fc77590abd..f091566bc3c9baa11e17c4f387489f9f9d29c109 100644
--- a/core/modules/file/tests/src/Kernel/SaveTest.php
+++ b/core/modules/file/tests/src/Kernel/SaveTest.php
@@ -63,14 +63,14 @@ public function testFileSave() {
     $uppercase_file = File::create($uppercase_values);
     file_put_contents($uppercase_file->getFileUri(), 'hello world');
     $violations = $uppercase_file->validate();
-    $this->assertEqual(count($violations), 0, 'No violations when adding an URI with an existing filename in upper case.');
+    $this->assertCount(0, $violations, 'No violations when adding an URI with an existing filename in upper case.');
     $uppercase_file->save();
 
     // Ensure the database URI uniqueness constraint is triggered.
     $uppercase_file_duplicate = File::create($uppercase_values);
     file_put_contents($uppercase_file_duplicate->getFileUri(), 'hello world');
     $violations = $uppercase_file_duplicate->validate();
-    $this->assertEqual(count($violations), 1);
+    $this->assertCount(1, $violations);
     $this->assertEqual($violations[0]->getMessage(), t('The file %value already exists. Enter a unique file URI.', [
       '%value' => $uppercase_file_duplicate->getFileUri(),
     ]));
@@ -79,7 +79,7 @@ public function testFileSave() {
       ->condition('uri', $uppercase_file->getFileUri())
       ->execute();
 
-    $this->assertEqual(1, count($fids));
+    $this->assertCount(1, $fids);
     $this->assertEqual([$uppercase_file->id() => $uppercase_file->id()], $fids);
 
     // Save a file with zero bytes.
diff --git a/core/modules/file/tests/src/Kernel/UsageTest.php b/core/modules/file/tests/src/Kernel/UsageTest.php
index 8dff414218a07912b02f0de8b3ee5bfb3a56c431..043770fc13f057e98dcd53c7d923e7e90f30d6e0 100644
--- a/core/modules/file/tests/src/Kernel/UsageTest.php
+++ b/core/modules/file/tests/src/Kernel/UsageTest.php
@@ -44,7 +44,7 @@ public function testGetUsage() {
 
     $usage = $this->container->get('file.usage')->listUsage($file);
 
-    $this->assertEqual(count($usage['testing']), 2, 'Returned the correct number of items.');
+    $this->assertCount(2, $usage['testing'], 'Returned the correct number of items.');
     $this->assertTrue(isset($usage['testing']['foo'][1]), 'Returned the correct id.');
     $this->assertTrue(isset($usage['testing']['bar'][2]), 'Returned the correct id.');
     $this->assertEqual($usage['testing']['foo'][1], 1, 'Returned the correct count.');
@@ -68,7 +68,7 @@ public function testAddUsage() {
       ->condition('f.fid', $file->id())
       ->execute()
       ->fetchAllAssoc('id');
-    $this->assertEqual(count($usage), 2, 'Created two records');
+    $this->assertCount(2, $usage, 'Created two records');
     $this->assertEqual($usage[1]->module, 'testing', 'Correct module');
     $this->assertEqual($usage[2]->module, 'testing', 'Correct module');
     $this->assertEqual($usage[1]->type, 'foo', 'Correct type');
diff --git a/core/modules/file/tests/src/Kernel/ValidatorTest.php b/core/modules/file/tests/src/Kernel/ValidatorTest.php
index b3d13e25472e83c1f938730f799dd1199161b05c..212c18a234427afe6dbc6fa0cadcae527ae661ff 100644
--- a/core/modules/file/tests/src/Kernel/ValidatorTest.php
+++ b/core/modules/file/tests/src/Kernel/ValidatorTest.php
@@ -45,11 +45,11 @@ protected function setUp(): void {
   public function testFileValidateExtensions() {
     $file = File::create(['filename' => 'asdf.txt']);
     $errors = file_validate_extensions($file, 'asdf txt pork');
-    $this->assertEqual(count($errors), 0, 'Valid extension accepted.', 'File');
+    $this->assertCount(0, $errors, 'Valid extension accepted.');
 
     $file->setFilename('asdf.txt');
     $errors = file_validate_extensions($file, 'exe png');
-    $this->assertEqual(count($errors), 1, 'Invalid extension blocked.', 'File');
+    $this->assertCount(1, $errors, 'Invalid extension blocked.');
   }
 
   /**
@@ -58,11 +58,11 @@ public function testFileValidateExtensions() {
   public function testFileValidateIsImage() {
     $this->assertFileExists($this->image->getFileUri());
     $errors = file_validate_is_image($this->image);
-    $this->assertEqual(count($errors), 0, 'No error reported for our image file.', 'File');
+    $this->assertCount(0, $errors, 'No error reported for our image file.');
 
     $this->assertFileExists($this->nonImage->getFileUri());
     $errors = file_validate_is_image($this->nonImage);
-    $this->assertEqual(count($errors), 1, 'An error reported for our non-image file.', 'File');
+    $this->assertCount(1, $errors, 'An error reported for our non-image file.');
   }
 
   /**
@@ -73,19 +73,19 @@ public function testFileValidateIsImage() {
   public function testFileValidateImageResolution() {
     // Non-images.
     $errors = file_validate_image_resolution($this->nonImage);
-    $this->assertEqual(count($errors), 0, 'Should not get any errors for a non-image file.', 'File');
+    $this->assertCount(0, $errors, 'Should not get any errors for a non-image file.');
     $errors = file_validate_image_resolution($this->nonImage, '50x50', '100x100');
-    $this->assertEqual(count($errors), 0, 'Do not check the resolution on non files.', 'File');
+    $this->assertCount(0, $errors, 'Do not check the resolution on non files.');
 
     // Minimum size.
     $errors = file_validate_image_resolution($this->image);
-    $this->assertEqual(count($errors), 0, 'No errors for an image when there is no minimum or maximum resolution.', 'File');
+    $this->assertCount(0, $errors, 'No errors for an image when there is no minimum or maximum resolution.');
     $errors = file_validate_image_resolution($this->image, 0, '200x1');
-    $this->assertEqual(count($errors), 1, 'Got an error for an image that was not wide enough.', 'File');
+    $this->assertCount(1, $errors, 'Got an error for an image that was not wide enough.');
     $errors = file_validate_image_resolution($this->image, 0, '1x200');
-    $this->assertEqual(count($errors), 1, 'Got an error for an image that was not tall enough.', 'File');
+    $this->assertCount(1, $errors, 'Got an error for an image that was not tall enough.');
     $errors = file_validate_image_resolution($this->image, 0, '200x200');
-    $this->assertEqual(count($errors), 1, 'Small images report an error.', 'File');
+    $this->assertCount(1, $errors, 'Small images report an error.');
 
     // Maximum size.
     if ($this->container->get('image.factory')->getToolkitId()) {
@@ -94,7 +94,7 @@ public function testFileValidateImageResolution() {
       $this->image->setFileUri('temporary://druplicon.png');
 
       $errors = file_validate_image_resolution($this->image, '10x5');
-      $this->assertEqual(count($errors), 0, 'No errors should be reported when an oversized image can be scaled down.', 'File');
+      $this->assertCount(0, $errors, 'No errors should be reported when an oversized image can be scaled down.');
 
       $image = $this->container->get('image.factory')->get($this->image->getFileUri());
       $this->assertTrue($image->getWidth() <= 10, 'Image scaled to correct width.', 'File');
@@ -104,14 +104,14 @@ public function testFileValidateImageResolution() {
       copy('core/misc/druplicon.png', 'temporary://druplicon.png');
       $this->image->setFileUri('temporary://druplicon.png');
       $errors = file_validate_image_resolution($this->image, '-10x-5');
-      $this->assertEqual(count($errors), 1, 'An error reported for an oversized image that can not be scaled down.', 'File');
+      $this->assertCount(1, $errors, 'An error reported for an oversized image that can not be scaled down.');
 
       \Drupal::service('file_system')->unlink('temporary://druplicon.png');
     }
     else {
       // TODO: should check that the error is returned if no toolkit is available.
       $errors = file_validate_image_resolution($this->image, '5x10');
-      $this->assertEqual(count($errors), 1, 'Oversize images that cannot be scaled get an error.', 'File');
+      $this->assertCount(1, $errors, 'Oversize images that cannot be scaled get an error.');
     }
   }
 
@@ -126,17 +126,17 @@ public function testFileValidateNameLength() {
     $file->setFilename(str_repeat('x', 240));
     $this->assertEqual(strlen($file->getFilename()), 240);
     $errors = file_validate_name_length($file);
-    $this->assertEqual(count($errors), 0, 'No errors reported for 240 length filename.', 'File');
+    $this->assertCount(0, $errors, 'No errors reported for 240 length filename.');
 
     // Add a filename with a length too long and test it.
     $file->setFilename(str_repeat('x', 241));
     $errors = file_validate_name_length($file);
-    $this->assertEqual(count($errors), 1, 'An error reported for 241 length filename.', 'File');
+    $this->assertCount(1, $errors, 'An error reported for 241 length filename.');
 
     // Add a filename with an empty string and test it.
     $file->setFilename('');
     $errors = file_validate_name_length($file);
-    $this->assertEqual(count($errors), 1, 'An error reported for 0 length filename.', 'File');
+    $this->assertCount(1, $errors, 'An error reported for 0 length filename.');
   }
 
   /**
@@ -146,13 +146,13 @@ public function testFileValidateSize() {
     // Create a file with a size of 1000 bytes, and quotas of only 1 byte.
     $file = File::create(['filesize' => 1000]);
     $errors = file_validate_size($file, 0, 0);
-    $this->assertEqual(count($errors), 0, 'No limits means no errors.', 'File');
+    $this->assertCount(0, $errors, 'No limits means no errors.');
     $errors = file_validate_size($file, 1, 0);
-    $this->assertEqual(count($errors), 1, 'Error for the file being over the limit.', 'File');
+    $this->assertCount(1, $errors, 'Error for the file being over the limit.');
     $errors = file_validate_size($file, 0, 1);
-    $this->assertEqual(count($errors), 1, 'Error for the user being over their limit.', 'File');
+    $this->assertCount(1, $errors, 'Error for the user being over their limit.');
     $errors = file_validate_size($file, 1, 1);
-    $this->assertEqual(count($errors), 2, 'Errors for both the file and their limit.', 'File');
+    $this->assertCount(2, $errors, 'Errors for both the file and their limit.');
   }
 
 }
diff --git a/core/modules/filter/tests/src/Kernel/FilterAPITest.php b/core/modules/filter/tests/src/Kernel/FilterAPITest.php
index 50cc6d5c95f76f6f16806111c72da95e8dc4f69b..833e47491d8ba675b2c4a9fe9af718fff0acbb2e 100644
--- a/core/modules/filter/tests/src/Kernel/FilterAPITest.php
+++ b/core/modules/filter/tests/src/Kernel/FilterAPITest.php
@@ -374,7 +374,7 @@ public function testTypedDataAPI() {
 
     $data->setValue('plain_text');
     $violations = $data->validate();
-    $this->assertEqual(count($violations), 0, "No validation violation for format 'plain_text' found");
+    $this->assertCount(0, $violations, "No validation violation for format 'plain_text' found");
 
     // Anonymous doesn't have access to the 'filtered_html' format.
     $data->setValue('filtered_html');
@@ -384,7 +384,7 @@ public function testTypedDataAPI() {
     // Set user with access to 'filtered_html' format.
     \Drupal::currentUser()->setAccount($filtered_html_user);
     $violations = $data->validate();
-    $this->assertEqual(count($violations), 0, "No validation violation for accessible format 'filtered_html' found.");
+    $this->assertCount(0, $violations, "No validation violation for accessible format 'filtered_html' found.");
 
     $allowed_values = $data->getSettableValues($filtered_html_user);
     $this->assertEqual($allowed_values, ['filtered_html', 'plain_text']);
diff --git a/core/modules/forum/tests/src/Kernel/ForumValidationTest.php b/core/modules/forum/tests/src/Kernel/ForumValidationTest.php
index 5126f285f80651615de2fa012fa8ab688f6c2cf8..d7fef86c4b5269dab530ceb960bfea6d09121db3 100644
--- a/core/modules/forum/tests/src/Kernel/ForumValidationTest.php
+++ b/core/modules/forum/tests/src/Kernel/ForumValidationTest.php
@@ -51,18 +51,18 @@ public function testValidation() {
     ]);
 
     $violations = $forum_post->validate();
-    $this->assertEqual(count($violations), 1);
+    $this->assertCount(1, $violations);
     $this->assertEqual($violations[0]->getMessage(), 'This value should not be null.');
 
     // Add the forum term.
     $forum_post->set('taxonomy_forums', $forum);
     $violations = $forum_post->validate();
-    $this->assertEqual(count($violations), 0);
+    $this->assertCount(0, $violations);
 
     // Try to use a container.
     $forum_post->set('taxonomy_forums', $container);
     $violations = $forum_post->validate();
-    $this->assertEqual(count($violations), 1);
+    $this->assertCount(1, $violations);
     $this->assertEqual($violations[0]->getMessage(), t('The item %forum is a forum container, not a forum. Select one of the forums below instead.', [
       '%forum' => $container->label(),
     ]));
diff --git a/core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php b/core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php
index f004f49846cdf17d042374397fc907e3592799e6..99705f554bee3bd5b9c83a9dea7b901c16d29e73 100644
--- a/core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php
+++ b/core/modules/help_topics/tests/src/Unit/HelpTopicTwigLoaderTest.php
@@ -47,7 +47,7 @@ public function testConstructor() {
     // Verify that the module/theme directories were added in the constructor,
     // and non-existent directories were omitted.
     $paths = $this->helpLoader->getPaths(HelpTopicTwigLoader::MAIN_NAMESPACE);
-    $this->assertEquals(count($paths), 2);
+    $this->assertCount(2, $paths);
     $this->assertTrue(in_array($this->directories['module']['test'] . '/help_topics', $paths));
     $this->assertTrue(in_array($this->directories['theme']['test'] . '/help_topics', $paths));
   }
diff --git a/core/modules/history/tests/src/Kernel/Views/HistoryTimestampTest.php b/core/modules/history/tests/src/Kernel/Views/HistoryTimestampTest.php
index 6a5e7121f6f2a4662c3f144f4b3468a74242cf82..ddcb064c0fe7f9624108af94a239db90cfa58f9c 100644
--- a/core/modules/history/tests/src/Kernel/Views/HistoryTimestampTest.php
+++ b/core/modules/history/tests/src/Kernel/Views/HistoryTimestampTest.php
@@ -91,17 +91,17 @@ public function testHandlers() {
     $view = Views::getView('test_history');
     $view->setDisplay('page_1');
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 2);
+    $this->assertCount(2, $view->result);
     $output = $view->preview();
     $this->setRawContent(\Drupal::service('renderer')->renderRoot($output));
     $result = $this->xpath('//span[@class=:class]', [':class' => 'marker']);
-    $this->assertEqual(count($result), 1, 'Just one node is marked as new');
+    $this->assertCount(1, $result, 'Just one node is marked as new');
 
     // Test the history filter.
     $view = Views::getView('test_history');
     $view->setDisplay('page_2');
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 1);
+    $this->assertCount(1, $view->result);
     $this->assertIdenticalResultset($view, [['nid' => $nodes[0]->id()]], $column_map);
 
     // Install Comment module and make sure that content types without comment
diff --git a/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php
index ca7f31a5baefa536cfba4bbb31e3f8e8993652db..2ada4e1b40d3df87864681b4f5a9d6d4a10579d2 100644
--- a/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php
+++ b/core/modules/image/tests/src/Functional/ImageAdminStylesTest.php
@@ -278,7 +278,7 @@ public function testStyle() {
     $this->drupalPostForm(NULL, $edit, t('Add effect'));
     $entity_type_manager = $this->container->get('entity_type.manager');
     $style = $entity_type_manager->getStorage('image_style')->loadUnchanged($style_name);
-    $this->assertEqual(count($style->getEffects()), 6, 'Rotate effect with transparent background was added.');
+    $this->assertCount(6, $style->getEffects(), 'Rotate effect with transparent background was added.');
 
     // Style deletion form.
 
diff --git a/core/modules/image/tests/src/Functional/ImageEffectsTest.php b/core/modules/image/tests/src/Functional/ImageEffectsTest.php
index d8c1500abeb2f01e7ea3745d4beee6d51236faa6..3a2a1e16ba421795c459e91cd14a758031dbf9c8 100644
--- a/core/modules/image/tests/src/Functional/ImageEffectsTest.php
+++ b/core/modules/image/tests/src/Functional/ImageEffectsTest.php
@@ -150,7 +150,7 @@ public function testDesaturateEffect() {
 
     // Check the parameters.
     $calls = $this->imageTestGetAllCalls();
-    $this->assertEqual(count($calls['desaturate'][0]), 0, 'No parameters were passed.');
+    $this->assertCount(0, $calls['desaturate'][0], 'No parameters were passed.');
   }
 
   /**
diff --git a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php
index 9424eb253f070def3fc71a89686d8a0bbaacd531..e435e1792b0e137c3d65de626580ad8a26d660d6 100644
--- a/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php
+++ b/core/modules/image/tests/src/Functional/ImageFieldDisplayTest.php
@@ -185,7 +185,7 @@ public function _testImageFieldFormatters($scheme) {
         ':alt' => $alt,
       ]
     );
-    $this->assertEqual(count($elements), 1, 'Image linked to content formatter displaying correctly on full node view.');
+    $this->assertCount(1, $elements, 'Image linked to content formatter displaying correctly on full node view.');
 
     // Test the image style 'thumbnail' formatter.
     $display_options['settings']['image_link'] = '';
diff --git a/core/modules/image/tests/src/Functional/ImageFieldWidgetTest.php b/core/modules/image/tests/src/Functional/ImageFieldWidgetTest.php
index 655e7ab8a8926992034d6f7fbee45ed03bd04e01..451beee9a6ac050b6531847b7d2133543f216084 100644
--- a/core/modules/image/tests/src/Functional/ImageFieldWidgetTest.php
+++ b/core/modules/image/tests/src/Functional/ImageFieldWidgetTest.php
@@ -31,8 +31,8 @@ public function testWidgetElement() {
     ];
     $this->createImageField($field_name, 'article', [], $field_settings, [], [], 'Image test on [site:name]');
     $this->drupalGet('node/add/article');
-    $this->assertNotEqual(0, count($this->xpath('//div[contains(@class, "field--widget-image-image")]')), 'Image field widget found on add/node page', 'Browser');
-    $this->assertNotEqual(0, count($this->xpath('//input[contains(@accept, "image/*")]')), 'Image field widget limits accepted files.', 'Browser');
+    $this->assertNotCount(0, $this->xpath('//div[contains(@class, "field--widget-image-image")]'), 'Image field widget found on add/node page', NULL);
+    $this->assertNotCount(0, $this->xpath('//input[contains(@accept, "image/*")]'), 'Image field widget limits accepted files.', NULL);
     $this->assertNoText('Image test on [site:name]');
 
     // Check for allowed image file extensions - default.
diff --git a/core/modules/image/tests/src/FunctionalJavascript/ImageFieldValidateTest.php b/core/modules/image/tests/src/FunctionalJavascript/ImageFieldValidateTest.php
index a8907d74c99173eb6244c7129bddc8da6eae313b..397e6db97ed17fad5e9ee6489b6e76227ac0d4a8 100644
--- a/core/modules/image/tests/src/FunctionalJavascript/ImageFieldValidateTest.php
+++ b/core/modules/image/tests/src/FunctionalJavascript/ImageFieldValidateTest.php
@@ -36,7 +36,7 @@ public function testAJAXValidationMessage() {
     $elements = $this->xpath('//div[contains(@class, :class)]', [
       ':class' => 'messages--error',
     ]);
-    $this->assertEqual(count($elements), 1, 'Ajax validation messages are displayed once.');
+    $this->assertCount(1, $elements, 'Ajax validation messages are displayed once.');
   }
 
   /**
diff --git a/core/modules/image/tests/src/Kernel/ImageImportTest.php b/core/modules/image/tests/src/Kernel/ImageImportTest.php
index 5d013d3135f30aaf004b32c8cdf8a995dd4c818a..9cd8700d6173df6fdaad4a6f5318eaa29b525305 100644
--- a/core/modules/image/tests/src/Kernel/ImageImportTest.php
+++ b/core/modules/image/tests/src/Kernel/ImageImportTest.php
@@ -29,7 +29,7 @@ public function testImport() {
     $style->addImageEffect(['id' => 'image_module_test_null']);
     $style->save();
 
-    $this->assertEqual(count($style->getEffects()), 2);
+    $this->assertCount(2, $style->getEffects());
 
     $uuid = \Drupal::service('uuid')->generate();
     $style->set('effects', [
@@ -40,7 +40,7 @@ public function testImport() {
     $style->save();
 
     $style = ImageStyle::load('test');
-    $this->assertEqual(count($style->getEffects()), 1);
+    $this->assertCount(1, $style->getEffects());
   }
 
 }
diff --git a/core/modules/image/tests/src/Kernel/ImageThemeFunctionTest.php b/core/modules/image/tests/src/Kernel/ImageThemeFunctionTest.php
index 9fabb99796c607a08fc76413d57a9ac1938ad5e4..1ef1942be3887f95af4d482ca75ab2304f0dc14f 100644
--- a/core/modules/image/tests/src/Kernel/ImageThemeFunctionTest.php
+++ b/core/modules/image/tests/src/Kernel/ImageThemeFunctionTest.php
@@ -116,7 +116,7 @@ public function testImageFormatterTheme() {
     $element = $base_element;
     $this->setRawContent($renderer->renderRoot($element));
     $elements = $this->xpath('//a[@href=:path]/img[@src=:url and @width=:width and @height=:height]', [':path' => base_path() . $path, ':url' => $url, ':width' => $image->getWidth(), ':height' => $image->getHeight()]);
-    $this->assertEqual(count($elements), 1, 'theme_image_formatter() correctly renders with a NULL value for the alt option.');
+    $this->assertCount(1, $elements, 'theme_image_formatter() correctly renders with a NULL value for the alt option.');
 
     // Test using theme_image_formatter() without an image title, alt text, or
     // link options.
@@ -124,7 +124,7 @@ public function testImageFormatterTheme() {
     $element['#item']->alt = '';
     $this->setRawContent($renderer->renderRoot($element));
     $elements = $this->xpath('//a[@href=:path]/img[@src=:url and @width=:width and @height=:height and @alt=""]', [':path' => base_path() . $path, ':url' => $url, ':width' => $image->getWidth(), ':height' => $image->getHeight()]);
-    $this->assertEqual(count($elements), 1, 'theme_image_formatter() correctly renders without title, alt, or path options.');
+    $this->assertCount(1, $elements, 'theme_image_formatter() correctly renders without title, alt, or path options.');
 
     // Link the image to a fragment on the page, and not a full URL.
     $fragment = $this->randomMachineName();
@@ -137,7 +137,7 @@ public function testImageFormatterTheme() {
       ':width' => $image->getWidth(),
       ':height' => $image->getHeight(),
     ]);
-    $this->assertEqual(count($elements), 1, 'theme_image_formatter() correctly renders a link fragment.');
+    $this->assertCount(1, $elements, 'theme_image_formatter() correctly renders a link fragment.');
   }
 
   /**
@@ -167,14 +167,14 @@ public function testImageStyleTheme() {
     $element = $base_element;
     $this->setRawContent($renderer->renderRoot($element));
     $elements = $this->xpath('//img[@src=:url and @alt=""]', [':url' => $url]);
-    $this->assertEqual(count($elements), 1, 'theme_image_style() renders an image correctly.');
+    $this->assertCount(1, $elements, 'theme_image_style() renders an image correctly.');
 
     // Test using theme_image_style() with a NULL value for the alt option.
     $element = $base_element;
     $element['#alt'] = NULL;
     $this->setRawContent($renderer->renderRoot($element));
     $elements = $this->xpath('//img[@src=:url]', [':url' => $url]);
-    $this->assertEqual(count($elements), 1, 'theme_image_style() renders an image correctly with a NULL value for the alt option.');
+    $this->assertCount(1, $elements, 'theme_image_style() renders an image correctly with a NULL value for the alt option.');
   }
 
   /**
@@ -197,7 +197,7 @@ public function testImageAltFunctionality() {
 
     $this->setRawContent($renderer->renderRoot($image_with_alt_property));
     $elements = $this->xpath('//img[contains(@class, class) and contains(@alt, :alt)]', [":class" => "image-with-regular-alt", ":alt" => "Regular alt"]);
-    $this->assertEqual(count($elements), 1, 'Regular alt displays correctly');
+    $this->assertCount(1, $elements, 'Regular alt displays correctly');
 
     // Test using alt attribute inside attributes.
     $image_with_alt_attribute_alt_attribute = [
@@ -215,7 +215,7 @@ public function testImageAltFunctionality() {
 
     $this->setRawContent($renderer->renderRoot($image_with_alt_attribute_alt_attribute));
     $elements = $this->xpath('//img[contains(@class, class) and contains(@alt, :alt)]', [":class" => "image-with-attribute-alt", ":alt" => "Attribute alt"]);
-    $this->assertEqual(count($elements), 1, 'Attribute alt displays correctly');
+    $this->assertCount(1, $elements, 'Attribute alt displays correctly');
 
     // Test using alt attribute as property and inside attributes.
     $image_with_alt_attribute_both = [
@@ -234,7 +234,7 @@ public function testImageAltFunctionality() {
 
     $this->setRawContent($renderer->renderRoot($image_with_alt_attribute_both));
     $elements = $this->xpath('//img[contains(@class, class) and contains(@alt, :alt)]', [":class" => "image-with-attribute-alt", ":alt" => "Attribute alt"]);
-    $this->assertEqual(count($elements), 1, 'Attribute alt overrides alt property if both set.');
+    $this->assertCount(1, $elements, 'Attribute alt overrides alt property if both set.');
   }
 
 }
diff --git a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
index 93375cd1f7f0e60117222202ba2a7797a68654c7..f5016f6e31fdc663efd836819e156babaf6ec826 100644
--- a/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
+++ b/core/modules/jsonapi/tests/src/Functional/JsonApiFunctionalTest.php
@@ -48,7 +48,7 @@ public function testRead() {
       'query' => $default_sort,
     ]));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertEquals(OffsetPage::SIZE_MAX, count($collection_output['data']));
+    $this->assertCount(OffsetPage::SIZE_MAX, $collection_output['data']);
     $this->assertSession()
       ->responseHeaderEquals('Content-Type', 'application/vnd.api+json');
     // 2. Load all articles (Offset 3).
@@ -56,14 +56,14 @@ public function testRead() {
       'query' => ['page' => ['offset' => 3]] + $default_sort,
     ]));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertEquals(OffsetPage::SIZE_MAX, count($collection_output['data']));
+    $this->assertCount(OffsetPage::SIZE_MAX, $collection_output['data']);
     $this->assertStringContainsString('page%5Boffset%5D=53', $collection_output['links']['next']['href']);
     // 3. Load all articles (1st page, 2 items)
     $collection_output = Json::decode($this->drupalGet('/jsonapi/node/article', [
       'query' => ['page' => ['limit' => 2]] + $default_sort,
     ]));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertEquals(2, count($collection_output['data']));
+    $this->assertCount(2, $collection_output['data']);
     // 4. Load all articles (2nd page, 2 items).
     $collection_output = Json::decode($this->drupalGet('/jsonapi/node/article', [
       'query' => [
@@ -74,7 +74,7 @@ public function testRead() {
       ] + $default_sort,
     ]));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertEquals(2, count($collection_output['data']));
+    $this->assertCount(2, $collection_output['data']);
     $this->assertStringContainsString('page%5Boffset%5D=4', $collection_output['links']['next']['href']);
     // 5. Single article.
     $uuid = $this->nodes[0]->uuid();
@@ -189,10 +189,11 @@ public function testRead() {
       'query' => ['page' => ['limit' => 2]] + $default_sort,
     ]));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertEquals(1, count($single_output['data']));
-    $this->assertEquals(1, count(array_filter(array_keys($single_output['meta']['omitted']['links']), function ($key) {
+    $this->assertCount(1, $single_output['data']);
+    $non_help_links = array_filter(array_keys($single_output['meta']['omitted']['links']), function ($key) {
       return $key !== 'help';
-    })));
+    });
+    $this->assertCount(1, $non_help_links);
     $link_keys = array_keys($single_output['meta']['omitted']['links']);
     $this->assertSame('help', reset($link_keys));
     $this->assertRegExp('/^item--[a-zA-Z0-9]{7}$/', next($link_keys));
@@ -511,7 +512,7 @@ public function testRead() {
       'query' => ['filter' => $filter] + $default_sort,
     ]));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertEquals(0, count($collection_output['data']));
+    $this->assertCount(0, $collection_output['data']);
   }
 
   /**
@@ -523,7 +524,7 @@ public function testReferencingTwiceRead() {
     // 1. Load all articles (1st page).
     $collection_output = Json::decode($this->drupalGet('/jsonapi/node/article'));
     $this->assertSession()->statusCodeEquals(200);
-    $this->assertEquals(1, count($collection_output['data']));
+    $this->assertCount(1, $collection_output['data']);
     $this->assertSession()
       ->responseHeaderEquals('Content-Type', 'application/vnd.api+json');
   }
@@ -575,7 +576,7 @@ public function testWrite() {
     $this->assertEquals(201, $response->getStatusCode());
     $this->assertArrayNotHasKey('uuid', $created_response['data']['attributes']);
     $uuid = $created_response['data']['id'];
-    $this->assertEquals(2, count($created_response['data']['relationships']['field_tags']['data']));
+    $this->assertCount(2, $created_response['data']['relationships']['field_tags']['data']);
     $this->assertEquals($created_response['data']['links']['self']['href'], $response->getHeader('Location')[0]);
 
     // 2. Authorization error.
@@ -773,7 +774,7 @@ public function testWrite() {
     ]);
     $updated_response = Json::decode($response->getBody()->__toString());
     $this->assertEquals(200, $response->getStatusCode());
-    $this->assertEquals(3, count($updated_response['data']));
+    $this->assertCount(3, $updated_response['data']);
     $this->assertEquals('taxonomy_term--tags', $updated_response['data'][2]['type']);
     $this->assertEquals($this->tags[2]->uuid(), $updated_response['data'][2]['id']);
     // 10. Successful PATCH to related endpoint.
diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/AjaxBlockTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/AjaxBlockTest.php
index 65d6e640074597d9a5566e2038cc25d71fe659a2..22a7072ffe81393869ba208e9efdd4c3afe73daa 100644
--- a/core/modules/layout_builder/tests/src/FunctionalJavascript/AjaxBlockTest.php
+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/AjaxBlockTest.php
@@ -95,7 +95,7 @@ public function testAddAjaxBlock() {
     $assert_session->assertWaitOnAjaxRequest();
     $block_elements = $this->cssSelect('.block-layout-builder-test-testajax');
     // Should be exactly one of these in there.
-    $this->assertEquals(1, count($block_elements));
+    $this->assertCount(1, $block_elements);
     $assert_session->pageTextContains('Every word is like an unnecessary stain on silence and nothingness.');
   }
 
diff --git a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
index 00bae93cdf84cd08f3b29319dda618c3080e3f96..d266386130ce225147bc86bc1a858948d0577342 100644
--- a/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
+++ b/core/modules/layout_builder/tests/src/FunctionalJavascript/InlineBlockTest.php
@@ -141,7 +141,7 @@ public function testNoLayoutSave($operation, $no_save_button_text, $confirm_butt
     $this->drupalGet('node/1');
     $assert_session->pageTextContains('The block body');
     $blocks = $this->blockStorage->loadMultiple();
-    $this->assertEquals(count($blocks), 1);
+    $this->assertCount(1, $blocks);
     /* @var \Drupal\Core\Entity\ContentEntityBase $block */
     $block = array_pop($blocks);
     $revision_id = $block->getRevisionId();
@@ -163,7 +163,7 @@ public function testNoLayoutSave($operation, $no_save_button_text, $confirm_butt
       // When discarding the original block body should appear.
       $assert_session->pageTextContains('The block body');
 
-      $this->assertEquals(count($blocks), 1);
+      $this->assertCount(1, $blocks);
       $block = array_pop($blocks);
       $this->assertEquals($block->getRevisionId(), $revision_id);
       $this->assertEquals($block->get('body')->getValue()[0]['value'], 'The block body');
diff --git a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php
index 6feef63eaaf6e89ff822565f284739fd50e54e33..9e2f53e269d84a57fbfb23d3a95be743b8be3a2e 100644
--- a/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php
+++ b/core/modules/locale/tests/src/Functional/LocaleConfigTranslationTest.php
@@ -90,7 +90,7 @@ public function testConfigTranslation() {
 
     // Get translation and check we've only got the message.
     $translation = \Drupal::languageManager()->getLanguageConfigOverride($this->langcode, 'system.maintenance')->get();
-    $this->assertEqual(count($translation), 1, 'Got the right number of properties after translation.');
+    $this->assertCount(1, $translation, 'Got the right number of properties after translation.');
     $this->assertEqual($translation['message'], $message);
 
     // Check default medium date format exists and create a translation for it.
@@ -135,7 +135,7 @@ public function testConfigTranslation() {
 
     // Check the string is unique and has no translation yet.
     $translations = $this->storage->getTranslations(['language' => $this->langcode, 'type' => 'configuration', 'name' => 'image.style.medium']);
-    $this->assertEqual(count($translations), 1);
+    $this->assertCount(1, $translations);
     $translation = reset($translations);
     $this->assertEqual($translation->source, $string->source);
     $this->assertEmpty($translation->translation);
diff --git a/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php b/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
index fb7c9c5bf2fc5bea7fe7b9ff5c0617174b796395..c3d1fed48423dd592798df2a319237c77c975b41 100644
--- a/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
+++ b/core/modules/locale/tests/src/Kernel/LocaleConfigSubscriberTest.php
@@ -470,7 +470,7 @@ protected function assertTranslation($config_name, $translation, $langcode, $cus
       'language' => $langcode,
       'translated' => TRUE,
     ]);
-    $this->assertIdentical(1, count($strings));
+    $this->assertCount(1, $strings);
     $string = reset($strings);
     $this->assertInstanceOf(StringInterface::class, $string);
     /** @var \Drupal\locale\StringInterface $string */
diff --git a/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php b/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php
index c0b25dfa26bbfa4c303ca95ad88c8e6eb8e9b84e..adc4dd1284d2ca25cba55a07f0de333255b193a2 100644
--- a/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php
+++ b/core/modules/media/tests/src/FunctionalJavascript/MediaDisplayTest.php
@@ -102,7 +102,7 @@ public function testMediaDisplay() {
     $assert_session->elementTextContains('css', 'h1', $image_media_name);
     // Here we expect to see only the image, nothing else.
     // Assert only one element in the content region.
-    $this->assertSame(1, count($page->findAll('css', '.media--type-image > div')));
+    $this->assertCount(1, $page->findAll('css', '.media--type-image > div'));
     // Assert the image is present inside the media element.
     $media_item = $assert_session->elementExists('css', '.media--type-image > div');
     $assert_session->elementExists('css', 'img', $media_item);
@@ -131,7 +131,7 @@ public function testMediaDisplay() {
     $assert_session->elementTextContains('css', 'h1', $test_filename);
     // Here we expect to see only the linked filename.
     // Assert only one element in the content region.
-    $this->assertSame(1, count($page->findAll('css', 'article.media--type-document > div')));
+    $this->assertCount(1, $page->findAll('css', 'article.media--type-document > div'));
     // Assert the file link is present, and its text matches the filename.
     $assert_session->elementExists('css', 'article.media--type-document .field--name-field-media-document a');
     $link = $page->find('css', 'article.media--type-document .field--name-field-media-document a');
@@ -195,7 +195,7 @@ public function testMediaDisplay() {
     $assert_session->elementNotExists('css', '.field--name-name');
     $assert_session->pageTextNotContains($image_media_name);
     // Only one element is present inside the media container.
-    $this->assertSame(1, count($page->findAll('css', '.field--name-field-related-media article.media--type-image > div')));
+    $this->assertCount(1, $page->findAll('css', '.field--name-field-related-media article.media--type-image > div'));
     // Assert the image is present.
     $assert_session->elementExists('css', '.field--name-field-related-media article.media--type-image img');
   }
diff --git a/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentDeriverTest.php b/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentDeriverTest.php
index 3708277587e9811bdf7a03a3e5029c4bb04f82da..d5486babf657b7c1317548c4a95cdb5ba94e1a6a 100644
--- a/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentDeriverTest.php
+++ b/core/modules/menu_link_content/tests/src/Kernel/MenuLinkContentDeriverTest.php
@@ -53,7 +53,7 @@ public function testRediscover() {
     ]);
     $parent->save();
     $menu_tree = \Drupal::menuTree()->load('tools', new MenuTreeParameters());
-    $this->assertEqual(1, count($menu_tree));
+    $this->assertCount(1, $menu_tree);
     /** @var \Drupal\Core\Menu\MenuLinkTreeElement $tree_element */
     $tree_element = reset($menu_tree);
     $this->assertEqual('route_name_1', $tree_element->link->getRouteName());
@@ -66,7 +66,7 @@ public function testRediscover() {
 
     // Ensure that the new route name / parameters are captured by the tree.
     $menu_tree = \Drupal::menuTree()->load('tools', new MenuTreeParameters());
-    $this->assertEqual(1, count($menu_tree));
+    $this->assertCount(1, $menu_tree);
     /** @var \Drupal\Core\Menu\MenuLinkTreeElement $tree_element */
     $tree_element = reset($menu_tree);
     $this->assertEqual('route_name_2', $tree_element->link->getRouteName());
@@ -89,11 +89,11 @@ public function testRediscover() {
     $parent->set('link', [['uri' => 'entity:/example-path']]);
     $parent->save();
     $menu_tree = \Drupal::menuTree()->load('tools', new MenuTreeParameters());
-    $this->assertEqual(1, count($menu_tree));
+    $this->assertCount(1, $menu_tree);
     /** @var \Drupal\Core\Menu\MenuLinkTreeElement $tree_element */
     $tree_element = reset($menu_tree);
     $this->assertTrue($tree_element->hasChildren);
-    $this->assertEqual(1, count($tree_element->subtree));
+    $this->assertCount(1, $tree_element->subtree);
 
     // Edit child element link to use 'internal' instead of 'entity'.
     $child->set('link', [['uri' => 'internal:/example-path/child']]);
@@ -101,11 +101,11 @@ public function testRediscover() {
     \Drupal::service('plugin.manager.menu.link')->rebuild();
 
     $menu_tree = \Drupal::menuTree()->load('tools', new MenuTreeParameters());
-    $this->assertEqual(1, count($menu_tree));
+    $this->assertCount(1, $menu_tree);
     /** @var \Drupal\Core\Menu\MenuLinkTreeElement $tree_element */
     $tree_element = reset($menu_tree);
     $this->assertTrue($tree_element->hasChildren);
-    $this->assertEqual(1, count($tree_element->subtree));
+    $this->assertCount(1, $tree_element->subtree);
   }
 
 }
diff --git a/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php b/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php
index 76dd96375cd4248aeacf3d7c9979d8d5d474e928..44cec60612357e2f701211b4b0beb6f0a3a04435 100644
--- a/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php
+++ b/core/modules/menu_link_content/tests/src/Kernel/MenuLinksTest.php
@@ -305,7 +305,7 @@ public function testModuleUninstalledMenuLinks() {
     \Drupal::service('router.builder')->rebuild();
     \Drupal::service('plugin.manager.menu.link')->rebuild();
     $menu_links = $this->menuLinkManager->loadLinksByRoute('menu_test.menu_test');
-    $this->assertEqual(count($menu_links), 1);
+    $this->assertCount(1, $menu_links);
     $menu_link = reset($menu_links);
     $this->assertEqual($menu_link->getPluginId(), 'menu_test');
 
@@ -313,7 +313,7 @@ public function testModuleUninstalledMenuLinks() {
     \Drupal::service('module_installer')->uninstall(['menu_test']);
     \Drupal::service('plugin.manager.menu.link')->rebuild();
     $menu_links = $this->menuLinkManager->loadLinksByRoute('menu_test.menu_test');
-    $this->assertEqual(count($menu_links), 0);
+    $this->assertCount(0, $menu_links);
   }
 
   /**
diff --git a/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php b/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php
index 3e36b8aeb44e552bfadb9c734b30179da5d1a0c6..3a80b84cd23e29bee937057c16ce0c0d85f6ae0d 100644
--- a/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php
+++ b/core/modules/migrate/tests/src/Kernel/MigrateExternalTranslatedTest.php
@@ -56,12 +56,12 @@ public function setUp(): void {
   public function testMigrations() {
     /** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */
     $storage = $this->container->get('entity_type.manager')->getStorage('node');
-    $this->assertEquals(0, count($storage->loadMultiple()));
+    $this->assertCount(0, $storage->loadMultiple());
 
     // Run the migrations.
     $migration_ids = ['external_translated_test_node', 'external_translated_test_node_translation'];
     $this->executeMigrations($migration_ids);
-    $this->assertEquals(3, count($storage->loadMultiple()));
+    $this->assertCount(3, $storage->loadMultiple());
 
     $node = $storage->load(1);
     $this->assertEquals('en', $node->language()->getId());
@@ -90,7 +90,7 @@ public function testMigrations() {
       $executable->rollback();
     }
 
-    $this->assertEquals(0, count($storage->loadMultiple()));
+    $this->assertCount(0, $storage->loadMultiple());
   }
 
 }
diff --git a/core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php b/core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php
index 1ef0d752c8415b3f52d456463927d5405dd15086..c4d39a3dad5299b0c824f87c5a42ddc6e8defcdb 100644
--- a/core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php
+++ b/core/modules/migrate/tests/src/Kernel/MigrateMessageTest.php
@@ -81,7 +81,7 @@ public function testMessagesNotTeed() {
     // We don't ask for messages to be teed, so don't expect any.
     $executable = new MigrateExecutable($this->migration, $this);
     $executable->import();
-    $this->assertIdentical(count($this->messages), 0);
+    $this->assertCount(0, $this->messages);
   }
 
   /**
@@ -93,7 +93,7 @@ public function testMessagesTeed() {
       [$this, 'mapMessageRecorder']);
     $executable = new MigrateExecutable($this->migration, $this);
     $executable->import();
-    $this->assertIdentical(count($this->messages), 1);
+    $this->assertCount(1, $this->messages);
     $this->assertIdentical(reset($this->messages), "source_message: 'a message' is not an array");
   }
 
diff --git a/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php b/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
index ae135932f9945391e616ede0162fbb6120a7e8da..cd27e105975d7ae99958f3f66d6841eef2f00946 100644
--- a/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrateSqlIdMapTest.php
@@ -427,7 +427,7 @@ public function testLookupDestinationIdMapping($num_source_fields, $num_destinat
     $this->assertSame([$expected_result], $destination_ids);
     // Test for a miss.
     $destination_ids = $id_map->lookupDestinationIds($nonexistent_id_values);
-    $this->assertSame(0, count($destination_ids));
+    $this->assertCount(0, $destination_ids);
   }
 
   /**
@@ -639,7 +639,7 @@ public function testLookupSourceIdMapping($num_source_fields, $num_destination_f
     $this->assertSame($expected_result, $source_id);
     // Test for a miss.
     $source_id = $id_map->lookupSourceId($nonexistent_id_values);
-    $this->assertSame(0, count($source_id));
+    $this->assertCount(0, $source_id);
   }
 
   /**
diff --git a/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php b/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
index 1088db53b79936610fa9413d45635a3579c4bb33..c148213e5c3a82e9a91f36fb3dd1a929d1604944 100644
--- a/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
+++ b/core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php
@@ -57,7 +57,7 @@ public function testDependencyBuilding($migrations_data, $result_ids) {
       else {
         $requirements = array_combine($requirements, $requirements);
 
-        $this->assertEquals(1, count($migration->set));
+        $this->assertCount(1, $migration->set);
         list($set_prop, $set_requirements) = reset($migration->set);
         $this->assertEquals('requirements', $set_prop);
         $this->assertEquals($requirements, $set_requirements);
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d6/FieldDiscoveryTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d6/FieldDiscoveryTest.php
index 41562431e9df2811aa63c4d08c042fd45e1ca978..3dfd4ccf59d4b4d644d0d8baeaa9db5fe7714573 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/d6/FieldDiscoveryTest.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d6/FieldDiscoveryTest.php
@@ -271,11 +271,11 @@ public function testGetAllFields() {
     $actual_fields = $field_discovery_test->getAllFields('6');
     $this->assertSame(['node'], array_keys($actual_fields));
     $this->assertSame(['employee', 'test_planet', 'page', 'story', 'test_page'], array_keys($actual_fields['node']));
-    $this->assertSame(21, count($actual_fields['node']['story']));
+    $this->assertCount(21, $actual_fields['node']['story']);
     foreach ($actual_fields['node'] as $bundle => $fields) {
       foreach ($fields as $field_name => $field_info) {
         $this->assertArrayHasKey('type', $field_info);
-        $this->assertSame(22, count($field_info));
+        $this->assertCount(22, $field_info);
         $this->assertEquals($bundle, $field_info['type_name']);
       }
     }
diff --git a/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php b/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php
index 5c05d48726082d7c3f7ef6c088159b209ef00459..1b642cd67c4fe196c83e6bcf08a10c67842a803c 100644
--- a/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php
+++ b/core/modules/migrate_drupal/tests/src/Kernel/d7/FieldDiscoveryTest.php
@@ -278,9 +278,9 @@ public function testGetAllFields() {
     $this->assertArrayHasKey('test_vocabulary', $actual_fields['taxonomy_term']);
     $this->assertArrayHasKey('user', $actual_fields['user']);
     $this->assertArrayHasKey('test_content_type', $actual_fields['node']);
-    $this->assertSame(6, count($actual_fields['node']));
-    $this->assertSame(6, count($actual_fields['comment']));
-    $this->assertSame(22, count($actual_fields['node']['test_content_type']));
+    $this->assertCount(6, $actual_fields['node']);
+    $this->assertCount(6, $actual_fields['comment']);
+    $this->assertCount(22, $actual_fields['node']['test_content_type']);
     foreach ($actual_fields as $entity_type_id => $bundles) {
       foreach ($bundles as $bundle => $fields) {
         foreach ($fields as $field_name => $field_info) {
diff --git a/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php b/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php
index c5c1f51ced9e7ec26242e345e7a1510d20cb110a..b2d48825d7feff3451eefd37645c745ada80e483 100644
--- a/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php
+++ b/core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php
@@ -82,8 +82,8 @@ protected function setUp(): void {
   public function testGetSystemData() {
     $system_data = $this->base->getSystemData();
     // Should be 1 theme and 2 modules.
-    $this->assertEquals(1, count($system_data['theme']));
-    $this->assertEquals(2, count($system_data['module']));
+    $this->assertCount(1, $system_data['theme']);
+    $this->assertCount(2, $system_data['module']);
 
     // Calling again should be identical.
     $this->assertSame($system_data, $this->base->getSystemData());
diff --git a/core/modules/node/tests/src/Functional/AssertButtonsTrait.php b/core/modules/node/tests/src/Functional/AssertButtonsTrait.php
index bc2ef9078b5d44d11ed3cd17c1ece1eee655b4d1..5b3a711d7f9fc0168344ef29318560c3ef64c1fc 100644
--- a/core/modules/node/tests/src/Functional/AssertButtonsTrait.php
+++ b/core/modules/node/tests/src/Functional/AssertButtonsTrait.php
@@ -32,7 +32,7 @@ public function assertButtons(array $buttons, $dropbutton = TRUE) {
       // Dropbutton elements.
       /** @var \Behat\Mink\Element\NodeElement[] $elements */
       $elements = $this->xpath('//div[@class="dropbutton-wrapper"]//input[@type="submit"]');
-      $this->assertEqual($count, count($elements));
+      $this->assertCount($count, $elements);
       foreach ($elements as $element) {
         $value = $element->getValue() ?: '';
         $this->assertEqual($buttons[$i], $value);
diff --git a/core/modules/node/tests/src/Functional/NodeCreationTest.php b/core/modules/node/tests/src/Functional/NodeCreationTest.php
index 49b638f1c5067cc13922e4eae0b8a6da038b7aa3..260f8437190983a4bc9ff1055e3c0dad5043fe04 100644
--- a/core/modules/node/tests/src/Functional/NodeCreationTest.php
+++ b/core/modules/node/tests/src/Functional/NodeCreationTest.php
@@ -226,7 +226,7 @@ public function testAuthorAutocomplete() {
     $this->drupalGet('node/add/page');
 
     $result = $this->xpath('//input[@id="edit-uid-0-value" and contains(@data-autocomplete-path, "user/autocomplete")]');
-    $this->assertEqual(count($result), 0, 'No autocompletion without access user profiles.');
+    $this->assertCount(0, $result, 'No autocompletion without access user profiles.');
 
     $admin_user = $this->drupalCreateUser(['administer nodes', 'create page content', 'access user profiles']);
     $this->drupalLogin($admin_user);
@@ -234,7 +234,7 @@ public function testAuthorAutocomplete() {
     $this->drupalGet('node/add/page');
 
     $result = $this->xpath('//input[@id="edit-uid-0-target-id" and contains(@data-autocomplete-path, "/entity_reference_autocomplete/user/default")]');
-    $this->assertEqual(count($result), 1, 'Ensure that the user does have access to the autocompletion');
+    $this->assertCount(1, $result, 'Ensure that the user does have access to the autocompletion');
   }
 
   /**
diff --git a/core/modules/node/tests/src/Functional/NodePostSettingsTest.php b/core/modules/node/tests/src/Functional/NodePostSettingsTest.php
index 31a939736b3dd9ab1b57410d8765ea41cf91d94a..9f8cd625bee7a6d048b5a030c8dd3d93a03cc25d 100644
--- a/core/modules/node/tests/src/Functional/NodePostSettingsTest.php
+++ b/core/modules/node/tests/src/Functional/NodePostSettingsTest.php
@@ -41,7 +41,7 @@ public function testPagePostInfo() {
     // Check that the post information is displayed.
     $node = $this->drupalGetNodeByTitle($edit['title[0][value]']);
     $elements = $this->xpath('//div[contains(@class, :class)]', [':class' => 'node__submitted']);
-    $this->assertEqual(count($elements), 1, 'Post information is displayed.');
+    $this->assertCount(1, $elements, 'Post information is displayed.');
     $node->delete();
 
     // Set "Basic page" content type to display post information.
@@ -57,7 +57,7 @@ public function testPagePostInfo() {
 
     // Check that the post information is displayed.
     $elements = $this->xpath('//div[contains(@class, :class)]', [':class' => 'node__submitted']);
-    $this->assertEqual(count($elements), 0, 'Post information is not displayed.');
+    $this->assertCount(0, $elements, 'Post information is not displayed.');
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/NodeQueryAlterTest.php b/core/modules/node/tests/src/Functional/NodeQueryAlterTest.php
index 01dee93391cfa3724a43378cf3f2e0cc1fc6465a..3d07b803cab4be939034750db4820c6e92157a8f 100644
--- a/core/modules/node/tests/src/Functional/NodeQueryAlterTest.php
+++ b/core/modules/node/tests/src/Functional/NodeQueryAlterTest.php
@@ -67,7 +67,7 @@ public function testNodeQueryAlterLowLevelWithAccess() {
       $query->addMetaData('account', $this->accessUser);
 
       $result = $query->execute()->fetchAll();
-      $this->assertEqual(count($result), 4, 'User with access can see correct nodes');
+      $this->assertCount(4, $result, 'User with access can see correct nodes');
     }
     catch (\Exception $e) {
       $this->fail('Altered query is malformed');
@@ -85,7 +85,7 @@ public function testNodeQueryAlterWithRevisions() {
         ->allRevisions()
         ->execute();
 
-      $this->assertEqual(count($result), 4, 'User with access can see correct nodes');
+      $this->assertCount(4, $result, 'User with access can see correct nodes');
     }
     catch (\Exception $e) {
       $this->fail('Altered query is malformed');
@@ -108,7 +108,7 @@ public function testNodeQueryAlterLowLevelNoAccess() {
       $query->addMetaData('account', $this->noAccessUser);
 
       $result = $query->execute()->fetchAll();
-      $this->assertEqual(count($result), 0, 'User with no access cannot see nodes');
+      $this->assertCount(0, $result, 'User with no access cannot see nodes');
     }
     catch (\Exception $e) {
       $this->fail('Altered query is malformed');
@@ -131,7 +131,7 @@ public function testNodeQueryAlterLowLevelEditAccess() {
       $query->addMetaData('account', $this->accessUser);
 
       $result = $query->execute()->fetchAll();
-      $this->assertEqual(count($result), 0, 'User with view-only access cannot edit nodes');
+      $this->assertCount(0, $result, 'User with view-only access cannot edit nodes');
     }
     catch (\Exception $e) {
       $this->fail($e->getMessage());
@@ -172,7 +172,7 @@ public function testNodeQueryAlterOverride() {
       $query->addMetaData('account', $this->noAccessUser);
 
       $result = $query->execute()->fetchAll();
-      $this->assertEqual(count($result), 0, 'User view privileges are not overridden');
+      $this->assertCount(0, $result, 'User view privileges are not overridden');
     }
     catch (\Exception $e) {
       $this->fail('Altered query is malformed');
@@ -194,7 +194,7 @@ public function testNodeQueryAlterOverride() {
       $query->addMetaData('account', $this->noAccessUser);
 
       $result = $query->execute()->fetchAll();
-      $this->assertEqual(count($result), 4, 'User view privileges are overridden');
+      $this->assertCount(4, $result, 'User view privileges are overridden');
     }
     catch (\Exception $e) {
       $this->fail('Altered query is malformed');
diff --git a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
index fb7cb97a0a36a4d8ce68f7c508832b69fda20df0..2f6cc82c99056ea87a5e323cb064a30484cce651 100644
--- a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
+++ b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php
@@ -280,7 +280,7 @@ public function testDisabledBundle() {
 
     // Make sure that nothing was inserted into the {content_translation} table.
     $rows = Database::getConnection()->query('SELECT nid, count(nid) AS count FROM {node_field_data} WHERE type <> :type GROUP BY nid HAVING count(nid) >= 2', [':type' => $this->bundle])->fetchAll();
-    $this->assertEqual(0, count($rows));
+    $this->assertCount(0, $rows);
 
     // Ensure the translation tab is not accessible.
     $this->drupalGet('node/' . $node->id() . '/translations');
diff --git a/core/modules/node/tests/src/Functional/NodeTypeTest.php b/core/modules/node/tests/src/Functional/NodeTypeTest.php
index 049f01c8bf6e8ba70f81c132ab90f6fb20f72098..b9e7d7eca56c945d7753427afc42a618481e9ce3 100644
--- a/core/modules/node/tests/src/Functional/NodeTypeTest.php
+++ b/core/modules/node/tests/src/Functional/NodeTypeTest.php
@@ -74,7 +74,7 @@ public function testNodeTypeCreation() {
     $this->assertCacheTag('config:node_type_list');
     $this->assertCacheContext('user.permissions');
     $elements = $this->cssSelect('dl.node-type-list dt');
-    $this->assertEqual(3, count($elements));
+    $this->assertCount(3, $elements);
 
     $edit = [
       'name' => 'foo',
@@ -87,7 +87,7 @@ public function testNodeTypeCreation() {
 
     $this->drupalGet('node/add');
     $elements = $this->cssSelect('dl.node-type-list dt');
-    $this->assertEqual(4, count($elements));
+    $this->assertCount(4, $elements);
   }
 
   /**
@@ -245,7 +245,7 @@ public function testNodeTypeFieldUiPermissions() {
   public function testNodeTypeNoContentType() {
     /** @var \Drupal\Core\Entity\EntityTypeBundleInfoInterface $bundle_info */
     $bundle_info = \Drupal::service('entity_type.bundle.info');
-    $this->assertEqual(2, count($bundle_info->getBundleInfo('node')), 'The bundle information service has 2 bundles for the Node entity type.');
+    $this->assertCount(2, $bundle_info->getBundleInfo('node'), 'The bundle information service has 2 bundles for the Node entity type.');
     $web_user = $this->drupalCreateUser(['administer content types']);
     $this->drupalLogin($web_user);
 
@@ -261,7 +261,7 @@ public function testNodeTypeNoContentType() {
       ]), 'Empty text when there are no content types in the system is correct.');
 
     $bundle_info->clearCachedBundles();
-    $this->assertEqual(0, count($bundle_info->getBundleInfo('node')), 'The bundle information service has 0 bundles for the Node entity type.');
+    $this->assertCount(0, $bundle_info->getBundleInfo('node'), 'The bundle information service has 0 bundles for the Node entity type.');
   }
 
 }
diff --git a/core/modules/node/tests/src/Functional/Views/BulkFormTest.php b/core/modules/node/tests/src/Functional/Views/BulkFormTest.php
index 0b28c1f8447c87e320a4ec90ff481e1deb3ab5e9..7c245747098e71206daaccc328dd35b8faa803e2 100644
--- a/core/modules/node/tests/src/Functional/Views/BulkFormTest.php
+++ b/core/modules/node/tests/src/Functional/Views/BulkFormTest.php
@@ -88,13 +88,13 @@ protected function setUp($import_test_views = TRUE): void {
     // Check that all created translations are selected by the test view.
     $view = Views::getView('test_node_bulk_form');
     $view->execute();
-    $this->assertEqual(count($view->result), 10, 'All created translations are selected.');
+    $this->assertCount(10, $view->result, 'All created translations are selected.');
 
     // Check the operations are accessible to the logged in user.
     $this->drupalLogin($this->drupalCreateUser(['administer nodes', 'access content overview', 'bypass node access']));
     $this->drupalGet('test-node-bulk-form');
     $elements = $this->xpath('//select[@id="edit-action"]//option');
-    $this->assertIdentical(count($elements), 8, 'All node operations are found.');
+    $this->assertCount(8, $elements, 'All node operations are found.');
   }
 
   /**
diff --git a/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareCombinationTest.php b/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareCombinationTest.php
index 21fdb387a6fe5c38371d475bf776762464c28f6a..0c0327167b0492f97754e24491e66543a6177d9c 100644
--- a/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareCombinationTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareCombinationTest.php
@@ -266,7 +266,7 @@ public function testNodeAccessLanguageAwareCombination() {
 
     // Four nodes should be returned with public Hungarian translations or the
     // no language public node.
-    $this->assertEqual(count($nids), 4, 'Query returns 4 nodes when no langcode is specified.');
+    $this->assertCount(4, $nids, 'Query returns 4 nodes when no langcode is specified.');
     $this->assertArrayHasKey($this->nodes['public_both_public']->id(), $nids);
     $this->assertArrayHasKey($this->nodes['public_ca_private']->id(), $nids);
     $this->assertArrayHasKey($this->nodes['private_both_public']->id(), $nids);
@@ -281,7 +281,7 @@ public function testNodeAccessLanguageAwareCombination() {
     $nids = $select->execute()->fetchAllAssoc('nid');
 
     // Three nodes should be returned (with public Hungarian translations).
-    $this->assertEqual(count($nids), 3, 'Query returns 3 nodes.');
+    $this->assertCount(3, $nids, 'Query returns 3 nodes.');
     $this->assertArrayHasKey($this->nodes['public_both_public']->id(), $nids);
     $this->assertArrayHasKey($this->nodes['public_ca_private']->id(), $nids);
     $this->assertArrayHasKey($this->nodes['private_both_public']->id(), $nids);
@@ -295,7 +295,7 @@ public function testNodeAccessLanguageAwareCombination() {
     $nids = $select->execute()->fetchAllAssoc('nid');
 
     // Three nodes should be returned (with public Catalan translations).
-    $this->assertEqual(count($nids), 3, 'Query returns 3 nodes.');
+    $this->assertCount(3, $nids, 'Query returns 3 nodes.');
     $this->assertArrayHasKey($this->nodes['public_both_public']->id(), $nids);
     $this->assertArrayHasKey($this->nodes['public_hu_private']->id(), $nids);
     $this->assertArrayHasKey($this->nodes['private_both_public']->id(), $nids);
@@ -320,7 +320,7 @@ public function testNodeAccessLanguageAwareCombination() {
     $nids = $select->execute()->fetchAllAssoc('nid');
 
     // All nodes are returned.
-    $this->assertEqual(count($nids), 10, 'Query returns all nodes.');
+    $this->assertCount(10, $nids, 'Query returns all nodes.');
 
     // Query the nodes table as admin user (full access) with the node access
     // tag and langcode de.
@@ -333,7 +333,7 @@ public function testNodeAccessLanguageAwareCombination() {
 
     // Even though there is no German translation, all nodes are returned
     // because node access filtering does not occur when the user is user 1.
-    $this->assertEqual(count($nids), 10, 'Query returns all nodes.');
+    $this->assertCount(10, $nids, 'Query returns all nodes.');
   }
 
 }
diff --git a/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareTest.php b/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareTest.php
index ab647c17734ae43bd58c08bf467a5138e926e056..deaf02d687683a1e79c69247ebc29ee43f9d8e53 100644
--- a/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeAccessLanguageAwareTest.php
@@ -205,7 +205,7 @@ public function testNodeAccessLanguageAware() {
     // - Node with both translations public.
     // - Node with only the Catalan translation marked as private.
     // - No language node marked as public.
-    $this->assertEqual(count($nids), 3, '$connection->select() returns 3 nodes when no langcode is specified.');
+    $this->assertCount(3, $nids, '$connection->select() returns 3 nodes when no langcode is specified.');
     $this->assertArrayHasKey($this->nodes['both_public']->id(), $nids);
     $this->assertArrayHasKey($this->nodes['ca_private']->id(), $nids);
     $this->assertArrayHasKey($this->nodes['no_language_public']->id(), $nids);
@@ -220,7 +220,7 @@ public function testNodeAccessLanguageAware() {
 
     // Two nodes should be returned: the node with both translations public, and
     // the node with only the Catalan translation marked as private.
-    $this->assertEqual(count($nids), 2, 'Query returns 2 nodes when the hu langcode is specified.');
+    $this->assertCount(2, $nids, 'Query returns 2 nodes when the hu langcode is specified.');
     $this->assertArrayHasKey($this->nodes['both_public']->id(), $nids);
     $this->assertArrayHasKey($this->nodes['ca_private']->id(), $nids);
 
@@ -234,7 +234,7 @@ public function testNodeAccessLanguageAware() {
 
     // Two nodes should be returned: the node with both translations public, and
     // the node with only the Hungarian translation marked as private.
-    $this->assertEqual(count($nids), 2, 'Query returns 2 nodes when the hu langcode is specified.');
+    $this->assertCount(2, $nids, 'Query returns 2 nodes when the hu langcode is specified.');
     $this->assertArrayHasKey($this->nodes['both_public']->id(), $nids);
     $this->assertArrayHasKey($this->nodes['hu_private']->id(), $nids);
 
@@ -258,7 +258,7 @@ public function testNodeAccessLanguageAware() {
     $nids = $select->execute()->fetchAllAssoc('nid');
 
     // All nodes are returned.
-    $this->assertEqual(count($nids), 6, 'Query returns all nodes.');
+    $this->assertCount(6, $nids, 'Query returns all nodes.');
 
     // Query the nodes table as admin user (full access) with the node access
     // tag and langcode de.
@@ -271,7 +271,7 @@ public function testNodeAccessLanguageAware() {
 
     // Even though there is no German translation, all nodes are returned
     // because node access filtering does not occur when the user is user 1.
-    $this->assertEqual(count($nids), 6, 'Query returns all nodes.');
+    $this->assertCount(6, $nids, 'Query returns all nodes.');
   }
 
 }
diff --git a/core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php b/core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php
index b59faf467cf75e2669140f627479241fcd7fe685..bc5a32c0b75b006cc3b53e2c58dd3057d77b79ab 100644
--- a/core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeAccessLanguageTest.php
@@ -214,7 +214,7 @@ public function testNodeAccessQueryTag() {
 
     // The public node and no language node should be returned. Because no
     // langcode is given it will use the fallback node.
-    $this->assertEqual(count($nids), 2, 'Query returns 2 node');
+    $this->assertCount(2, $nids, 'Query returns 2 node');
     $this->assertArrayHasKey($node_public->id(), $nids);
     $this->assertArrayHasKey($node_no_language->id(), $nids);
 
@@ -239,7 +239,7 @@ public function testNodeAccessQueryTag() {
     $nids = $select->execute()->fetchAllAssoc('nid');
 
     // All nodes are returned.
-    $this->assertEqual(count($nids), 3, 'Query returns all three nodes.');
+    $this->assertCount(3, $nids, 'Query returns all three nodes.');
 
     // Query the nodes table as admin user (full access) with the node access
     // tag and langcode de.
@@ -252,7 +252,7 @@ public function testNodeAccessQueryTag() {
 
     // All nodes are returned because node access tag is not invoked when the
     // user is user 1.
-    $this->assertEqual(count($nids), 3, 'Query returns all three nodes.');
+    $this->assertCount(3, $nids, 'Query returns all three nodes.');
   }
 
 }
diff --git a/core/modules/node/tests/src/Kernel/NodeAccessRecordsTest.php b/core/modules/node/tests/src/Kernel/NodeAccessRecordsTest.php
index 547127d6ddff8a2b8fb28cb04ede1dbcf9856a16..d212b0560e13cae6ec90b399c9cd8cc02f23baea 100644
--- a/core/modules/node/tests/src/Kernel/NodeAccessRecordsTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeAccessRecordsTest.php
@@ -31,7 +31,7 @@ public function testNodeAccessRecords() {
     // Check to see if grants added by node_test_node_access_records made it in.
     $connection = Database::getConnection();
     $records = $connection->query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', [':nid' => $node1->id()])->fetchAll();
-    $this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
+    $this->assertCount(1, $records, 'Returned the correct number of rows.');
     $this->assertEqual($records[0]->realm, 'test_article_realm', 'Grant with article_realm acquired for node without alteration.');
     $this->assertEqual($records[0]->gid, 1, 'Grant with gid = 1 acquired for node without alteration.');
 
@@ -41,7 +41,7 @@ public function testNodeAccessRecords() {
 
     // Check to see if grants added by node_test_node_access_records made it in.
     $records = $connection->query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', [':nid' => $node2->id()])->fetchAll();
-    $this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
+    $this->assertCount(1, $records, 'Returned the correct number of rows.');
     $this->assertEqual($records[0]->realm, 'test_page_realm', 'Grant with page_realm acquired for node without alteration.');
     $this->assertEqual($records[0]->gid, 1, 'Grant with gid = 1 acquired for node without alteration.');
 
@@ -51,7 +51,7 @@ public function testNodeAccessRecords() {
 
     // Check to see if grants added by node_test_node_access_records made it in.
     $records = $connection->query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', [':nid' => $node3->id()])->fetchAll();
-    $this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
+    $this->assertCount(1, $records, 'Returned the correct number of rows.');
     $this->assertEqual($records[0]->realm, 'test_page_realm', 'Grant with page_realm acquired for node without alteration.');
     $this->assertEqual($records[0]->gid, 1, 'Grant with gid = 1 acquired for node without alteration.');
 
@@ -62,7 +62,7 @@ public function testNodeAccessRecords() {
     // Check to see if grant added by node_test_node_access_records was altered
     // by node_test_node_access_records_alter.
     $records = $connection->query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', [':nid' => $node4->id()])->fetchAll();
-    $this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
+    $this->assertCount(1, $records, 'Returned the correct number of rows.');
     $this->assertEqual($records[0]->realm, 'test_alter_realm', 'Altered grant with alter_realm acquired for node.');
     $this->assertEqual($records[0]->gid, 2, 'Altered grant with gid = 2 acquired for node.');
 
@@ -81,7 +81,7 @@ public function testNodeAccessRecords() {
     // empty $grants array is returned.
     $node6 = $this->drupalCreateNode(['status' => 0, 'disable_node_access' => TRUE]);
     $records = $connection->query('SELECT realm, gid FROM {node_access} WHERE nid = :nid', [':nid' => $node6->id()])->fetchAll();
-    $this->assertEqual(count($records), 0, 'Returned no records for unpublished node.');
+    $this->assertCount(0, $records, 'Returned no records for unpublished node.');
   }
 
 }
diff --git a/core/modules/node/tests/src/Kernel/NodeValidationTest.php b/core/modules/node/tests/src/Kernel/NodeValidationTest.php
index 29452ec37d82be3779865163b181e929454ff406..0713cc3394a73f36cce3170abf44ba199036d2e9 100644
--- a/core/modules/node/tests/src/Kernel/NodeValidationTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeValidationTest.php
@@ -38,23 +38,23 @@ public function testValidation() {
     $this->createUser();
     $node = Node::create(['type' => 'page', 'title' => 'test', 'uid' => 1]);
     $violations = $node->validate();
-    $this->assertEqual(count($violations), 0, 'No violations when validating a default node.');
+    $this->assertCount(0, $violations, 'No violations when validating a default node.');
 
     $node->set('title', $this->randomString(256));
     $violations = $node->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when title is too long.');
+    $this->assertCount(1, $violations, 'Violation found when title is too long.');
     $this->assertEqual($violations[0]->getPropertyPath(), 'title.0.value');
     $this->assertEqual($violations[0]->getMessage(), '<em class="placeholder">Title</em>: may not be longer than 255 characters.');
 
     $node->set('title', NULL);
     $violations = $node->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when title is not set.');
+    $this->assertCount(1, $violations, 'Violation found when title is not set.');
     $this->assertEqual($violations[0]->getPropertyPath(), 'title');
     $this->assertEqual($violations[0]->getMessage(), 'This value should not be null.');
 
     $node->set('title', '');
     $violations = $node->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when title is set to an empty string.');
+    $this->assertCount(1, $violations, 'Violation found when title is set to an empty string.');
     $this->assertEqual($violations[0]->getPropertyPath(), 'title');
 
     // Make the title valid again.
@@ -64,7 +64,7 @@ public function testValidation() {
     // Set the changed date to something in the far past.
     $node->set('changed', 433918800);
     $violations = $node->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when changed date is before the last changed date.');
+    $this->assertCount(1, $violations, 'Violation found when changed date is before the last changed date.');
     $this->assertEqual($violations[0]->getPropertyPath(), '');
     $this->assertEqual($violations[0]->getMessage(), 'The content has either been modified by another user, or you have already submitted modifications. As a result, your changes cannot be saved.');
   }
diff --git a/core/modules/node/tests/src/Kernel/Views/NidArgumentTest.php b/core/modules/node/tests/src/Kernel/Views/NidArgumentTest.php
index cd6689870fbc7775c42678742125035f081f444e..5a2bb7c3f3747c475826f5da860d5e6723d306a9 100644
--- a/core/modules/node/tests/src/Kernel/Views/NidArgumentTest.php
+++ b/core/modules/node/tests/src/Kernel/Views/NidArgumentTest.php
@@ -66,7 +66,7 @@ public function testNidArgument() {
     $node2->save();
 
     $view->preview();
-    $this->assertEqual(count($view->result), 2, 'Found the expected number of results.');
+    $this->assertCount(2, $view->result, 'Found the expected number of results.');
 
     // Set an the second node id as an argument.
     $view->destroy();
@@ -74,14 +74,14 @@ public function testNidArgument() {
     // Verify that the title is overridden.
     $this->assertEqual($view->getTitle(), $node2->getTitle());
     // Verify that the argument filtering works.
-    $this->assertEqual(count($view->result), 1, 'Found the expected number of results.');
+    $this->assertCount(1, $view->result, 'Found the expected number of results.');
     $this->assertEqual($node2->id(), (string) $view->style_plugin->getField(0, 'nid'), 'Found the correct nid.');
 
     // Verify that setting a non-existing id as argument results in no nodes
     // being shown.
     $view->destroy();
     $view->preview('default', [22]);
-    $this->assertEqual(count($view->result), 0, 'Found the expected number of results.');
+    $this->assertCount(0, $view->result, 'Found the expected number of results.');
   }
 
 }
diff --git a/core/modules/options/tests/src/Functional/OptionsDynamicValuesValidationTest.php b/core/modules/options/tests/src/Functional/OptionsDynamicValuesValidationTest.php
index d44ec394115963b9a2019759b4fc670d9558baf8..d865a06925c0d9acb93194ce5363ceddb817034b 100644
--- a/core/modules/options/tests/src/Functional/OptionsDynamicValuesValidationTest.php
+++ b/core/modules/options/tests/src/Functional/OptionsDynamicValuesValidationTest.php
@@ -22,14 +22,14 @@ public function testDynamicAllowedValues() {
     foreach ($this->test as $key => $value) {
       $this->entity->test_options->value = $value;
       $violations = $this->entity->test_options->validate();
-      $this->assertEqual(count($violations), 0, "$key is a valid value");
+      $this->assertCount(0, $violations, "$key is a valid value");
     }
 
     // Now verify that validation does not pass against anything else.
     foreach ($this->test as $key => $value) {
       $this->entity->test_options->value = is_numeric($value) ? (100 - $value) : ('X' . $value);
       $violations = $this->entity->test_options->validate();
-      $this->assertEqual(count($violations), 1, "$key is not a valid value");
+      $this->assertCount(1, $violations, "$key is not a valid value");
     }
   }
 
diff --git a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php
index 516aec4cd73d2850ae8cf47435c0e4f90949c2cb..e1cfe8992b762bde975ed6e23812fa5c7cac1b88 100644
--- a/core/modules/options/tests/src/Functional/OptionsFieldUITest.php
+++ b/core/modules/options/tests/src/Functional/OptionsFieldUITest.php
@@ -363,7 +363,7 @@ public function testNodeDisplay() {
       }
 
       $elements = $this->xpath('//div[text()="' . $output . '"]');
-      $this->assertEqual(count($elements), 1, 'Correct options found.');
+      $this->assertCount(1, $elements, 'Correct options found.');
     }
   }
 
diff --git a/core/modules/path/tests/src/Kernel/PathNoCanonicalLinkTest.php b/core/modules/path/tests/src/Kernel/PathNoCanonicalLinkTest.php
index 677713c558732ae15c3206cd16097de19fd6acaf..1b6ee185b0e6c3d37d34053b39d086e125e5cac2 100644
--- a/core/modules/path/tests/src/Kernel/PathNoCanonicalLinkTest.php
+++ b/core/modules/path/tests/src/Kernel/PathNoCanonicalLinkTest.php
@@ -55,11 +55,11 @@ public function testNoCanonicalLinkTemplate() {
 
     $entity_type->addTranslation('de', ['name' => 'name german']);
     $entity_type->save();
-    $this->assertEqual(count($entity_type->getTranslationLanguages()), 2);
+    $this->assertCount(2, $entity_type->getTranslationLanguages());
 
     $entity_type->removeTranslation('de');
     $entity_type->save();
-    $this->assertEqual(count($entity_type->getTranslationLanguages()), 1);
+    $this->assertCount(1, $entity_type->getTranslationLanguages());
   }
 
 }
diff --git a/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php b/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php
index c4a97968057f009bcb9870447def00e94b06c1af..a2064ee05eb029c53c5aecea35561958b0cfc7ae 100644
--- a/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php
+++ b/core/modules/quickedit/tests/src/Functional/QuickEditCustomPipelineTest.php
@@ -96,7 +96,7 @@ public function testCustomPipeline() {
       'http_errors' => FALSE,
     ]);
     $ajax_commands = Json::decode($response->getBody());
-    $this->assertIdentical(1, count($ajax_commands), 'The field form HTTP request results in one AJAX command.');
+    $this->assertCount(1, $ajax_commands, 'The field form HTTP request results in one AJAX command.');
     $this->assertIdentical('quickeditFieldFormSaved', $ajax_commands[0]['command'], 'The first AJAX command is a quickeditFieldFormSaved command.');
     $this->assertStringContainsString('Fine thanks.', $ajax_commands[0]['data'], 'Form value saved and printed back.');
     $this->assertStringContainsString('<div class="quickedit-test-wrapper">', $ajax_commands[0]['data'], 'Custom render pipeline used to render the value.');
diff --git a/core/modules/rest/tests/src/Unit/CollectRoutesTest.php b/core/modules/rest/tests/src/Unit/CollectRoutesTest.php
index 27a5f764d10956ad3d59c13af623379705dbeb8e..a53caf9cc377c7ff8247c47b46e16e8b82c87a61 100644
--- a/core/modules/rest/tests/src/Unit/CollectRoutesTest.php
+++ b/core/modules/rest/tests/src/Unit/CollectRoutesTest.php
@@ -149,12 +149,12 @@ public function testRoutesRequirements() {
     $requirements_1 = $this->routes->get('test_1')->getRequirements();
     $requirements_2 = $this->routes->get('view.test_view.page_1')->getRequirements();
 
-    $this->assertEquals(0, count($requirements_1), 'First route has no requirement.');
-    $this->assertEquals(1, count($requirements_2), 'Views route with rest export had the format requirement added.');
+    $this->assertCount(0, $requirements_1, 'First route has no requirement.');
+    $this->assertCount(1, $requirements_2, 'Views route with rest export had the format requirement added.');
 
     // Check auth options.
     $auth = $this->routes->get('view.test_view.page_1')->getOption('_auth');
-    $this->assertEquals(count($auth), 1, 'View route with rest export has an auth option added');
+    $this->assertCount(1, $auth, 'View route with rest export has an auth option added');
     $this->assertEquals($auth[0], 'basic_auth', 'View route with rest export has the correct auth option added');
   }
 
diff --git a/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php b/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php
index f2eb033f98d214f149aafb4a70dd43f5ebf8f0f3..5c05c58a5efe9c05c327fce3bf4b52932078343e 100644
--- a/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php
+++ b/core/modules/search/tests/src/Functional/SearchMultilingualEntityTest.php
@@ -168,7 +168,7 @@ public function testMultilingualSearch() {
     // This should find two results for the second and third node.
     $this->plugin->setSearch('English OR Hungarian', [], []);
     $search_result = $this->plugin->execute();
-    $this->assertEqual(count($search_result), 2, 'Found two results.');
+    $this->assertCount(2, $search_result, 'Found two results.');
     // Nodes are saved directly after each other and have the same created time
     // so testing for the order is not possible.
     $results = [$search_result[0]['title'], $search_result[1]['title']];
@@ -179,20 +179,20 @@ public function testMultilingualSearch() {
     $this->plugin->setSearch('English OR Hungarian', ['f' => ['language:hu']], []);
     $search_result = $this->plugin->execute();
 
-    $this->assertEqual(count($search_result), 1, 'The search found only one result');
+    $this->assertCount(1, $search_result, 'The search found only one result');
     $this->assertEqual($search_result[0]['title'], 'Third node this is the Hungarian title', 'The search finds the correct Hungarian title.');
 
     // Test for search with common key word across multiple languages.
     $this->plugin->setSearch('node', [], []);
     $search_result = $this->plugin->execute();
 
-    $this->assertEqual(count($search_result), 6, 'The search found total six results');
+    $this->assertCount(6, $search_result, 'The search found total six results');
 
     // Test with language filters and common key word.
     $this->plugin->setSearch('node', ['f' => ['language:hu']], []);
     $search_result = $this->plugin->execute();
 
-    $this->assertEqual(count($search_result), 2, 'The search found 2 results');
+    $this->assertCount(2, $search_result, 'The search found 2 results');
 
     // Test to check for the language of result items.
     foreach ($search_result as $result) {
@@ -321,7 +321,7 @@ protected function assertDatabaseCounts($count_node, $count_foo, $message) {
       ->groupBy('sid')
       ->execute()
       ->fetchCol();
-    $this->assertEqual($count_node, count($results), 'Node count was ' . $count_node . ' for ' . $message);
+    $this->assertCount($count_node, $results, 'Node count was ' . $count_node . ' for ' . $message);
 
     // Count number of "foo" records.
     $results = $connection->select('search_dataset', 'i')
@@ -329,7 +329,7 @@ protected function assertDatabaseCounts($count_node, $count_foo, $message) {
       ->condition('type', 'foo')
       ->execute()
       ->fetchCol();
-    $this->assertEqual($count_foo, count($results), 'Foo count was ' . $count_foo . ' for ' . $message);
+    $this->assertCount($count_foo, $results, 'Foo count was ' . $count_foo . ' for ' . $message);
 
   }
 
diff --git a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
index b2971222e51b49ec2c88c148a5ef073a64a85406..ee53a5057e5fc30256933f9e061c9db3f76b7a50 100644
--- a/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
+++ b/core/modules/shortcut/tests/src/Functional/ShortcutSetsTest.php
@@ -68,7 +68,7 @@ public function testShortcutSetEdit() {
 
     // Test the table header.
     $elements = $this->xpath('//div[@class="layout-content"]//table/thead/tr/th');
-    $this->assertEqual(count($elements), 3, 'Correct number of table header cells found.');
+    $this->assertCount(3, $elements, 'Correct number of table header cells found.');
 
     // Test the contents of each th cell.
     $expected_items = [t('Name'), t('Weight'), t('Operations')];
diff --git a/core/modules/system/tests/src/Functional/Batch/ProcessingTest.php b/core/modules/system/tests/src/Functional/Batch/ProcessingTest.php
index c47fb921a841aac1eee05ce8e1b4528f74a7d1c2..71fe35e5ac20adc5732f19df23fc93f133712aeb 100644
--- a/core/modules/system/tests/src/Functional/Batch/ProcessingTest.php
+++ b/core/modules/system/tests/src/Functional/Batch/ProcessingTest.php
@@ -101,7 +101,7 @@ public function testBatchForm() {
     $expected_stack = array_merge($this->_resultStack('batch_4'), $this->_resultStack('batch_7'));
     $this->assertEquals($expected_stack, batch_test_stack(), 'Execution order was correct.');
     $batch = \Drupal::state()->get('batch_test_nested_order_multiple_batches');
-    $this->assertEquals(5, count($batch['sets']));
+    $this->assertCount(5, $batch['sets']);
     // Ensure correct queue mapping.
     foreach ($batch['sets'] as $index => $batch_set) {
       $this->assertEquals('drupal_batch:' . $batch['id'] . ':' . $index, $batch_set['queue']['name']);
diff --git a/core/modules/system/tests/src/Functional/Form/CheckboxTest.php b/core/modules/system/tests/src/Functional/Form/CheckboxTest.php
index dd00fd588fb1bd7d8e9ff81f7505447e0d0cef8d..f67c31185a4a04fe608ba006dbcf842eeb2f2535 100644
--- a/core/modules/system/tests/src/Functional/Form/CheckboxTest.php
+++ b/core/modules/system/tests/src/Functional/Form/CheckboxTest.php
@@ -80,7 +80,7 @@ public function testFormCheckbox() {
     $this->drupalPostForm('form-test/checkboxes-zero/0', [], 'Save');
     $checkboxes = $this->xpath('//input[@type="checkbox"]');
 
-    $this->assertIdentical(count($checkboxes), 9, 'Correct number of checkboxes found.');
+    $this->assertCount(9, $checkboxes, 'Correct number of checkboxes found.');
     foreach ($checkboxes as $checkbox) {
       $checked = $checkbox->isChecked();
       $name = $checkbox->getAttribute('name');
@@ -94,7 +94,7 @@ public function testFormCheckbox() {
     $this->drupalPostForm(NULL, NULL, 'Save');
     $checkboxes = $this->xpath('//input[@type="checkbox"]');
 
-    $this->assertIdentical(count($checkboxes), 9, 'Correct number of checkboxes found.');
+    $this->assertCount(9, $checkboxes, 'Correct number of checkboxes found.');
     foreach ($checkboxes as $checkbox) {
       $checked = $checkbox->isChecked();
       $name = (string) $checkbox->getAttribute('name');
diff --git a/core/modules/system/tests/src/Functional/Form/ElementTest.php b/core/modules/system/tests/src/Functional/Form/ElementTest.php
index f08b258fb342df1f11b12693b1cf20cd8d7442a6..75b6c8a6f7253c1c9c6229b9be70590985424a7c 100644
--- a/core/modules/system/tests/src/Functional/Form/ElementTest.php
+++ b/core/modules/system/tests/src/Functional/Form/ElementTest.php
@@ -158,9 +158,9 @@ public function testButtonClasses() {
     // "button--foo" would contain "button". Instead, check
     // " button ". Make sure it matches in the beginning and the end too
     // by adding a space before and after.
-    $this->assertEqual(2, count($this->xpath('//*[contains(concat(" ", @class, " "), " button ")]')));
-    $this->assertEqual(1, count($this->xpath('//*[contains(concat(" ", @class, " "), " button--foo ")]')));
-    $this->assertEqual(1, count($this->xpath('//*[contains(concat(" ", @class, " "), " button--danger ")]')));
+    $this->assertCount(2, $this->xpath('//*[contains(concat(" ", @class, " "), " button ")]'));
+    $this->assertCount(1, $this->xpath('//*[contains(concat(" ", @class, " "), " button--foo ")]'));
+    $this->assertCount(1, $this->xpath('//*[contains(concat(" ", @class, " "), " button--danger ")]'));
   }
 
   /**
@@ -204,9 +204,9 @@ public function testFormAutocomplete() {
     $this->drupalGet('form-test/autocomplete');
 
     $result = $this->xpath('//input[@id="edit-autocomplete-1" and contains(@data-autocomplete-path, "form-test/autocomplete-1")]');
-    $this->assertEqual(count($result), 0, 'Ensure that the user does not have access to the autocompletion');
+    $this->assertCount(0, $result, 'Ensure that the user does not have access to the autocompletion');
     $result = $this->xpath('//input[@id="edit-autocomplete-2" and contains(@data-autocomplete-path, "form-test/autocomplete-2/value")]');
-    $this->assertEqual(count($result), 0, 'Ensure that the user does not have access to the autocompletion');
+    $this->assertCount(0, $result, 'Ensure that the user does not have access to the autocompletion');
 
     $user = $this->drupalCreateUser(['access autocomplete test']);
     $this->drupalLogin($user);
@@ -216,9 +216,9 @@ public function testFormAutocomplete() {
     $this->assertRaw('core/misc/autocomplete.js');
 
     $result = $this->xpath('//input[@id="edit-autocomplete-1" and contains(@data-autocomplete-path, "form-test/autocomplete-1")]');
-    $this->assertEqual(count($result), 1, 'Ensure that the user does have access to the autocompletion');
+    $this->assertCount(1, $result, 'Ensure that the user does have access to the autocompletion');
     $result = $this->xpath('//input[@id="edit-autocomplete-2" and contains(@data-autocomplete-path, "form-test/autocomplete-2/value")]');
-    $this->assertEqual(count($result), 1, 'Ensure that the user does have access to the autocompletion');
+    $this->assertCount(1, $result, 'Ensure that the user does have access to the autocompletion');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php b/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php
index 29d92db02d84bd6f111c8955531cdd8d72257150..91f7b2863cc33371b5250c8cc0e120cb66058435 100644
--- a/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php
+++ b/core/modules/system/tests/src/Functional/Form/ElementsTableSelectTest.php
@@ -70,17 +70,17 @@ public function testTableSelectColSpan() {
 
     // There should be three labeled column headers and 1 for the input.
     $table_head = $this->xpath('//thead/tr/th');
-    $this->assertEquals(count($table_head), 4, 'There are four column headers');
+    $this->assertCount(4, $table_head, 'There are four column headers');
 
     // The first two body rows should each have 5 table cells: One for the
     // radio, one cell in the first column, one cell in the second column,
     // and two cells in the third column which has colspan 2.
     for ($i = 0; $i <= 1; $i++) {
-      $this->assertEquals(count($this->xpath('//tbody/tr[' . ($i + 1) . ']/td')), 5, 'There are five cells in row ' . $i);
+      $this->assertCount(5, $this->xpath('//tbody/tr[' . ($i + 1) . ']/td'), 'There are five cells in row ' . $i);
     }
     // The third row should have 3 cells, one for the radio, one spanning the
     // first and second column, and a third in column 3 (which has colspan 3).
-    $this->assertEquals(count($this->xpath('//tbody/tr[3]/td')), 3, 'There are three cells in row 3.');
+    $this->assertCount(3, $this->xpath('//tbody/tr[3]/td'), 'There are three cells in row 3.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php b/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php
index abfe8467fda053490a487285cdc2fa398ab5bae7..6c7f9b2ccbe5bddf2044b9f48c350812281f521c 100644
--- a/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php
+++ b/core/modules/system/tests/src/Functional/Form/FormStoragePageCacheTest.php
@@ -37,7 +37,7 @@ protected function setUp(): void {
    */
   protected function getFormBuildId() {
     $build_id_fields = $this->xpath('//input[@name="form_build_id"]');
-    $this->assertEqual(count($build_id_fields), 1, 'One form build id field on the page');
+    $this->assertCount(1, $build_id_fields, 'One form build id field on the page');
     return (string) $build_id_fields[0]->getAttribute('value');
   }
 
diff --git a/core/modules/system/tests/src/Functional/Form/StorageTest.php b/core/modules/system/tests/src/Functional/Form/StorageTest.php
index 1bcea67ef78ae0344df4c0c453643af35e639158..09780a0688b369b252c3592f576b375ce96bff5f 100644
--- a/core/modules/system/tests/src/Functional/Form/StorageTest.php
+++ b/core/modules/system/tests/src/Functional/Form/StorageTest.php
@@ -147,7 +147,7 @@ public function testImmutableForm() {
     // Request the form with 'cache' query parameter to enable form caching.
     $this->drupalGet('form_test/form-storage', ['query' => ['cache' => 1, 'immutable' => 1]]);
     $buildIdFields = $this->xpath('//input[@name="form_build_id"]');
-    $this->assertEquals(count($buildIdFields), 1, 'One form build id field on the page');
+    $this->assertCount(1, $buildIdFields, 'One form build id field on the page');
     $buildId = $buildIdFields[0]->getValue();
 
     // Trigger validation error by submitting an empty title.
@@ -159,7 +159,7 @@ public function testImmutableForm() {
 
     // Retrieve the new build-id.
     $buildIdFields = $this->xpath('//input[@name="form_build_id"]');
-    $this->assertEquals(count($buildIdFields), 1, 'One form build id field on the page');
+    $this->assertCount(1, $buildIdFields, 'One form build id field on the page');
     $buildId = (string) $buildIdFields[0]->getValue();
 
     // Trigger validation error by again submitting an empty title.
@@ -176,7 +176,7 @@ public function testImmutableForm() {
   public function testImmutableFormLegacyProtection() {
     $this->drupalGet('form_test/form-storage', ['query' => ['cache' => 1, 'immutable' => 1]]);
     $build_id_fields = $this->xpath('//input[@name="form_build_id"]');
-    $this->assertEquals(count($build_id_fields), 1, 'One form build id field on the page');
+    $this->assertCount(1, $build_id_fields, 'One form build id field on the page');
     $build_id = $build_id_fields[0]->getValue();
 
     // Try to poison the form cache.
diff --git a/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php b/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
index 60ebdca1e98d56ceb75a8afc7c9ff1e95fcfa1f7..c6b596bf36db003c0489212d1415e48258ae443e 100644
--- a/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
+++ b/core/modules/system/tests/src/Functional/Menu/LocalTasksTest.php
@@ -134,7 +134,7 @@ public function testPluginLocalTask() {
 
     // Ensure the view tab is active.
     $result = $this->xpath('//ul[contains(@class, "tabs")]//li[contains(@class, "active")]/a');
-    $this->assertEqual(1, count($result), 'There is just a single active tab.');
+    $this->assertCount(1, $result, 'There is just a single active tab.');
     $this->assertEqual('View(active tab)', $result[0]->getText(), 'The view tab is active.');
 
     // Verify that local tasks in the second level appear.
@@ -149,14 +149,14 @@ public function testPluginLocalTask() {
     $this->assertLocalTasks($sub_tasks, 1);
 
     $result = $this->xpath('//ul[contains(@class, "tabs")]//li[contains(@class, "active")]/a');
-    $this->assertEqual(1, count($result), 'There is just a single active tab.');
+    $this->assertCount(1, $result, 'There is just a single active tab.');
     $this->assertEqual('Settings(active tab)', $result[0]->getText(), 'The settings tab is active.');
 
     $this->drupalGet(Url::fromRoute('menu_test.local_task_test_tasks_settings_sub1'));
     $this->assertLocalTasks($sub_tasks, 1);
 
     $result = $this->xpath('//ul[contains(@class, "tabs")]//a[contains(@class, "active")]');
-    $this->assertEqual(2, count($result), 'There are tabs active on both levels.');
+    $this->assertCount(2, $result, 'There are tabs active on both levels.');
     $this->assertEqual('Settings(active tab)', $result[0]->getText(), 'The settings tab is active.');
     $this->assertEqual('Dynamic title for TestTasksSettingsSub1(active tab)', $result[1]->getText(), 'The sub1 tab is active.');
 
@@ -167,7 +167,7 @@ public function testPluginLocalTask() {
     $this->assertLocalTasks($sub_tasks, 1);
 
     $result = $this->xpath('//ul[contains(@class, "tabs")]//li[contains(@class, "active")]');
-    $this->assertEqual(2, count($result), 'There are tabs active on both levels.');
+    $this->assertCount(2, $result, 'There are tabs active on both levels.');
     $this->assertEqual('Settings(active tab)', $result[0]->getText(), 'The settings tab is active.');
     $this->assertEqual('Derive 1(active tab)', $result[1]->getText(), 'The derive1 tab is active.');
 
@@ -195,7 +195,7 @@ public function testPluginLocalTask() {
     $this->assertLocalTasks($tasks, 0);
 
     $result = $this->xpath('//ul[contains(@class, "tabs")]//li[contains(@class, "active")]');
-    $this->assertEqual(1, count($result), 'There is one active tab.');
+    $this->assertCount(1, $result, 'There is one active tab.');
     $this->assertEqual('upcasting sub1(active tab)', $result[0]->getText(), 'The "upcasting sub1" tab is active.');
 
     $this->drupalGet(Url::fromRoute('menu_test.local_task_test_upcasting_sub2', ['entity_test' => '1']));
@@ -207,7 +207,7 @@ public function testPluginLocalTask() {
     $this->assertLocalTasks($tasks, 0);
 
     $result = $this->xpath('//ul[contains(@class, "tabs")]//li[contains(@class, "active")]');
-    $this->assertEqual(1, count($result), 'There is one active tab.');
+    $this->assertCount(1, $result, 'There is one active tab.');
     $this->assertEqual('upcasting sub2(active tab)', $result[0]->getText(), 'The "upcasting sub2" tab is active.');
   }
 
diff --git a/core/modules/system/tests/src/Functional/Page/DefaultMetatagsTest.php b/core/modules/system/tests/src/Functional/Page/DefaultMetatagsTest.php
index 2493a38306df3b7498961d5a9ef63e16551f10ab..9d4e354ccd82cb9b04c699c2ae453c07eba0f3e7 100644
--- a/core/modules/system/tests/src/Functional/Page/DefaultMetatagsTest.php
+++ b/core/modules/system/tests/src/Functional/Page/DefaultMetatagsTest.php
@@ -23,7 +23,7 @@ public function testMetaTag() {
     $this->drupalGet('');
     // Ensures that the charset metatag is on the page.
     $result = $this->xpath('//meta[@charset="utf-8"]');
-    $this->assertEqual(count($result), 1);
+    $this->assertCount(1, $result);
 
     // Ensure that the charset one is the first metatag.
     $result = $this->xpath('//meta');
@@ -31,7 +31,7 @@ public function testMetaTag() {
 
     // Ensure that the shortcut icon is on the page.
     $result = $this->xpath('//link[@rel = "shortcut icon"]');
-    $this->assertEqual(count($result), 1, 'The shortcut icon is present.');
+    $this->assertCount(1, $result, 'The shortcut icon is present.');
   }
 
 }
diff --git a/core/modules/system/tests/src/Functional/Pager/PagerTest.php b/core/modules/system/tests/src/Functional/Pager/PagerTest.php
index 9f79f0f5aa37212f0f9bec566cf0fe55b2541399..4a6d7d448cb320e9258a2ef983c2ae3dab3e2166 100644
--- a/core/modules/system/tests/src/Functional/Pager/PagerTest.php
+++ b/core/modules/system/tests/src/Functional/Pager/PagerTest.php
@@ -201,7 +201,7 @@ public function testPagerEllipsis() {
     }
     $this->drupalGet('admin/reports/dblog');
     $elements = $this->cssSelect(".pager__item--ellipsis:contains('…')");
-    $this->assertEqual(count($elements), 0, 'No ellipsis has been set.');
+    $this->assertCount(0, $elements, 'No ellipsis has been set.');
 
     // Insert an extra 50 log messages to get 10 pages.
     $logger = $this->container->get('logger.factory')->get('pager_test');
@@ -210,7 +210,7 @@ public function testPagerEllipsis() {
     }
     $this->drupalGet('admin/reports/dblog');
     $elements = $this->cssSelect(".pager__item--ellipsis:contains('…')");
-    $this->assertEqual(count($elements), 1, 'Found the ellipsis.');
+    $this->assertCount(1, $elements, 'Found the ellipsis.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php b/core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php
index 7027fe248fad498501523d6faf290604f3e71dc3..787276a142bc5fa2965086d842a37a8d190839dc 100644
--- a/core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php
+++ b/core/modules/system/tests/src/Functional/Render/HtmlResponseAttachmentsTest.php
@@ -110,7 +110,7 @@ protected function assertTeapotHeaders() {
   protected function assertFeed() {
     // Discover the DOM element for the feed link.
     $test_meta = $this->xpath('//head/link[@href="test://url"]');
-    $this->assertEqual(1, count($test_meta), 'Link has URL.');
+    $this->assertCount(1, $test_meta, 'Link has URL.');
     // Reconcile the other attributes.
     $test_meta_attributes = [
       'href' => 'test://url',
@@ -135,7 +135,7 @@ protected function assertFeed() {
   protected function assertHead() {
     // Discover the DOM element for the meta link.
     $test_meta = $this->xpath('//head/meta[@test-attribute="testvalue"]');
-    $this->assertEqual(1, count($test_meta), 'There\'s only one test attribute.');
+    $this->assertCount(1, $test_meta, 'There\'s only one test attribute.');
     // Grab the only DOM element.
     $test_meta = reset($test_meta);
     if (empty($test_meta)) {
diff --git a/core/modules/system/tests/src/Functional/Theme/ThemeInfoTest.php b/core/modules/system/tests/src/Functional/Theme/ThemeInfoTest.php
index ad37d08561e4f6b372879caa40edcabebf57c2d8..cfea0c93315a272ee1514aedb44c5e58ba0c46f1 100644
--- a/core/modules/system/tests/src/Functional/Theme/ThemeInfoTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/ThemeInfoTest.php
@@ -71,16 +71,16 @@ public function testStylesheets() {
     // should work nevertheless.
     $this->drupalGet('theme-test/info/stylesheets');
 
-    $this->assertIdentical(1, count($this->xpath('//link[contains(@href, :href)]', [':href' => "$base/base-add.css"])), "$base/base-add.css found");
-    $this->assertIdentical(0, count($this->xpath('//link[contains(@href, :href)]', [':href' => "base-remove.css"])), "base-remove.css not found");
+    $this->assertCount(1, $this->xpath('//link[contains(@href, :href)]', [':href' => "$base/base-add.css"]), "$base/base-add.css found");
+    $this->assertCount(0, $this->xpath('//link[contains(@href, :href)]', [':href' => "base-remove.css"]), "base-remove.css not found");
 
-    $this->assertIdentical(1, count($this->xpath('//link[contains(@href, :href)]', [':href' => "$sub/sub-add.css"])), "$sub/sub-add.css found");
-    $this->assertIdentical(0, count($this->xpath('//link[contains(@href, :href)]', [':href' => "sub-remove.css"])), "sub-remove.css not found");
-    $this->assertIdentical(0, count($this->xpath('//link[contains(@href, :href)]', [':href' => "base-add.sub-remove.css"])), "base-add.sub-remove.css not found");
+    $this->assertCount(1, $this->xpath('//link[contains(@href, :href)]', [':href' => "$sub/sub-add.css"]), "$sub/sub-add.css found");
+    $this->assertCount(0, $this->xpath('//link[contains(@href, :href)]', [':href' => "sub-remove.css"]), "sub-remove.css not found");
+    $this->assertCount(0, $this->xpath('//link[contains(@href, :href)]', [':href' => "base-add.sub-remove.css"]), "base-add.sub-remove.css not found");
 
     // Verify that CSS files with the same name are loaded from both the base theme and subtheme.
-    $this->assertIdentical(1, count($this->xpath('//link[contains(@href, :href)]', [':href' => "$base/samename.css"])), "$base/samename.css found");
-    $this->assertIdentical(1, count($this->xpath('//link[contains(@href, :href)]', [':href' => "$sub/samename.css"])), "$sub/samename.css found");
+    $this->assertCount(1, $this->xpath('//link[contains(@href, :href)]', [':href' => "$base/samename.css"]), "$base/samename.css found");
+    $this->assertCount(1, $this->xpath('//link[contains(@href, :href)]', [':href' => "$sub/samename.css"]), "$sub/samename.css found");
 
   }
 
diff --git a/core/modules/system/tests/src/Functional/Theme/ThemeTest.php b/core/modules/system/tests/src/Functional/Theme/ThemeTest.php
index 578072a11ba34f61a8669fe3b1cb11c029bc22e2..b30b088860fec07ef4d60e2c1dcea441de67cae0 100644
--- a/core/modules/system/tests/src/Functional/Theme/ThemeTest.php
+++ b/core/modules/system/tests/src/Functional/Theme/ThemeTest.php
@@ -164,7 +164,7 @@ public function testRegionClass() {
     $this->drupalPlaceBlock('system_main_block');
     $this->drupalGet('');
     $elements = $this->cssSelect(".region-sidebar-first.new_class");
-    $this->assertEqual(count($elements), 1, 'New class found.');
+    $this->assertCount(1, $elements, 'New class found.');
   }
 
   /**
diff --git a/core/modules/system/tests/src/FunctionalJavascript/Form/RebuildTest.php b/core/modules/system/tests/src/FunctionalJavascript/Form/RebuildTest.php
index 236202fd322713f4c8c0913ab420ecb4b43f4bdb..fef51c7c00d220e0b61660d6c40485aa3912e087 100644
--- a/core/modules/system/tests/src/FunctionalJavascript/Form/RebuildTest.php
+++ b/core/modules/system/tests/src/FunctionalJavascript/Form/RebuildTest.php
@@ -117,7 +117,7 @@ public function testPreserveFormActionAfterAJAX() {
 
     // Ensure that the form's action is correct.
     $forms = $this->xpath('//form[contains(@class, "node-page-form")]');
-    $this->assertEquals(1, count($forms));
+    $this->assertCount(1, $forms);
     // Strip query params off the action before asserting.
     $url = parse_url($forms[0]->getAttribute('action'))['path'];
     $this->assertEquals(Url::fromRoute('node.add', ['node_type' => 'page'])->toString(), $url);
diff --git a/core/modules/system/tests/src/Kernel/Action/ActionTest.php b/core/modules/system/tests/src/Kernel/Action/ActionTest.php
index 94eb5e8933cc592c5842d8c44980a56a5dbad35b..e2607a92778545b4f5deeda7dfbcc95e33ec84f3 100644
--- a/core/modules/system/tests/src/Kernel/Action/ActionTest.php
+++ b/core/modules/system/tests/src/Kernel/Action/ActionTest.php
@@ -61,12 +61,12 @@ public function testOperations() {
     $user_storage = $this->container->get('entity_type.manager')->getStorage('user');
     $account = $user_storage->create(['name' => $name, 'bundle' => 'user']);
     $loaded_accounts = $user_storage->loadMultiple();
-    $this->assertEqual(count($loaded_accounts), 0);
+    $this->assertCount(0, $loaded_accounts);
 
     // Execute the 'save entity' action.
     $action->execute($account);
     $loaded_accounts = $user_storage->loadMultiple();
-    $this->assertEqual(count($loaded_accounts), 1);
+    $this->assertCount(1, $loaded_accounts);
     $account = reset($loaded_accounts);
     $this->assertEqual($name, $account->label());
   }
diff --git a/core/modules/taxonomy/tests/src/Functional/LoadMultipleTest.php b/core/modules/taxonomy/tests/src/Functional/LoadMultipleTest.php
index b8ec2e6243a89e1405733e9e87ca5b2c0d4cc09b..92b1aa48b758caeef3ccd03280bb0cf44991711a 100644
--- a/core/modules/taxonomy/tests/src/Functional/LoadMultipleTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/LoadMultipleTest.php
@@ -55,13 +55,13 @@ public function testTaxonomyTermMultipleLoad() {
 
     // Load terms from the vocabulary by vid.
     $terms3 = $term_storage->loadByProperties(['vid' => $vocabulary->id()]);
-    $this->assertEqual(count($terms3), 4, 'Correct number of terms were loaded.');
+    $this->assertCount(4, $terms3, 'Correct number of terms were loaded.');
     $this->assertFalse(isset($terms3[$deleted->id()]));
 
     // Create a single term and load it by name.
     $term = $this->createTerm($vocabulary);
     $loaded_terms = $term_storage->loadByProperties(['name' => $term->getName()]);
-    $this->assertEqual(count($loaded_terms), 1, 'One term was loaded.');
+    $this->assertCount(1, $loaded_terms, 'One term was loaded.');
     $loaded_term = reset($loaded_terms);
     $this->assertEqual($term->id(), $loaded_term->id(), 'Term loaded by name successfully.');
   }
diff --git a/core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php b/core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php
index 9b45ce67944dd4e831e57078f1a0779bfed6b364..f3fe6b67c0c7d3620ea20fafe1201958824c4396 100644
--- a/core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TermAutocompleteTest.php
@@ -179,14 +179,14 @@ public function testAutocompleteCountResults() {
       $this->autocompleteUrl,
       ['query' => ['q' => 'aaa 10']]
     );
-    $this->assertEqual(1, count($data), 'Autocomplete returned 1 result');
+    $this->assertCount(1, $data, 'Autocomplete returned 1 result');
 
     // Test the correct number of matches when multiple are partial matches.
     $data = $this->drupalGetJson(
       $this->autocompleteUrl,
       ['query' => ['q' => 'aaa 1']]
     );
-    $this->assertEqual(3, count($data), 'Autocomplete returned 3 results');
+    $this->assertCount(3, $data, 'Autocomplete returned 3 results');
 
     // Tests that only 10 results are returned, even if there are more than 10
     // matches.
@@ -194,7 +194,7 @@ public function testAutocompleteCountResults() {
       $this->autocompleteUrl,
       ['query' => ['q' => 'aaa']]
     );
-    $this->assertEqual(10, count($data), 'Autocomplete returned only 10 results (for over 10 matches)');
+    $this->assertCount(10, $data, 'Autocomplete returned only 10 results (for over 10 matches)');
   }
 
   /**
diff --git a/core/modules/taxonomy/tests/src/Functional/TermTest.php b/core/modules/taxonomy/tests/src/Functional/TermTest.php
index 5060ab631da10fc752e2bb8814f1e74a0f929c3a..7202016461332c4344122f3301158d0846090744 100644
--- a/core/modules/taxonomy/tests/src/Functional/TermTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/TermTest.php
@@ -529,11 +529,11 @@ public function testTaxonomyGetTermByName() {
 
     // Load multiple terms with the same name.
     $terms = taxonomy_term_load_multiple_by_name($term->getName());
-    $this->assertEqual(count($terms), 2, 'Two terms loaded with the same name.');
+    $this->assertCount(2, $terms, 'Two terms loaded with the same name.');
 
     // Load single term when restricted to one vocabulary.
     $terms = taxonomy_term_load_multiple_by_name($term->getName(), $this->vocabulary->id());
-    $this->assertEqual(count($terms), 1, 'One term loaded when restricted by vocabulary.');
+    $this->assertCount(1, $terms, 'One term loaded when restricted by vocabulary.');
     $this->assertTrue(isset($terms[$term->id()]), 'Term loaded using exact name and vocabulary machine name.');
 
     // Create a new term with another name.
@@ -546,7 +546,7 @@ public function testTaxonomyGetTermByName() {
 
     // Try to load terms filtering by a non-existing vocabulary.
     $terms = taxonomy_term_load_multiple_by_name($term2->getName(), 'non_existing_vocabulary');
-    $this->assertEqual(count($terms), 0, 'No terms loaded when restricted by a non-existing vocabulary.');
+    $this->assertCount(0, $terms, 'No terms loaded when restricted by a non-existing vocabulary.');
   }
 
   /**
@@ -598,7 +598,7 @@ public function testTermBreadcrumbs() {
     // Check the breadcrumb on the term edit page.
     $this->drupalGet('taxonomy/term/' . $term->id() . '/edit');
     $breadcrumbs = $this->getSession()->getPage()->findAll('css', 'nav.breadcrumb ol li a');
-    $this->assertIdentical(count($breadcrumbs), 2, 'The breadcrumbs are present on the page.');
+    $this->assertCount(2, $breadcrumbs, 'The breadcrumbs are present on the page.');
     $this->assertIdentical($breadcrumbs[0]->getText(), 'Home', 'First breadcrumb text is Home');
     $this->assertIdentical($breadcrumbs[1]->getText(), $term->label(), 'Second breadcrumb text is term name on term edit page.');
     $this->assertEscaped($breadcrumbs[1]->getText(), 'breadcrumbs displayed and escaped.');
@@ -606,7 +606,7 @@ public function testTermBreadcrumbs() {
     // Check the breadcrumb on the term delete page.
     $this->drupalGet('taxonomy/term/' . $term->id() . '/delete');
     $breadcrumbs = $this->getSession()->getPage()->findAll('css', 'nav.breadcrumb ol li a');
-    $this->assertIdentical(count($breadcrumbs), 2, 'The breadcrumbs are present on the page.');
+    $this->assertCount(2, $breadcrumbs, 'The breadcrumbs are present on the page.');
     $this->assertIdentical($breadcrumbs[0]->getText(), 'Home', 'First breadcrumb text is Home');
     $this->assertIdentical($breadcrumbs[1]->getText(), $term->label(), 'Second breadcrumb text is term name on term delete page.');
     $this->assertEscaped($breadcrumbs[1]->getText(), 'breadcrumbs displayed and escaped.');
diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php
index 67bf8e5f34a013b2085de5cf9ea9c571b21e61e6..a136d51669f245652563d353511c64092e07e70d 100644
--- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyFieldAllTermsTest.php
@@ -34,13 +34,13 @@ public function testViewsHandlerAllTermsField() {
     $this->drupalGet('taxonomy_all_terms_test');
 
     $actual = $this->xpath('//a[@href="' . $this->term1->toUrl()->toString() . '"]');
-    $this->assertEqual(count($actual), 2, 'Correct number of taxonomy term1 links');
+    $this->assertCount(2, $actual, 'Correct number of taxonomy term1 links');
     $this->assertEqual($actual[0]->getText(), $this->term1->label());
     $this->assertEqual($actual[1]->getText(), $this->term1->label());
     $this->assertEscaped($this->term1->label());
 
     $actual = $this->xpath('//a[@href="' . $this->term2->toUrl()->toString() . '"]');
-    $this->assertEqual(count($actual), 2, 'Correct number of taxonomy term2 links');
+    $this->assertCount(2, $actual, 'Correct number of taxonomy term2 links');
     $this->assertEqual($actual[0]->getText(), $this->term2->label());
     $this->assertEqual($actual[1]->getText(), $this->term2->label());
   }
diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidUiTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidUiTest.php
index 1285404ec908c1b4e2a674e0d6b821705d960b80..f9fbce2392651d9d70f2773ca3c85c13ea765360 100644
--- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidUiTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidUiTest.php
@@ -163,11 +163,11 @@ public function testExposedFilter() {
     // Only the nodes with the selected term should be shown.
     $this->drupalGet('test-filter-taxonomy-index-tid');
     $xpath = $this->xpath('//div[@class="view-content"]//a');
-    $this->assertIdentical(2, count($xpath));
+    $this->assertCount(2, $xpath);
     $xpath = $this->xpath('//div[@class="view-content"]//a[@href=:href]', [':href' => $node2->toUrl()->toString()]);
-    $this->assertIdentical(1, count($xpath));
+    $this->assertCount(1, $xpath);
     $xpath = $this->xpath('//div[@class="view-content"]//a[@href=:href]', [':href' => $node3->toUrl()->toString()]);
-    $this->assertIdentical(1, count($xpath));
+    $this->assertCount(1, $xpath);
 
     // Expose the filter.
     $this->drupalPostForm('admin/structure/views/nojs/handler/test_filter_taxonomy_index_tid/default/filter/tid', [], 'Expose filter');
@@ -183,9 +183,9 @@ public function testExposedFilter() {
     // shown.
     $this->drupalGet('test-filter-taxonomy-index-tid');
     $xpath = $this->xpath('//div[@class="view-content"]//a');
-    $this->assertIdentical(1, count($xpath));
+    $this->assertCount(1, $xpath);
     $xpath = $this->xpath('//div[@class="view-content"]//a[@href=:href]', [':href' => $node1->toUrl()->toString()]);
-    $this->assertIdentical(1, count($xpath));
+    $this->assertCount(1, $xpath);
 
     // Set the operator to 'not empty'.
     $this->drupalPostForm('admin/structure/views/nojs/handler/test_filter_taxonomy_index_tid/default/filter/tid', ['options[operator]' => 'not empty'], 'Apply');
@@ -196,13 +196,13 @@ public function testExposedFilter() {
     // shown.
     $this->drupalGet('test-filter-taxonomy-index-tid');
     $xpath = $this->xpath('//div[@class="view-content"]//a');
-    $this->assertIdentical(3, count($xpath));
+    $this->assertCount(3, $xpath);
     $xpath = $this->xpath('//div[@class="view-content"]//a[@href=:href]', [':href' => $node2->toUrl()->toString()]);
-    $this->assertIdentical(1, count($xpath));
+    $this->assertCount(1, $xpath);
     $xpath = $this->xpath('//div[@class="view-content"]//a[@href=:href]', [':href' => $node3->toUrl()->toString()]);
-    $this->assertIdentical(1, count($xpath));
+    $this->assertCount(1, $xpath);
     $xpath = $this->xpath('//div[@class="view-content"]//a[@href=:href]', [':href' => $node4->toUrl()->toString()]);
-    $this->assertIdentical(1, count($xpath));
+    $this->assertCount(1, $xpath);
 
     // Select 'Term ID' as the field to be displayed.
     $edit = ['name[taxonomy_term_field_data.tid]' => TRUE];
diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php
index 9e69ca3c1881d265896d89dfc7c6ebd32f951220..1799ca65120201fd771dd1aa7df51946c584bcfc 100644
--- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php
+++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyTermViewTest.php
@@ -148,7 +148,7 @@ public function testTaxonomyTermView() {
     $condition = $query->conditions();
     // We only want to check the no. of conditions in the query.
     unset($condition['#conjunction']);
-    $this->assertEqual(1, count($condition));
+    $this->assertCount(1, $condition);
 
     // Clear permissions for anonymous users to check access for default views.
     Role::load(RoleInterface::ANONYMOUS_ID)->revokePermission('access content')->save();
diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/MigrateTaxonomyTermStubTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/MigrateTaxonomyTermStubTest.php
index 44bb1b87a6912d3c47741830e399386b0139df0a..23fdd73f633c23014b16cf8e51793e3d6ad63684 100644
--- a/core/modules/taxonomy/tests/src/Kernel/Migrate/MigrateTaxonomyTermStubTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/MigrateTaxonomyTermStubTest.php
@@ -79,7 +79,7 @@ public function testStubWithWeightMapping() {
     $stub_entity = Term::load(2);
     $this->assertNotEmpty($stub_entity, 'Stub successfully created');
     if ($stub_entity) {
-      $this->assertIdentical(count($stub_entity->validate()), 0, 'Stub is a valid entity');
+      $this->assertCount(0, $stub_entity->validate(), 'Stub is a valid entity');
     }
   }
 
diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeComplete.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeComplete.php
index cb06411171be2026fa6c3c0ec45a77986fbfc34a..8d311f024e00441034f206d40c835f21efefeb4d 100644
--- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeComplete.php
+++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeComplete.php
@@ -56,10 +56,10 @@ public function testTermNode() {
 
     $nodes = Node::loadMultiple([1, 2]);
     $node = $nodes[1];
-    $this->assertSame(1, count($node->field_vocabulary_1_i_0_));
+    $this->assertCount(1, $node->field_vocabulary_1_i_0_);
     $this->assertSame('1', $node->field_vocabulary_1_i_0_[0]->target_id);
     $node = $nodes[2];
-    $this->assertSame(2, count($node->field_vocabulary_2_i_1_));
+    $this->assertCount(2, $node->field_vocabulary_2_i_1_);
     $this->assertSame('2', $node->field_vocabulary_2_i_1_[0]->target_id);
     $this->assertSame('3', $node->field_vocabulary_2_i_1_[1]->target_id);
   }
diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php
index c61a50c6fe93b45eb607eb1adbe1d23194ddcd0c..b553228b8b8482600d3c7a1648e47aa4160e0290 100644
--- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeRevisionTest.php
@@ -32,7 +32,7 @@ protected function setUp(): void {
    */
   public function testTermRevisionNode() {
     $node = \Drupal::entityTypeManager()->getStorage('node')->loadRevision(2001);
-    $this->assertSame(2, count($node->field_vocabulary_3_i_2_));
+    $this->assertCount(2, $node->field_vocabulary_3_i_2_);
     $this->assertSame('4', $node->field_vocabulary_3_i_2_[0]->target_id);
     $this->assertSame('5', $node->field_vocabulary_3_i_2_[1]->target_id);
   }
diff --git a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php
index a49054b5dfe2faed823b5329d92bad280429fe0c..01ed3550db4aafa4fb92965c1a9329d436c727a0 100644
--- a/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/Migrate/d6/MigrateTermNodeTest.php
@@ -40,10 +40,10 @@ public function testTermNode() {
 
     $nodes = Node::loadMultiple([1, 2]);
     $node = $nodes[1];
-    $this->assertSame(1, count($node->field_vocabulary_1_i_0_));
+    $this->assertCount(1, $node->field_vocabulary_1_i_0_);
     $this->assertSame('1', $node->field_vocabulary_1_i_0_[0]->target_id);
     $node = $nodes[2];
-    $this->assertSame(2, count($node->field_vocabulary_2_i_1_));
+    $this->assertCount(2, $node->field_vocabulary_2_i_1_);
     $this->assertSame('2', $node->field_vocabulary_2_i_1_[0]->target_id);
     $this->assertSame('3', $node->field_vocabulary_2_i_1_[1]->target_id);
   }
diff --git a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
index f641bed3381a0a300cd9095f5372b9e85d84da43..8e6766928b4bd3018ff748d7bc6db1ccf88c02fe 100644
--- a/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/TermKernelTest.php
@@ -108,11 +108,11 @@ public function testTaxonomyVocabularyTree() {
      */
     // Count $term[1] parents with $max_depth = 1.
     $tree = $taxonomy_storage->loadTree($vocabulary->id(), $term[1]->id(), 1);
-    $this->assertEqual(1, count($tree), 'We have one parent with depth 1.');
+    $this->assertCount(1, $tree, 'We have one parent with depth 1.');
 
     // Count all vocabulary tree elements.
     $tree = $taxonomy_storage->loadTree($vocabulary->id());
-    $this->assertEqual(8, count($tree), 'We have all vocabulary tree elements.');
+    $this->assertCount(8, $tree, 'We have all vocabulary tree elements.');
 
     // Count elements in every tree depth.
     foreach ($tree as $element) {
@@ -130,19 +130,19 @@ public function testTaxonomyVocabularyTree() {
     $storage = \Drupal::entityTypeManager()->getStorage('taxonomy_term');
     // Count parents of $term[2].
     $parents = $storage->loadParents($term[2]->id());
-    $this->assertEqual(2, count($parents), 'The term has two parents.');
+    $this->assertCount(2, $parents, 'The term has two parents.');
 
     // Count parents of $term[3].
     $parents = $storage->loadParents($term[3]->id());
-    $this->assertEqual(1, count($parents), 'The term has one parent.');
+    $this->assertCount(1, $parents, 'The term has one parent.');
 
     // Identify all ancestors of $term[2].
     $ancestors = $storage->loadAllParents($term[2]->id());
-    $this->assertEqual(4, count($ancestors), 'The term has four ancestors including the term itself.');
+    $this->assertCount(4, $ancestors, 'The term has four ancestors including the term itself.');
 
     // Identify all ancestors of $term[3].
     $ancestors = $storage->loadAllParents($term[3]->id());
-    $this->assertEqual(5, count($ancestors), 'The term has five ancestors including the term itself.');
+    $this->assertCount(5, $ancestors, 'The term has five ancestors including the term itself.');
   }
 
   /**
diff --git a/core/modules/taxonomy/tests/src/Kernel/TermValidationTest.php b/core/modules/taxonomy/tests/src/Kernel/TermValidationTest.php
index 30f1c2e1077f34986827785cde3dd52a06f766da..06223e9afaa80ed28c2ce956693e61b4c9eb065e 100644
--- a/core/modules/taxonomy/tests/src/Kernel/TermValidationTest.php
+++ b/core/modules/taxonomy/tests/src/Kernel/TermValidationTest.php
@@ -40,30 +40,30 @@ public function testValidation() {
       'vid' => 'tags',
     ]);
     $violations = $term->validate();
-    $this->assertEqual(count($violations), 0, 'No violations when validating a default term.');
+    $this->assertCount(0, $violations, 'No violations when validating a default term.');
 
     $term->set('name', $this->randomString(256));
     $violations = $term->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when name is too long.');
+    $this->assertCount(1, $violations, 'Violation found when name is too long.');
     $this->assertEqual($violations[0]->getPropertyPath(), 'name.0.value');
     $field_label = $term->get('name')->getFieldDefinition()->getLabel();
     $this->assertEqual($violations[0]->getMessage(), t('%name: may not be longer than @max characters.', ['%name' => $field_label, '@max' => 255]));
 
     $term->set('name', NULL);
     $violations = $term->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when name is NULL.');
+    $this->assertCount(1, $violations, 'Violation found when name is NULL.');
     $this->assertEqual($violations[0]->getPropertyPath(), 'name');
     $this->assertEqual($violations[0]->getMessage(), t('This value should not be null.'));
     $term->set('name', 'test');
 
     $term->set('parent', 9999);
     $violations = $term->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when term parent is invalid.');
+    $this->assertCount(1, $violations, 'Violation found when term parent is invalid.');
     $this->assertEqual($violations[0]->getMessage(), new FormattableMarkup('The referenced entity (%type: %id) does not exist.', ['%type' => 'taxonomy_term', '%id' => 9999]));
 
     $term->set('parent', 0);
     $violations = $term->validate();
-    $this->assertEqual(count($violations), 0, 'No violations for parent id 0.');
+    $this->assertCount(0, $violations, 'No violations for parent id 0.');
   }
 
 }
diff --git a/core/modules/text/tests/src/Functional/TextFieldTest.php b/core/modules/text/tests/src/Functional/TextFieldTest.php
index 860d63de0dc59f53d461e0af0aec7d71b91f7355..a73e2d9362c12d842abfd00867821835c11828ad 100644
--- a/core/modules/text/tests/src/Functional/TextFieldTest.php
+++ b/core/modules/text/tests/src/Functional/TextFieldTest.php
@@ -68,10 +68,10 @@ public function testTextFieldValidation() {
       $entity->{$field_name}->value = str_repeat('x', $i);
       $violations = $entity->{$field_name}->validate();
       if ($i <= $max_length) {
-        $this->assertEqual(count($violations), 0, "Length $i does not cause validation error when max_length is $max_length");
+        $this->assertCount(0, $violations, "Length $i does not cause validation error when max_length is $max_length");
       }
       else {
-        $this->assertEqual(count($violations), 1, "Length $i causes validation error when max_length is $max_length");
+        $this->assertCount(1, $violations, "Length $i causes validation error when max_length is $max_length");
       }
     }
   }
diff --git a/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php b/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php
index e2498679e148166dd706a17e0cc47d4092da3102..16c011727446768862b805adcf586c70d8928cf6 100644
--- a/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php
+++ b/core/modules/toolbar/tests/src/Functional/ToolbarMenuTranslationTest.php
@@ -71,7 +71,7 @@ public function testToolbarClasses() {
 
     // Check that the class is on the item before we translate it.
     $xpath = $this->xpath('//a[contains(@class, "icon-system-admin-structure")]');
-    $this->assertEqual(count($xpath), 1, 'The menu item class ok before translation.');
+    $this->assertCount(1, $xpath, 'The menu item class ok before translation.');
 
     // Translate the menu item.
     $menu_item_translated = $this->randomMachineName();
@@ -100,7 +100,7 @@ public function testToolbarClasses() {
     // Toolbar icons are included based on the presence of a specific class on
     // the menu item. Ensure that class also exists for a translated menu item.
     $xpath = $this->xpath('//a[contains(@class, "icon-system-admin-structure")]');
-    $this->assertEqual(count($xpath), 1, 'The menu item class is the same.');
+    $this->assertCount(1, $xpath, 'The menu item class is the same.');
   }
 
 }
diff --git a/core/modules/tour/tests/src/Functional/TourTest.php b/core/modules/tour/tests/src/Functional/TourTest.php
index 5e53f335ad9fcb08a1eec7ba36b972a8edc5d74a..03749a8a665f559b19b8078a21cae5aa0ba9b266 100644
--- a/core/modules/tour/tests/src/Functional/TourTest.php
+++ b/core/modules/tour/tests/src/Functional/TourTest.php
@@ -81,28 +81,28 @@ public function testTourFunctionality() {
       ':href' => Url::fromRoute('<front>', [], ['absolute' => TRUE])->toString(),
       ':text' => 'Drupal',
     ]);
-    $this->assertEqual(count($elements), 1, 'Found Token replacement.');
+    $this->assertCount(1, $elements, 'Found Token replacement.');
 
     $elements = $this->cssSelect("li[data-id=tour-test-1] h2:contains('The first tip')");
-    $this->assertEqual(count($elements), 1, 'Found English variant of tip 1.');
+    $this->assertCount(1, $elements, 'Found English variant of tip 1.');
 
     $elements = $this->cssSelect("li[data-id=tour-test-2] h2:contains('The quick brown fox')");
-    $this->assertNotEqual(count($elements), 1, 'Did not find English variant of tip 2.');
+    $this->assertNotCount(1, $elements, 'Did not find English variant of tip 2.');
 
     $elements = $this->cssSelect("li[data-id=tour-test-1] h2:contains('La pioggia cade in spagna')");
-    $this->assertNotEqual(count($elements), 1, 'Did not find Italian variant of tip 1.');
+    $this->assertNotCount(1, $elements, 'Did not find Italian variant of tip 1.');
 
     // Ensure that plugins work.
     $elements = $this->xpath('//img[@src="http://local/image.png"]');
-    $this->assertEqual(count($elements), 1, 'Image plugin tip found.');
+    $this->assertCount(1, $elements, 'Image plugin tip found.');
 
     // Navigate to tour-test-2/subpath and verify the tour_test_2 tip is found.
     $this->drupalGet('tour-test-2/subpath');
     $elements = $this->cssSelect("li[data-id=tour-test-2] h2:contains('The quick brown fox')");
-    $this->assertEqual(count($elements), 1, 'Found English variant of tip 2.');
+    $this->assertCount(1, $elements, 'Found English variant of tip 2.');
 
     $elements = $this->cssSelect("li[data-id=tour-test-1] h2:contains('The first tip')");
-    $this->assertNotEqual(count($elements), 1, 'Did not find English variant of tip 1.');
+    $this->assertNotCount(1, $elements, 'Did not find English variant of tip 1.');
 
     // Enable Italian language and navigate to it/tour-test1 and verify italian
     // version of tip is found.
@@ -110,10 +110,10 @@ public function testTourFunctionality() {
     $this->drupalGet('it/tour-test-1');
 
     $elements = $this->cssSelect("li[data-id=tour-test-1] h2:contains('La pioggia cade in spagna')");
-    $this->assertEqual(count($elements), 1, 'Found Italian variant of tip 1.');
+    $this->assertCount(1, $elements, 'Found Italian variant of tip 1.');
 
     $elements = $this->cssSelect("li[data-id=tour-test-2] h2:contains('The quick brown fox')");
-    $this->assertNotEqual(count($elements), 1, 'Did not find English variant of tip 1.');
+    $this->assertNotCount(1, $elements, 'Did not find English variant of tip 1.');
 
     // Programmatically create a tour for use through the remainder of the test.
     $tour = Tour::create([
@@ -166,12 +166,12 @@ public function testTourFunctionality() {
     // Navigate to tour-test-1 and verify the new tip is found.
     $this->drupalGet('tour-test-1');
     $elements = $this->cssSelect("li[data-id=tour-code-test-1] h2:contains('The rain in spain')");
-    $this->assertEqual(count($elements), 1, 'Found the required tip markup for tip 4');
+    $this->assertCount(1, $elements, 'Found the required tip markup for tip 4');
 
     // Verify that the weight sorting works by ensuring the lower weight item
     // (tip 4) has the 'End tour' button.
     $elements = $this->cssSelect("li[data-id=tour-code-test-1][data-text='End tour']");
-    $this->assertEqual(count($elements), 1, 'Found code tip was weighted last and had "End tour".');
+    $this->assertCount(1, $elements, 'Found code tip was weighted last and had "End tour".');
 
     // Test hook_tour_alter().
     $this->assertText('Altered by hook_tour_tips_alter');
@@ -184,7 +184,7 @@ public function testTourFunctionality() {
       ':data_id' => 'tour-test-1',
       ':text' => 'The first tip',
     ]);
-    $this->assertEqual(count($elements), 1, 'Found English variant of tip 1.');
+    $this->assertCount(1, $elements, 'Found English variant of tip 1.');
 
     // Navigate to tour-test-3 and verify the tour_test_1 tip is not found with
     // appropriate classes.
@@ -194,7 +194,7 @@ public function testTourFunctionality() {
       ':data_id' => 'tour-test-1',
       ':text' => 'The first tip',
     ]);
-    $this->assertEqual(count($elements), 0, 'Did not find English variant of tip 1.');
+    $this->assertCount(0, $elements, 'Did not find English variant of tip 1.');
   }
 
 }
diff --git a/core/modules/tour/tests/src/Kernel/TourPluginTest.php b/core/modules/tour/tests/src/Kernel/TourPluginTest.php
index 1c1bd73640165f764e724ca364a0904d2de855bc..03c49771351a887f3f72059cca1a5a309cdeb572 100644
--- a/core/modules/tour/tests/src/Kernel/TourPluginTest.php
+++ b/core/modules/tour/tests/src/Kernel/TourPluginTest.php
@@ -36,7 +36,7 @@ protected function setUp(): void {
    * Test tour plugins.
    */
   public function testTourPlugins() {
-    $this->assertIdentical(count($this->pluginManager->getDefinitions()), 1, 'Only tour plugins for the enabled modules were returned.');
+    $this->assertCount(1, $this->pluginManager->getDefinitions(), 'Only tour plugins for the enabled modules were returned.');
   }
 
 }
diff --git a/core/modules/tracker/tests/src/Functional/TrackerTest.php b/core/modules/tracker/tests/src/Functional/TrackerTest.php
index bc64c54f1b6c5fe6084cf30046daee57bc9295b9..76a44724a9d57d217df2ace92abf0f741c6c128a 100644
--- a/core/modules/tracker/tests/src/Functional/TrackerTest.php
+++ b/core/modules/tracker/tests/src/Functional/TrackerTest.php
@@ -463,8 +463,8 @@ public function testTrackerAdminUnpublish() {
   public function assertHistoryMetadata($node_id, $node_timestamp, $node_last_comment_timestamp, $library_is_present = TRUE) {
     $settings = $this->getDrupalSettings();
     $this->assertIdentical($library_is_present, isset($settings['ajaxPageState']) && in_array('tracker/history', explode(',', $settings['ajaxPageState']['libraries'])), 'drupal.tracker-history library is present.');
-    $this->assertIdentical(1, count($this->xpath('//table/tbody/tr/td[@data-history-node-id="' . $node_id . '" and @data-history-node-timestamp="' . $node_timestamp . '"]')), 'Tracker table cell contains the data-history-node-id and data-history-node-timestamp attributes for the node.');
-    $this->assertIdentical(1, count($this->xpath('//table/tbody/tr/td[@data-history-node-last-comment-timestamp="' . $node_last_comment_timestamp . '"]')), 'Tracker table cell contains the data-history-node-last-comment-timestamp attribute for the node.');
+    $this->assertCount(1, $this->xpath('//table/tbody/tr/td[@data-history-node-id="' . $node_id . '" and @data-history-node-timestamp="' . $node_timestamp . '"]'), 'Tracker table cell contains the data-history-node-id and data-history-node-timestamp attributes for the node.');
+    $this->assertCount(1, $this->xpath('//table/tbody/tr/td[@data-history-node-last-comment-timestamp="' . $node_last_comment_timestamp . '"]'), 'Tracker table cell contains the data-history-node-last-comment-timestamp attribute for the node.');
   }
 
 }
diff --git a/core/modules/user/tests/src/Functional/UserAccountLinksTest.php b/core/modules/user/tests/src/Functional/UserAccountLinksTest.php
index 69f37a061589994cec0a9e3df72aad222b2c20c6..76fb4889380a7b81d04bc656d18d1de213c251ea 100644
--- a/core/modules/user/tests/src/Functional/UserAccountLinksTest.php
+++ b/core/modules/user/tests/src/Functional/UserAccountLinksTest.php
@@ -51,14 +51,14 @@ public function testSecondaryMenu() {
       ':href' => 'user',
       ':text' => 'My account',
     ]);
-    $this->assertEqual(count($link), 1, 'My account link is in secondary menu.');
+    $this->assertCount(1, $link, 'My account link is in secondary menu.');
 
     $link = $this->xpath('//ul[@class=:menu_class]/li/a[contains(@href, :href) and text()=:text]', [
       ':menu_class' => 'menu',
       ':href' => 'user/logout',
       ':text' => 'Log out',
     ]);
-    $this->assertEqual(count($link), 1, 'Log out link is in secondary menu.');
+    $this->assertCount(1, $link, 'Log out link is in secondary menu.');
 
     // Log out and get the homepage.
     $this->drupalLogout();
@@ -70,7 +70,7 @@ public function testSecondaryMenu() {
       ':href' => 'user/login',
       ':text' => 'Log in',
     ]);
-    $this->assertEqual(count($link), 1, 'Log in link is in secondary menu.');
+    $this->assertCount(1, $link, 'Log in link is in secondary menu.');
   }
 
   /**
@@ -87,7 +87,7 @@ public function testDisabledAccountLink() {
       ':href' => 'user',
       ':text' => 'My account',
     ]);
-    $this->assertEqual(count($link), 1, 'My account link is in the secondary menu.');
+    $this->assertCount(1, $link, 'My account link is in the secondary menu.');
 
     // Verify that the 'My account' link is enabled. Do not assume the value of
     // auto-increment is 1. Use XPath to obtain input element id and name using
@@ -109,7 +109,7 @@ public function testDisabledAccountLink() {
       ':href' => 'user',
       ':text' => 'My account',
     ]);
-    $this->assertEqual(count($link), 0, 'My account link is not in the secondary menu.');
+    $this->assertCount(0, $link, 'My account link is not in the secondary menu.');
   }
 
   /**
diff --git a/core/modules/user/tests/src/Functional/UserAdminTest.php b/core/modules/user/tests/src/Functional/UserAdminTest.php
index 431afa8ab77a17b510a8890845d153631fe2aae6..a428bac8c8215b16ae867faca4dd7fa3f6dee68f 100644
--- a/core/modules/user/tests/src/Functional/UserAdminTest.php
+++ b/core/modules/user/tests/src/Functional/UserAdminTest.php
@@ -76,12 +76,12 @@ public function testUserAdmin() {
     // Filter the users by name/email.
     $this->drupalGet('admin/people', ['query' => ['user' => $user_a->getAccountName()]]);
     $result = $this->xpath('//table/tbody/tr');
-    $this->assertEqual(1, count($result), 'Filter by username returned the right amount.');
+    $this->assertCount(1, $result, 'Filter by username returned the right amount.');
     $this->assertEqual($user_a->getAccountName(), $result[0]->find('xpath', '/td[2]/a')->getText(), 'Filter by username returned the right user.');
 
     $this->drupalGet('admin/people', ['query' => ['user' => $user_a->getEmail()]]);
     $result = $this->xpath('//table/tbody/tr');
-    $this->assertEqual(1, count($result), 'Filter by username returned the right amount.');
+    $this->assertCount(1, $result, 'Filter by username returned the right amount.');
     $this->assertEqual($user_a->getAccountName(), $result[0]->find('xpath', '/td[2]/a')->getText(), 'Filter by username returned the right user.');
 
     // Filter the users by permission 'administer taxonomy'.
diff --git a/core/modules/user/tests/src/Functional/UserCreateTest.php b/core/modules/user/tests/src/Functional/UserCreateTest.php
index f49c6c19996cad6dcf165544cae771a342837ade..fef1a53b05a9f74577272dd868f06d3ab15e9446 100644
--- a/core/modules/user/tests/src/Functional/UserCreateTest.php
+++ b/core/modules/user/tests/src/Functional/UserCreateTest.php
@@ -109,11 +109,11 @@ public function testUserAdd() {
 
       if ($notify) {
         $this->assertText(t('A welcome message with further instructions has been emailed to the new user @name.', ['@name' => $edit['name']]), 'User created');
-        $this->assertEqual(count($this->drupalGetMails()), 1, 'Notification email sent');
+        $this->assertCount(1, $this->drupalGetMails(), 'Notification email sent');
       }
       else {
         $this->assertText(t('Created a new user account for @name. No email has been sent.', ['@name' => $edit['name']]), 'User created');
-        $this->assertEqual(count($this->drupalGetMails()), 0, 'Notification email not sent');
+        $this->assertCount(0, $this->drupalGetMails(), 'Notification email not sent');
       }
 
       $this->drupalGet('admin/people');
diff --git a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
index 19de5960e7a87536e93e15ffe7f684cca00cf813..bd77307fc8955aa2ab00aeb6607c7d41621fea3b 100644
--- a/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
+++ b/core/modules/user/tests/src/Functional/UserPasswordResetTest.php
@@ -387,7 +387,7 @@ public function assertValidPasswordReset($name) {
   public function assertNoValidPasswordReset($name) {
     // Make sure the error text is displayed and no email sent.
     $this->assertText(t('@name is not recognized as a username or an email address.', ['@name' => $name]), 'Validation error message shown when trying to request password for invalid account.');
-    $this->assertEqual(count($this->drupalGetMails(['id' => 'user_password_reset'])), 0, 'No e-mail was sent when requesting a password for an invalid account.');
+    $this->assertCount(0, $this->drupalGetMails(['id' => 'user_password_reset']), 'No e-mail was sent when requesting a password for an invalid account.');
   }
 
   /**
diff --git a/core/modules/user/tests/src/Functional/UserPictureTest.php b/core/modules/user/tests/src/Functional/UserPictureTest.php
index 16fdfd41b2422c18c626804a58d500154e629a4c..b7fd36408a32e67fae4dd0a0fabd285005799902 100644
--- a/core/modules/user/tests/src/Functional/UserPictureTest.php
+++ b/core/modules/user/tests/src/Functional/UserPictureTest.php
@@ -120,7 +120,7 @@ public function testPictureOnNodeComment() {
     // Verify that the image is displayed on the node page.
     $this->drupalGet('node/' . $node->id());
     $elements = $this->cssSelect('.node__meta .field--name-user-picture img[alt="' . $alt_text . '"][src="' . $image_url . '"]');
-    $this->assertEqual(count($elements), 1, 'User picture with alt text found on node page.');
+    $this->assertCount(1, $elements, 'User picture with alt text found on node page.');
 
     // Enable user pictures on comments, instead of nodes.
     $this->config('system.theme.global')
@@ -133,7 +133,7 @@ public function testPictureOnNodeComment() {
     ];
     $this->drupalPostForm('comment/reply/node/' . $node->id() . '/comment', $edit, t('Save'));
     $elements = $this->cssSelect('.comment__meta .field--name-user-picture img[alt="' . $alt_text . '"][src="' . $image_url . '"]');
-    $this->assertEqual(count($elements), 1, 'User picture with alt text found on the comment.');
+    $this->assertCount(1, $elements, 'User picture with alt text found on the comment.');
 
     // Disable user pictures on comments and nodes.
     $this->config('system.theme.global')
diff --git a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php
index bd8e0424e350b41c93ce8e4a8868bc26bbbe52e3..bd5505278cf09551e7327d0e3ff6a9a4a11df7f9 100644
--- a/core/modules/user/tests/src/Functional/UserRoleAdminTest.php
+++ b/core/modules/user/tests/src/Functional/UserRoleAdminTest.php
@@ -53,7 +53,7 @@ public function testRoleAdministration() {
       ':classes' => 'tabs primary',
       ':text' => 'Roles',
     ]);
-    $this->assertEqual(count($tabs), 1, 'Found roles tab');
+    $this->assertCount(1, $tabs, 'Found roles tab');
 
     // Test adding a role. (In doing so, we use a role name that happens to
     // correspond to an integer, to test that the role administration pages
diff --git a/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php b/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php
index 39e4b048ae2748eed89c1f2c142e138b38ba93bf..10ac272eca89affbb6bad39164dbf609a47a433e 100644
--- a/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php
+++ b/core/modules/user/tests/src/Functional/Views/UserFieldsAccessChangeTest.php
@@ -72,14 +72,14 @@ public function testUserNameLink() {
     $this->drupalGet('test_user_fields_access');
     $this->assertText($test_user->getAccountName(), 'Found user in view');
     $result = $this->xpath($xpath);
-    $this->assertEqual(0, count($result), 'User is not a link');
+    $this->assertCount(0, $result, 'User is not a link');
 
     // Assign sub-admin role to grant extra access.
     $user = $this->drupalCreateUser(['sub-admin']);
     $this->drupalLogin($user);
     $this->drupalGet('test_user_fields_access');
     $result = $this->xpath($xpath);
-    $this->assertEqual(1, count($result), 'User is a link');
+    $this->assertCount(1, $result, 'User is a link');
   }
 
 }
diff --git a/core/modules/user/tests/src/Kernel/UserEntityReferenceTest.php b/core/modules/user/tests/src/Kernel/UserEntityReferenceTest.php
index efafda0e3ac686bc94447da21e07a31232e53845..e642e3acac3877ac8f3c69d67c022fa08abecf68 100644
--- a/core/modules/user/tests/src/Kernel/UserEntityReferenceTest.php
+++ b/core/modules/user/tests/src/Kernel/UserEntityReferenceTest.php
@@ -81,7 +81,7 @@ public function testUserSelectionByRole() {
     $autocomplete = \Drupal::service('entity.autocomplete_matcher');
 
     $matches = $autocomplete->getMatches('user', 'default', $field_definition->getSetting('handler_settings'), 'aabb');
-    $this->assertEqual(count($matches), 2);
+    $this->assertCount(2, $matches);
     $users = [];
     foreach ($matches as $match) {
       $users[] = $match['label'];
@@ -91,7 +91,7 @@ public function testUserSelectionByRole() {
     $this->assertFalse(in_array($user3->label(), $users));
 
     $matches = $autocomplete->getMatches('user', 'default', $field_definition->getSetting('handler_settings'), 'aabbbb');
-    $this->assertEqual(count($matches), 0, '');
+    $this->assertCount(0, $matches);
   }
 
 }
diff --git a/core/modules/user/tests/src/Kernel/UserValidationTest.php b/core/modules/user/tests/src/Kernel/UserValidationTest.php
index b12d7379a149e8502de1c00b1a031e400719d513..3884cc592551d5aaecd51d739b18db756dac35a8 100644
--- a/core/modules/user/tests/src/Kernel/UserValidationTest.php
+++ b/core/modules/user/tests/src/Kernel/UserValidationTest.php
@@ -82,14 +82,14 @@ public function testValidation() {
       'mail' => 'test@example.com',
     ]);
     $violations = $user->validate();
-    $this->assertEqual(count($violations), 0, 'No violations when validating a default user.');
+    $this->assertCount(0, $violations, 'No violations when validating a default user.');
 
     // Only test one example invalid name here, the rest is already covered in
     // the testUsernames() method in this class.
     $name = $this->randomMachineName(61);
     $user->set('name', $name);
     $violations = $user->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when name is too long.');
+    $this->assertCount(1, $violations, 'Violation found when name is too long.');
     $this->assertEqual($violations[0]->getPropertyPath(), 'name');
     $this->assertEqual($violations[0]->getMessage(), t('The username %name is too long: it must be %max characters or less.', ['%name' => $name, '%max' => 60]));
 
@@ -101,7 +101,7 @@ public function testValidation() {
     $user2->save();
     $user->set('name', 'existing');
     $violations = $user->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found on name collision.');
+    $this->assertCount(1, $violations, 'Violation found on name collision.');
     $this->assertEqual($violations[0]->getPropertyPath(), 'name');
     $this->assertEqual($violations[0]->getMessage(), t('The username %name is already taken.', ['%name' => 'existing']));
 
@@ -110,7 +110,7 @@ public function testValidation() {
 
     $user->set('mail', 'invalid');
     $violations = $user->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when email is invalid');
+    $this->assertCount(1, $violations, 'Violation found when email is invalid');
     $this->assertEqual($violations[0]->getPropertyPath(), 'mail.0.value');
     $this->assertEqual($violations[0]->getMessage(), t('This value is not a valid email address.'));
 
@@ -121,7 +121,7 @@ public function testValidation() {
     //   overlaps with the implicit constraint of the 'email' property type used
     //   in EmailItem::propertyDefinitions(). Resolve this in
     //   https://www.drupal.org/node/2023465.
-    $this->assertEqual(count($violations), 2, 'Violations found when email is too long');
+    $this->assertCount(2, $violations, 'Violations found when email is too long');
     $this->assertEqual($violations[0]->getPropertyPath(), 'mail.0.value');
     $this->assertEqual($violations[0]->getMessage(), t('%name: the email address can not be longer than @max characters.', ['%name' => $user->get('mail')->getFieldDefinition()->getLabel(), '@max' => Email::EMAIL_MAX_LENGTH]));
     $this->assertEqual($violations[1]->getPropertyPath(), 'mail.0.value');
@@ -130,12 +130,12 @@ public function testValidation() {
     // Provoke an email collision with an existing user.
     $user->set('mail', 'existing@example.com');
     $violations = $user->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when email already exists.');
+    $this->assertCount(1, $violations, 'Violation found when email already exists.');
     $this->assertEqual($violations[0]->getPropertyPath(), 'mail');
     $this->assertEqual($violations[0]->getMessage(), t('The email address %mail is already taken.', ['%mail' => 'existing@example.com']));
     $user->set('mail', NULL);
     $violations = $user->validate();
-    $this->assertEqual(count($violations), 1, 'Email addresses may not be removed');
+    $this->assertCount(1, $violations, 'Email addresses may not be removed');
     $this->assertEqual($violations[0]->getPropertyPath(), 'mail');
     $this->assertEqual($violations[0]->getMessage(), t('@name field is required.', ['@name' => $user->getFieldDefinition('mail')->getLabel()]));
     $user->set('mail', 'someone@example.com');
@@ -148,7 +148,7 @@ public function testValidation() {
 
     $user->set('init', 'invalid');
     $violations = $user->validate();
-    $this->assertEqual(count($violations), 1, 'Violation found when init email is invalid');
+    $this->assertCount(1, $violations, 'Violation found when init email is invalid');
     $user->set('init', NULL);
 
     $user->set('langcode', 'invalid');
@@ -174,11 +174,11 @@ public function testValidation() {
       'roles' => ['role1', 'role2'],
     ]);
     $violations = $user->validate();
-    $this->assertEqual(count($violations), 0);
+    $this->assertCount(0, $violations);
 
     $user->roles[1]->target_id = 'unknown_role';
     $violations = $user->validate();
-    $this->assertEqual(count($violations), 1);
+    $this->assertCount(1, $violations);
     $this->assertEqual($violations[0]->getPropertyPath(), 'roles.1.target_id');
     $this->assertEqual($violations[0]->getMessage(), t('The referenced entity (%entity_type: %name) does not exist.', ['%entity_type' => 'user_role', '%name' => 'unknown_role']));
   }
@@ -215,7 +215,7 @@ protected function assertLengthViolation(EntityInterface $entity, $field_name, $
    */
   protected function assertAllowedValuesViolation(EntityInterface $entity, $field_name) {
     $violations = $entity->validate();
-    $this->assertEqual(count($violations), 1, "Allowed values violation for $field_name found.");
+    $this->assertCount(1, $violations, "Allowed values violation for $field_name found.");
     $this->assertEqual($violations[0]->getPropertyPath(), $field_name === 'langcode' ? "$field_name.0" : "$field_name.0.value");
     $this->assertEqual($violations[0]->getMessage(), t('The value you selected is not a valid choice.'));
   }
diff --git a/core/modules/user/tests/src/Kernel/Views/HandlerFilterPermissionTest.php b/core/modules/user/tests/src/Kernel/Views/HandlerFilterPermissionTest.php
index b005f62adaabfbac668823d8a6cfd7db8b0e9005..1ca7e78eab68fa814a0b90e8074411725f3deeed 100644
--- a/core/modules/user/tests/src/Kernel/Views/HandlerFilterPermissionTest.php
+++ b/core/modules/user/tests/src/Kernel/Views/HandlerFilterPermissionTest.php
@@ -38,7 +38,7 @@ public function testFilterPermission() {
     $view->initHandlers();
     $view->filter['permission']->value = ['non_existent_permission'];
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 4, 'A non existent permission is not filtered so everything is the result.');
+    $this->assertCount(4, $view->result, 'A non existent permission is not filtered so everything is the result.');
     $expected[] = ['uid' => 1];
     $expected[] = ['uid' => 2];
     $expected[] = ['uid' => 3];
@@ -50,7 +50,7 @@ public function testFilterPermission() {
     $view->initHandlers();
     $view->filter['permission']->value = ['administer permissions'];
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 2);
+    $this->assertCount(2, $view->result);
     $expected = [];
     $expected[] = ['uid' => 3];
     $expected[] = ['uid' => 4];
@@ -62,7 +62,7 @@ public function testFilterPermission() {
     $view->filter['permission']->operator = 'not';
     $view->filter['permission']->value = ['administer users'];
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 3);
+    $this->assertCount(3, $view->result);
     $expected = [];
     $expected[] = ['uid' => 1];
     $expected[] = ['uid' => 2];
@@ -75,7 +75,7 @@ public function testFilterPermission() {
     $view->filter['permission']->operator = 'not';
     $view->filter['permission']->value = ['administer users', 'administer permissions'];
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 2);
+    $this->assertCount(2, $view->result);
     $expected = [];
     $expected[] = ['uid' => 1];
     $expected[] = ['uid' => 2];
@@ -86,7 +86,7 @@ public function testFilterPermission() {
     $view->initHandlers();
     $view->filter['permission']->value = ['administer users'];
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 1);
+    $this->assertCount(1, $view->result);
     $expected = [];
     $expected[] = ['uid' => 4];
     $this->assertIdenticalResultset($view, $expected, $column_map);
diff --git a/core/modules/views/tests/src/Functional/BulkFormTest.php b/core/modules/views/tests/src/Functional/BulkFormTest.php
index 258a0175b79b424aae060971864ac2903b055e06..6115b53f13ed5f64c7f57b99b0d6c7d913a436ba 100644
--- a/core/modules/views/tests/src/Functional/BulkFormTest.php
+++ b/core/modules/views/tests/src/Functional/BulkFormTest.php
@@ -113,7 +113,7 @@ public function testBulkForm() {
 
     $this->drupalGet('test_bulk_form');
     $options = $this->xpath('//select[@id=:id]/option', [':id' => 'edit-action']);
-    $this->assertEqual(count($options), 2);
+    $this->assertCount(2, $options);
     $this->assertOption('edit-action', 'node_make_sticky_action');
     $this->assertOption('edit-action', 'node_make_unsticky_action');
 
diff --git a/core/modules/views/tests/src/Functional/Handler/AreaTest.php b/core/modules/views/tests/src/Functional/Handler/AreaTest.php
index 5604790a3cbef8966b0f924c0106c9d19e63628c..7e44392f7f58dd2833f8774e3c8aebdb0a5c7f54 100644
--- a/core/modules/views/tests/src/Functional/Handler/AreaTest.php
+++ b/core/modules/views/tests/src/Functional/Handler/AreaTest.php
@@ -124,7 +124,7 @@ public function testAreaAccess() {
     $view->initDisplay();
     $view->initHandlers();
     $handlers = $view->display_handler->getHandlers('empty');
-    $this->assertEqual(0, count($handlers));
+    $this->assertCount(0, $handlers);
 
     $output = $view->preview();
     $output = \Drupal::service('renderer')->renderRoot($output);
@@ -151,7 +151,7 @@ public function testAreaAccess() {
     $output = $view->preview();
     $output = \Drupal::service('renderer')->renderRoot($output);
     $this->assertStringContainsString('a custom string', $output);
-    $this->assertEqual(1, count($handlers));
+    $this->assertCount(1, $handlers);
   }
 
   /**
diff --git a/core/modules/views/tests/src/Functional/Handler/FieldDropButtonTest.php b/core/modules/views/tests/src/Functional/Handler/FieldDropButtonTest.php
index a3337d1cd8e1a7bc533381e7cc26a3ac81284406..a4b314cfb205d2ed717302376892a34170c3d428 100644
--- a/core/modules/views/tests/src/Functional/Handler/FieldDropButtonTest.php
+++ b/core/modules/views/tests/src/Functional/Handler/FieldDropButtonTest.php
@@ -54,9 +54,9 @@ public function testDropbutton() {
     $this->drupalGet('test-dropbutton');
     foreach ($nodes as $node) {
       $result = $this->xpath('//ul[contains(@class, dropbutton)]/li/a[contains(@href, :path) and text()=:title]', [':path' => '/node/' . $node->id(), ':title' => $node->label()]);
-      $this->assertEqual(count($result), 1, 'Just one node title link was found.');
+      $this->assertCount(1, $result, 'Just one node title link was found.');
       $result = $this->xpath('//ul[contains(@class, dropbutton)]/li/a[contains(@href, :path) and text()=:title]', [':path' => '/node/' . $node->id(), ':title' => 'Custom Text']);
-      $this->assertEqual(count($result), 1, 'Just one custom link was found.');
+      $this->assertCount(1, $result, 'Just one custom link was found.');
     }
 
     // Check if the dropbutton.js library is available.
diff --git a/core/modules/views/tests/src/Functional/Handler/FieldEntityOperationsTest.php b/core/modules/views/tests/src/Functional/Handler/FieldEntityOperationsTest.php
index 209c91309168d77e1687ae746c1a0f1116b53cab..1e4dff8d249d6ff41d9d89d9d1784e001f3d59eb 100644
--- a/core/modules/views/tests/src/Functional/Handler/FieldEntityOperationsTest.php
+++ b/core/modules/views/tests/src/Functional/Handler/FieldEntityOperationsTest.php
@@ -82,7 +82,7 @@ public function testEntityOperations() {
           // test would by default point to the frontpage.
           $operation['url']->setOption('query', ['destination' => $expected_destination]);
           $result = $this->xpath('//ul[contains(@class, dropbutton)]/li/a[@href=:path and text()=:title]', [':path' => $operation['url']->toString(), ':title' => (string) $operation['title']]);
-          $this->assertEqual(count($result), 1, t('Found entity @operation link with destination parameter.', ['@operation' => $operation['title']]));
+          $this->assertCount(1, $result, t('Found entity @operation link with destination parameter.', ['@operation' => $operation['title']]));
           // Entities which were created in Hungarian should link to the Hungarian
           // edit form, others to the English one (which has no path prefix here).
           $base_path = \Drupal::request()->getBasePath();
diff --git a/core/modules/views/tests/src/Functional/Handler/FilterDateTest.php b/core/modules/views/tests/src/Functional/Handler/FilterDateTest.php
index ebc904afd08bc57b4e0f14298fe61d57c09f9a6b..89bcf774b3e7b7b92d16c3d26c5d9ed6f350fdac 100644
--- a/core/modules/views/tests/src/Functional/Handler/FilterDateTest.php
+++ b/core/modules/views/tests/src/Functional/Handler/FilterDateTest.php
@@ -243,18 +243,18 @@ protected function _testFilterDateUI() {
     $this->drupalGet($path);
     $this->drupalPostForm(NULL, [], 'Apply');
     $results = $this->cssSelect('.view-content .field-content');
-    $this->assertEqual(count($results), 4);
+    $this->assertCount(4, $results);
     $this->drupalPostForm(NULL, ['created' => '1'], 'Apply');
     $results = $this->cssSelect('.view-content .field-content');
-    $this->assertEqual(count($results), 1);
+    $this->assertCount(1, $results);
     $this->assertEqual($results[0]->getText(), $this->nodes[3]->id());
     $this->drupalPostForm(NULL, ['created' => '2'], 'Apply');
     $results = $this->cssSelect('.view-content .field-content');
-    $this->assertEqual(count($results), 1);
+    $this->assertCount(1, $results);
     $this->assertEqual($results[0]->getText(), $this->nodes[3]->id());
     $this->drupalPostForm(NULL, ['created' => '3'], 'Apply');
     $results = $this->cssSelect('.view-content .field-content');
-    $this->assertEqual(count($results), 1);
+    $this->assertCount(1, $results);
     $this->assertEqual($results[0]->getText(), $this->nodes[1]->id());
 
     // Change the filter to a single filter to test the schema when the operator
@@ -271,13 +271,13 @@ protected function _testFilterDateUI() {
     // Test that the filter works as expected.
     $this->drupalGet($path);
     $results = $this->cssSelect('.view-content .field-content');
-    $this->assertEqual(count($results), 1);
+    $this->assertCount(1, $results);
     $this->assertEqual($results[0]->getText(), $this->nodes[3]->id());
     $this->drupalPostForm(NULL, [
       'created' => $this->dateFormatter->format(250000, 'custom', 'Y-m-d H:i:s'),
     ], 'Apply');
     $results = $this->cssSelect('.view-content .field-content');
-    $this->assertEqual(count($results), 2);
+    $this->assertCount(2, $results);
     $this->assertEqual($results[0]->getText(), $this->nodes[2]->id());
     $this->assertEqual($results[1]->getText(), $this->nodes[3]->id());
   }
diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayAttachmentTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayAttachmentTest.php
index 79fc35835f78a3c499fd9efaf45e0eb90fc37d20..7fbc7f1f4c98c35b53926b3ad62ffeb1c6213e95 100644
--- a/core/modules/views/tests/src/Functional/Plugin/DisplayAttachmentTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/DisplayAttachmentTest.php
@@ -48,13 +48,13 @@ public function testAttachment() {
     $this->drupalGet('test-display-attachment');
 
     $result = $this->xpath('//div[contains(@class, "view-content")]');
-    $this->assertEqual(count($result), 2, 'Both actual view and the attachment is rendered.');
+    $this->assertCount(2, $result, 'Both actual view and the attachment is rendered.');
 
     $result = $this->xpath('//div[contains(@class, "attachment-after")]');
-    $this->assertEqual(count($result), 0, 'The attachment is not rendered after the actual view.');
+    $this->assertCount(0, $result, 'The attachment is not rendered after the actual view.');
 
     $result = $this->xpath('//div[contains(@class, "attachment-before")]');
-    $this->assertEqual(count($result), 1, 'The attachment is rendered before the actual view.');
+    $this->assertCount(1, $result, 'The attachment is rendered before the actual view.');
   }
 
   /**
@@ -75,13 +75,13 @@ public function testDisabledAttachments() {
     $this->drupalGet('test-attached-disabled');
 
     $result = $this->xpath('//div[contains(@class, "view-content")]');
-    $this->assertEqual(count($result), 3, 'The page view and the attachments are rendered.');
+    $this->assertCount(3, $result, 'The page view and the attachments are rendered.');
 
     $result = $this->xpath('//div[contains(@class, "attachment-before")]');
-    $this->assertEqual(count($result), 1, 'The attachment is rendered before the page view.');
+    $this->assertCount(1, $result, 'The attachment is rendered before the page view.');
 
     $result = $this->xpath('//div[contains(@class, "attachment-after")]');
-    $this->assertEqual(count($result), 1, 'The attachment is rendered after the page view.');
+    $this->assertCount(1, $result, 'The attachment is rendered after the page view.');
 
     // Disable the attachment_1 display.
     $view->displayHandlers->get('attachment_1')->setOption('enabled', FALSE);
@@ -90,10 +90,10 @@ public function testDisabledAttachments() {
     // Test that the before attachment is not displayed.
     $this->drupalGet('/test-attached-disabled');
     $result = $this->xpath('//div[contains(@class, "view-content")]');
-    $this->assertEqual(count($result), 2, 'The page view and only one attachment are rendered.');
+    $this->assertCount(2, $result, 'The page view and only one attachment are rendered.');
 
     $result = $this->xpath('//div[contains(@class, "attachment-before")]');
-    $this->assertEqual(count($result), 0, 'The attachment_1 is not rendered.');
+    $this->assertCount(0, $result, 'The attachment_1 is not rendered.');
 
     // Disable the attachment_2 display.
     $view->displayHandlers->get('attachment_2')->setOption('enabled', FALSE);
@@ -102,10 +102,10 @@ public function testDisabledAttachments() {
     // Test that the after attachment is not displayed.
     $this->drupalGet('/test-attached-disabled');
     $result = $this->xpath('//div[contains(@class, "view-content")]');
-    $this->assertEqual(count($result), 1, 'The page view is rendered without attachments.');
+    $this->assertCount(1, $result, 'The page view is rendered without attachments.');
 
     $result = $this->xpath('//div[contains(@class, "attachment-after")]');
-    $this->assertEqual(count($result), 0, 'The attachment_2 is not rendered.');
+    $this->assertCount(0, $result, 'The attachment_2 is not rendered.');
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayEntityReferenceTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayEntityReferenceTest.php
index 40dd50256c0feda17f0c2803c3edefa95ec078a3..5843e989ed317a8010f458bd0c65a375b25f47e0 100644
--- a/core/modules/views/tests/src/Functional/Plugin/DisplayEntityReferenceTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/DisplayEntityReferenceTest.php
@@ -162,7 +162,7 @@ public function testEntityReferenceDisplay() {
     $this->executeView($view);
 
     // Test that we have searched in both fields.
-    $this->assertEqual(count($view->result), 2, 'Search returned two rows');
+    $this->assertCount(2, $view->result, 'Search returned two rows');
     $view->destroy();
 
     // Test the 'CONTAINS' match_operator.
@@ -176,7 +176,7 @@ public function testEntityReferenceDisplay() {
     ];
     $view->display_handler->setOption('entity_reference_options', $options);
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 13, 'Search returned thirteen rows');
+    $this->assertCount(13, $view->result, 'Search returned thirteen rows');
     $view->destroy();
 
     // Test the 'STARTS_WITH' match_operator.
@@ -190,7 +190,7 @@ public function testEntityReferenceDisplay() {
     ];
     $view->display_handler->setOption('entity_reference_options', $options);
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 12, 'Search returned twelve rows');
+    $this->assertCount(12, $view->result, 'Search returned twelve rows');
     $view->destroy();
 
     // Test the '=' match_operator.
@@ -204,7 +204,7 @@ public function testEntityReferenceDisplay() {
     ];
     $view->display_handler->setOption('entity_reference_options', $options);
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 2, 'Search returned two rows');
+    $this->assertCount(2, $view->result, 'Search returned two rows');
     $view->destroy();
 
     // Add a relationship and a field using that relationship.
@@ -234,7 +234,7 @@ public function testEntityReferenceDisplay() {
     $this->executeView($view);
 
     // Run validation when using a relationship to the same base table.
-    $this->assertEqual(count($view->result), 2, 'Search returned two rows');
+    $this->assertCount(2, $view->result, 'Search returned two rows');
     $view->destroy();
 
     $this->drupalPostForm('admin/structure/views/nojs/add-handler/test_display_entity_reference/default/relationship', ['name[entity_test__field_test_entity_ref_entity_ref.field_test_entity_ref_entity_ref]' => TRUE], t('Add and configure relationships'));
@@ -257,7 +257,7 @@ public function testEntityReferenceDisplay() {
 
     $this->executeView($view);
 
-    $this->assertEqual(count($view->result), 2, 'Search returned two rows');
+    $this->assertCount(2, $view->result, 'Search returned two rows');
 
     // Test that the render() return empty array for empty result.
     $view = Views::getView('test_display_entity_reference');
diff --git a/core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php b/core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php
index 7cf0a6e312bc3be42b84041df031ae95e226b8c5..87c6c0f6983128e286ae937181db2e7affe0453f 100644
--- a/core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/DisplayPageWebTest.php
@@ -51,7 +51,7 @@ public function testArguments() {
     $this->drupalGet('test_route_without_arguments');
     $this->assertResponse(200);
     $result = $this->xpath('//span[@class="field-content"]');
-    $this->assertEqual(count($result), 5, 'All entries was returned');
+    $this->assertCount(5, $result, 'All entries was returned');
 
     $this->drupalGet('test_route_without_arguments/1');
     $this->assertResponse(404);
@@ -60,30 +60,30 @@ public function testArguments() {
     $this->assertResponse(200);
     $this->assertCacheContexts(['languages:language_interface', 'route', 'theme', 'url']);
     $result = $this->xpath('//span[@class="field-content"]');
-    $this->assertEqual(count($result), 1, 'Ensure that just the filtered entry was returned.');
+    $this->assertCount(1, $result, 'Ensure that just the filtered entry was returned.');
     $this->assertEqual($result[0]->getText(), 1, 'The passed ID was returned.');
 
     $this->drupalGet('test_route_with_suffix/1/suffix');
     $this->assertResponse(200);
     $result = $this->xpath('//span[@class="field-content"]');
-    $this->assertEqual(count($result), 1, 'Ensure that just the filtered entry was returned.');
+    $this->assertCount(1, $result, 'Ensure that just the filtered entry was returned.');
     $this->assertEqual($result[0]->getText(), 1, 'The passed ID was returned.');
 
     $this->drupalGet('test_route_with_suffix_and_argument/1/suffix/2');
     $this->assertResponse(200);
     $result = $this->xpath('//span[@class="field-content"]');
-    $this->assertEqual(count($result), 0, 'No result was returned.');
+    $this->assertCount(0, $result, 'No result was returned.');
 
     $this->drupalGet('test_route_with_suffix_and_argument/1/suffix/1');
     $this->assertResponse(200);
     $result = $this->xpath('//span[@class="field-content"]');
-    $this->assertEqual(count($result), 1, 'Ensure that just the filtered entry was returned.');
+    $this->assertCount(1, $result, 'Ensure that just the filtered entry was returned.');
     $this->assertEqual($result[0]->getText(), 1, 'The passed ID was returned.');
 
     $this->drupalGet('test_route_with_long_argument/1');
     $this->assertResponse(200);
     $result = $this->xpath('//span[@class="field-content"]');
-    $this->assertEqual(count($result), 1, 'Ensure that just the filtered entry was returned.');
+    $this->assertCount(1, $result, 'Ensure that just the filtered entry was returned.');
     $this->assertEqual($result[0]->getText(), 1, 'The passed ID was returned.');
   }
 
diff --git a/core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php b/core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php
index c332c41b1cf3473c76c0652a27e6e9a7317d4f5a..425e54fb9ab13259d7faca1c3608a95a2a85f43a 100644
--- a/core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/ExposedFormCheckboxesTest.php
@@ -98,17 +98,17 @@ public function testExposedFormRenderCheckboxes() {
     $this->drupalGet('test_exposed_form_checkboxes');
 
     $actual = $this->xpath('//form//input[@type="checkbox" and @name="type[article]"]');
-    $this->assertEqual(count($actual), 1, 'Article option renders as a checkbox.');
+    $this->assertCount(1, $actual, 'Article option renders as a checkbox.');
     $actual = $this->xpath('//form//input[@type="checkbox" and @name="type[page]"]');
-    $this->assertEqual(count($actual), 1, 'Page option renders as a checkbox');
+    $this->assertCount(1, $actual, 'Page option renders as a checkbox');
 
     // Ensure that all results are displayed.
     $rows = $this->xpath("//div[contains(@class, 'views-row')]");
-    $this->assertEqual(count($rows), 5, '5 rows are displayed by default on the first page when no options are checked.');
+    $this->assertCount(5, $rows, '5 rows are displayed by default on the first page when no options are checked.');
 
     $this->clickLink('Page 2');
     $rows = $this->xpath("//div[contains(@class, 'views-row')]");
-    $this->assertEqual(count($rows), 1, '1 row is displayed by default on the second page when no options are checked.');
+    $this->assertCount(1, $rows, '1 row is displayed by default on the second page when no options are checked.');
     $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.');
   }
 
@@ -156,7 +156,7 @@ public function testExposedIsAllOfFilter() {
 
     // Ensure that all results are displayed.
     $rows = $this->xpath("//div[contains(@class, 'views-row')]");
-    $this->assertEqual(count($rows), 8, 'All rows are displayed by default on the first page when no options are checked.');
+    $this->assertCount(8, $rows, 'All rows are displayed by default on the first page when no options are checked.');
     $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.');
 
     // Select one option and ensure we still have results.
@@ -165,7 +165,7 @@ public function testExposedIsAllOfFilter() {
 
     // Ensure only nodes tagged with $tid are displayed.
     $rows = $this->xpath("//div[contains(@class, 'views-row')]");
-    $this->assertEqual(count($rows), 2, 'Correct rows are displayed when a tid is selected.');
+    $this->assertCount(2, $rows, 'Correct rows are displayed when a tid is selected.');
     $this->assertNoText('An illegal choice has been detected. Please contact the site administrator.');
   }
 
diff --git a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
index 2c21ee18a428750d37aa4a7a18a6ac99c8a17ba1..3f06c8a0f2300639c672e43784dce07be9b67e18 100644
--- a/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/ExposedFormTest.php
@@ -233,7 +233,7 @@ public function testExposedBlock() {
     // Test there is an exposed form in a block.
     $xpath = $this->buildXPathQuery('//div[@id=:id]/form/@id', [':id' => Html::getUniqueId('block-' . $block->id())]);
     $result = $this->xpath($xpath);
-    $this->assertEquals(1, count($result));
+    $this->assertCount(1, $result);
 
     // Test there is not an exposed form in the view page content area.
     $xpath = $this->buildXPathQuery('//div[@class="view-content"]/form/@id', [':id' => Html::getUniqueId('block-' . $block->id())]);
@@ -241,7 +241,7 @@ public function testExposedBlock() {
 
     // Test there is only one views exposed form on the page.
     $elements = $this->xpath('//form[@id=:id]', [':id' => $this->getExpectedExposedFormId($view)]);
-    $this->assertEqual(count($elements), 1, 'One exposed form block found.');
+    $this->assertCount(1, $elements, 'One exposed form block found.');
 
     // Test that the correct option is selected after form submission.
     $this->assertCacheContext('url');
@@ -268,13 +268,13 @@ public function testInputRequired() {
 
     // Ensure that no results are displayed.
     $rows = $this->xpath("//div[contains(@class, 'views-row')]");
-    $this->assertEqual(count($rows), 0, 'No rows are displayed by default when no input is provided.');
+    $this->assertCount(0, $rows, 'No rows are displayed by default when no input is provided.');
 
     $this->drupalGet('test_exposed_form_buttons', ['query' => ['type' => 'article']]);
 
     // Ensure that results are displayed.
     $rows = $this->xpath("//div[contains(@class, 'views-row')]");
-    $this->assertEqual(count($rows), 5, 'All rows are displayed by default when input is provided.');
+    $this->assertCount(5, $rows, 'All rows are displayed by default when input is provided.');
   }
 
   /**
diff --git a/core/modules/views/tests/src/Functional/Plugin/FilterTest.php b/core/modules/views/tests/src/Functional/Plugin/FilterTest.php
index 4b83891db406a691191d3913b6cbf3d63b295693..8ddf80818cdf799230e167415ea8f7b4248ea1b7 100644
--- a/core/modules/views/tests/src/Functional/Plugin/FilterTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/FilterTest.php
@@ -97,7 +97,7 @@ public function testFilterQuery() {
 
     // Check that we have a single element, as a result of applying the '= John'
     // filter.
-    $this->assertEqual(count($view->result), 1, new FormattableMarkup('Results were returned. @count results.', ['@count' => count($view->result)]));
+    $this->assertCount(1, $view->result, new FormattableMarkup('Results were returned. @count results.', ['@count' => count($view->result)]));
 
     $view->destroy();
 
@@ -123,7 +123,7 @@ public function testFilterQuery() {
 
     // Check if we have the other elements in the dataset, as a result of
     // applying the '<> John' filter.
-    $this->assertEqual(count($view->result), 4, new FormattableMarkup('Results were returned. @count results.', ['@count' => count($view->result)]));
+    $this->assertCount(4, $view->result, new FormattableMarkup('Results were returned. @count results.', ['@count' => count($view->result)]));
 
     $view->destroy();
     $view->initDisplay();
@@ -147,7 +147,7 @@ public function testFilterQuery() {
     $this->executeView($view);
 
     // Check if we have all 5 results.
-    $this->assertEqual(count($view->result), 5, new FormattableMarkup('All @count results returned', ['@count' => count($view->displayHandlers)]));
+    $this->assertCount(5, $view->result, new FormattableMarkup('All @count results returned', ['@count' => count($view->displayHandlers)]));
   }
 
   /**
diff --git a/core/modules/views/tests/src/Functional/Plugin/PagerTest.php b/core/modules/views/tests/src/Functional/Plugin/PagerTest.php
index 07e86145ba9183d581d936b94c7c7f8cce40c639..91d41a760a40c04205ba6a21b4d38ee97f6ce549 100644
--- a/core/modules/views/tests/src/Functional/Plugin/PagerTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/PagerTest.php
@@ -167,7 +167,7 @@ public function testNoLimit() {
     }
     $view = Views::getView('test_pager_none');
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 11, 'Make sure that every item is returned in the result');
+    $this->assertCount(11, $view->result, 'Make sure that every item is returned in the result');
 
     // Setup and test a offset.
     $view = Views::getView('test_pager_none');
@@ -181,7 +181,7 @@ public function testNoLimit() {
     $view->display_handler->setOption('pager', $pager);
     $this->executeView($view);
 
-    $this->assertEqual(count($view->result), 8, 'Make sure that every item beside the first three is returned in the result');
+    $this->assertCount(8, $view->result, 'Make sure that every item beside the first three is returned in the result');
 
     // Check some public functions.
     $this->assertFalse($view->pager->usePager());
@@ -215,7 +215,7 @@ public function testLimit() {
 
     $view = Views::getView('test_pager_some');
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 5, 'Make sure that only a certain count of items is returned');
+    $this->assertCount(5, $view->result, 'Make sure that only a certain count of items is returned');
 
     // Setup and test a offset.
     $view = Views::getView('test_pager_some');
@@ -229,7 +229,7 @@ public function testLimit() {
     ];
     $view->display_handler->setOption('pager', $pager);
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 3, 'Make sure that only a certain count of items is returned');
+    $this->assertCount(3, $view->result, 'Make sure that only a certain count of items is returned');
 
     // Check some public functions.
     $this->assertFalse($view->pager->usePager());
@@ -249,7 +249,7 @@ public function testNormalPager() {
 
     $view = Views::getView('test_pager_full');
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 5, 'Make sure that only a certain count of items is returned');
+    $this->assertCount(5, $view->result, 'Make sure that only a certain count of items is returned');
 
     // Setup and test a offset.
     $view = Views::getView('test_pager_full');
@@ -263,13 +263,13 @@ public function testNormalPager() {
     ];
     $view->display_handler->setOption('pager', $pager);
     $this->executeView($view);
-    $this->assertEqual(count($view->result), 3, 'Make sure that only a certain count of items is returned');
+    $this->assertCount(3, $view->result, 'Make sure that only a certain count of items is returned');
 
     // Test items per page = 0
     $view = Views::getView('test_view_pager_full_zero_items_per_page');
     $this->executeView($view);
 
-    $this->assertEqual(count($view->result), 11, 'All items are return');
+    $this->assertCount(11, $view->result, 'All items are return');
 
     // TODO test number of pages.
 
@@ -288,7 +288,7 @@ public function testNormalPager() {
     $view->display_handler->setOption('pager', $pager);
     $this->executeView($view);
     $this->assertEqual($view->pager->getItemsPerPage(), 0);
-    $this->assertEqual(count($view->result), 11);
+    $this->assertCount(11, $view->result);
 
     // Test pager cache contexts.
     $this->drupalGet('test_pager_full');
diff --git a/core/modules/views/tests/src/Functional/Plugin/StyleSummaryTest.php b/core/modules/views/tests/src/Functional/Plugin/StyleSummaryTest.php
index af143c97ee5dd29d2e4a281d7b527f35bff7b0be..a6de0c9b0dfa5f573e1331d96f3bb70e7f2a8be4 100644
--- a/core/modules/views/tests/src/Functional/Plugin/StyleSummaryTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/StyleSummaryTest.php
@@ -63,21 +63,21 @@ public function testSummaryView() {
     $this->assertRaw('stable/css/views/views.module.css');
 
     $summary_list = $this->cssSelect('ul.views-summary li');
-    $this->assertEqual(4, count($summary_list));
+    $this->assertCount(4, $summary_list);
 
     foreach ($summary_list as $summary_list_item) {
       $this->assertEqual('(5)', trim(explode(' ', $summary_list_item->getText())[1]));
     }
 
     $summary_links = $this->cssSelect('ul.views-summary a');
-    $this->assertEqual(4, count($summary_links));
+    $this->assertCount(4, $summary_links);
     foreach ($summary_links as $index => $summary_link) {
       $this->assertEqual('type' . $index, trim($summary_link->getText()));
     }
 
     $this->clickLink('type1');
     $entries = $this->cssSelect('div.view-content div.views-row');
-    $this->assertEqual(2, count($entries));
+    $this->assertCount(2, $entries);
 
     // Add a base path to the summary settings.
     $edit = [
@@ -90,7 +90,7 @@ public function testSummaryView() {
     $this->drupalGet('test-summary');
     $this->clickLink('type1');
     $entries = $this->cssSelect('div.view-content div.views-row');
-    $this->assertEqual(2, count($entries));
+    $this->assertCount(2, $entries);
 
     // Change the summary display to an unformatted list displaying 3 items.
     $edit = [
@@ -105,21 +105,21 @@ public function testSummaryView() {
     $this->drupalGet('test-summary');
 
     $summary_list = $this->cssSelect('.views-summary-unformatted');
-    $this->assertEqual(3, count($summary_list));
+    $this->assertCount(3, $summary_list);
 
     foreach ($summary_list as $summary_list_item) {
       $this->assertEqual('(5)', trim(explode(' ', $summary_list_item->getText())[1]));
     }
 
     $summary_links = $this->cssSelect('.views-summary-unformatted a');
-    $this->assertEqual(3, count($summary_links));
+    $this->assertCount(3, $summary_links);
     foreach ($summary_links as $index => $summary_link) {
       $this->assertEqual('type' . $index, trim($summary_link->getText()));
     }
 
     $this->clickLink('type1');
     $entries = $this->cssSelect('div.view-content div.views-row');
-    $this->assertEqual(2, count($entries));
+    $this->assertCount(2, $entries);
 
     // Add a base path to the summary settings.
     $edit = [
@@ -132,7 +132,7 @@ public function testSummaryView() {
     $this->drupalGet('test-summary');
     $this->clickLink('type1');
     $entries = $this->cssSelect('div.view-content div.views-row');
-    $this->assertEqual(2, count($entries));
+    $this->assertCount(2, $entries);
 
     // Set base_path to an unknown path and test that the links lead to the
     // front page.
diff --git a/core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php b/core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php
index c42dc0eabf5eb573964e95555ba33eae805e9608..37ff939b84eb466cb698b610930a86fd3d7e1c42 100644
--- a/core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/StyleTableTest.php
@@ -158,10 +158,10 @@ public function testEmptyColumn() {
 
     // Test that only one of the job columns still shows.
     $result = $this->xpath('//thead/tr/th/a[text()="Job"]');
-    $this->assertEqual(count($result), 1, 'Ensure that empty column header is hidden.');
+    $this->assertCount(1, $result, 'Ensure that empty column header is hidden.');
 
     $result = $this->xpath('//tbody/tr/td[contains(concat(" ", @class, " "), " views-field-job-1 ")]');
-    $this->assertEqual(count($result), 0, 'Ensure the empty table cells are hidden.');
+    $this->assertCount(0, $result, 'Ensure the empty table cells are hidden.');
   }
 
   /**
diff --git a/core/modules/views/tests/src/Functional/Plugin/ViewsFormTest.php b/core/modules/views/tests/src/Functional/Plugin/ViewsFormTest.php
index 150537851a08062c30f83826b5b11102bc91ba6b..6f1788decbcc0203906abe992842f80589c57074 100644
--- a/core/modules/views/tests/src/Functional/Plugin/ViewsFormTest.php
+++ b/core/modules/views/tests/src/Functional/Plugin/ViewsFormTest.php
@@ -30,7 +30,7 @@ public function testFormWrapper() {
     $this->drupalGet('test_bulk_form');
     // Ensure we have the form tag on the page.
     $xpath = $this->cssSelect('.views-form form');
-    $this->assertIdentical(count($xpath), 1, 'There is one views form on the page.');
+    $this->assertCount(1, $xpath, 'There is one views form on the page.');
     // Ensure we don't have nested form elements.
     $result = (bool) preg_match('#<form[^>]*?>(?!/form).*<form#s', $this->getSession()->getPage()->getContent());
     $this->assertFalse($result, 'The views form element is not nested.');
diff --git a/core/modules/views/tests/src/Functional/ViewAjaxTest.php b/core/modules/views/tests/src/Functional/ViewAjaxTest.php
index 5a7125257d38650d022d747a2052e983ff91f4ac..85998adc3c6fe5bb802c6f6f25c3a795db9f8f1e 100644
--- a/core/modules/views/tests/src/Functional/ViewAjaxTest.php
+++ b/core/modules/views/tests/src/Functional/ViewAjaxTest.php
@@ -37,7 +37,7 @@ public function testAjaxView() {
 
     $drupal_settings = $this->getDrupalSettings();
     $this->assertTrue(isset($drupal_settings['views']['ajax_path']), 'The Ajax callback path is set in drupalSettings.');
-    $this->assertEqual(count($drupal_settings['views']['ajaxViews']), 1);
+    $this->assertCount(1, $drupal_settings['views']['ajaxViews']);
     $view_entry = array_keys($drupal_settings['views']['ajaxViews'])[0];
     $this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_name'], 'test_ajax_view', 'The view\'s ajaxViews array entry has the correct \'view_name\' key.');
     $this->assertEqual($drupal_settings['views']['ajaxViews'][$view_entry]['view_display_id'], 'page_1', 'The view\'s ajaxViews array entry has the correct \'view_display_id\' key.');
diff --git a/core/modules/views/tests/src/Functional/ViewElementTest.php b/core/modules/views/tests/src/Functional/ViewElementTest.php
index 5dce3d3c904614fe4949fec11400623892eef529..01b6cc0b7d5deb4d6f13adc26f2881ab0db71992 100644
--- a/core/modules/views/tests/src/Functional/ViewElementTest.php
+++ b/core/modules/views/tests/src/Functional/ViewElementTest.php
@@ -48,7 +48,7 @@ public function testViewElement() {
     $this->assertNotEmpty($xpath, 'The view content has been found on the form.');
     // There should be 5 rows in the results.
     $xpath = $this->xpath('//div[@class="view-content"]/div');
-    $this->assertEqual(count($xpath), 5);
+    $this->assertCount(5, $xpath);
 
     // Add an argument and save the view.
     $view->displayHandlers->get('default')->overrideOption('arguments', [
@@ -73,7 +73,7 @@ public function testViewElement() {
     // Test that the form has the expected result.
     $this->drupalGet('views_test_data_element_form');
     $xpath = $this->xpath('//div[@class="view-content"]/div');
-    $this->assertEqual(count($xpath), 1);
+    $this->assertCount(1, $xpath);
   }
 
   /**
@@ -93,7 +93,7 @@ public function testViewElementEmbed() {
     $this->assertNotEmpty($xpath, 'The view content has been found on the form.');
     // There should be 5 rows in the results.
     $xpath = $this->xpath('//div[@class="view-content"]/div');
-    $this->assertEqual(count($xpath), 5);
+    $this->assertCount(5, $xpath);
 
     // Add an argument and save the view.
     $view->displayHandlers->get('default')->overrideOption('arguments', [
@@ -118,7 +118,7 @@ public function testViewElementEmbed() {
     // Test that the form has the same expected result.
     $this->drupalGet('views_test_data_element_embed_form');
     $xpath = $this->xpath('//div[@class="view-content"]/div');
-    $this->assertEqual(count($xpath), 1);
+    $this->assertCount(1, $xpath);
   }
 
 }
diff --git a/core/modules/views/tests/src/Functional/Wizard/BasicTest.php b/core/modules/views/tests/src/Functional/Wizard/BasicTest.php
index ce83028188ac1edde1ca82b4848dd91cd773218b..4a7d04e9258cb9d4237697692b1717ad08411786 100644
--- a/core/modules/views/tests/src/Functional/Wizard/BasicTest.php
+++ b/core/modules/views/tests/src/Functional/Wizard/BasicTest.php
@@ -83,7 +83,7 @@ public function testViewsWizardAndListing() {
     // Check if we have the feed.
     $this->assertLinkByHref(Url::fromRoute('view.' . $view2['id'] . '.feed_1')->toString());
     $elements = $this->cssSelect('link[href="' . Url::fromRoute('view.' . $view2['id'] . '.feed_1', [], ['absolute' => TRUE])->toString() . '"]');
-    $this->assertEqual(count($elements), 1, 'Feed found.');
+    $this->assertCount(1, $elements, 'Feed found.');
     $this->drupalGet($view2['page[feed_properties][path]']);
     // Because the response is XML we can't use the page which depends on an
     // HTML tag being present.
@@ -173,7 +173,7 @@ public function testViewsWizardAndListing() {
     $this->drupalGet($view4['rest_export[path]'], ['query' => ['_format' => 'json']]);
     $this->assertResponse(200);
     $data = Json::decode($this->getSession()->getPage()->getContent());
-    $this->assertEqual(count($data), 1, 'Only the node of type page is exported.');
+    $this->assertCount(1, $data, 'Only the node of type page is exported.');
     $node = reset($data);
     $this->assertEqual($node['nid'][0]['value'], $node1->id(), 'The node of type page is exported.');
 
diff --git a/core/modules/views/tests/src/Kernel/BasicTest.php b/core/modules/views/tests/src/Kernel/BasicTest.php
index 4ef22b140842909335cb5fce40e3ecd0f7344341..cbfa3835bd3bf8fecde3e12c461d4a830b6fca50 100644
--- a/core/modules/views/tests/src/Kernel/BasicTest.php
+++ b/core/modules/views/tests/src/Kernel/BasicTest.php
@@ -29,7 +29,7 @@ public function testSimpleResultSet() {
     $this->executeView($view);
 
     // Verify the result.
-    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');
+    $this->assertCount(5, $view->result, 'The number of returned rows match.');
     $this->assertIdenticalResultset($view, $this->dataSet(), [
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
@@ -88,7 +88,7 @@ public function testSimpleFiltering() {
     ];
 
     // Verify the result.
-    $this->assertEqual(3, count($view->result), 'The number of returned rows match.');
+    $this->assertCount(3, $view->result, 'The number of returned rows match.');
     $this->assertIdenticalResultSet($view, $dataset, [
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
@@ -114,7 +114,7 @@ public function testSimpleArgument() {
     ];
 
     // Verify the result.
-    $this->assertEqual(1, count($view->result), 'The number of returned rows match.');
+    $this->assertCount(1, $view->result, 'The number of returned rows match.');
     $this->assertIdenticalResultSet($view, $dataset, [
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
@@ -127,7 +127,7 @@ public function testSimpleArgument() {
     // Build the expected result.
     $dataset = $this->dataSet();
 
-    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');
+    $this->assertCount(5, $view->result, 'The number of returned rows match.');
     $this->assertIdenticalResultSet($view, $dataset, [
       'views_test_data_name' => 'name',
       'views_test_data_age' => 'age',
diff --git a/core/modules/views/tests/src/Kernel/Handler/ArgumentNullTest.php b/core/modules/views/tests/src/Kernel/Handler/ArgumentNullTest.php
index 933a00099f2ba72257772804283be318b493a178..1b5683c3c5005b5bf98b4779f75c5bd8948a55f8 100644
--- a/core/modules/views/tests/src/Kernel/Handler/ArgumentNullTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/ArgumentNullTest.php
@@ -68,7 +68,7 @@ public function testAreaText() {
     $this->executeView($view, [26]);
 
     // The argument should be ignored, so every result should return.
-    $this->assertEqual(5, count($view->result));
+    $this->assertCount(5, $view->result);
   }
 
 }
diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorStringTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorStringTest.php
index 5495ceaa432740c787bd50a0df891a62a0afb260..88c3de207aa3f8a6a45241507c2c81872d362c48 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorStringTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorStringTest.php
@@ -106,7 +106,7 @@ public function testFilterBooleanOperatorString() {
       ['id' => 4],
     ];
 
-    $this->assertEqual(2, count($view->result));
+    $this->assertCount(2, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
 
     $view->destroy();
@@ -129,7 +129,7 @@ public function testFilterBooleanOperatorString() {
       ['id' => 5],
     ];
 
-    $this->assertEqual(3, count($view->result));
+    $this->assertCount(3, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
   }
 
@@ -152,7 +152,7 @@ public function testFilterGroupedExposed() {
       ['id' => 5],
     ];
 
-    $this->assertEqual(3, count($view->result));
+    $this->assertCount(3, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
     $view->destroy();
 
@@ -167,7 +167,7 @@ public function testFilterGroupedExposed() {
       ['id' => 4],
     ];
 
-    $this->assertEqual(2, count($view->result));
+    $this->assertCount(2, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
   }
 
diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php
index e653cbbf0e1ae2cab6542c8f2cb46ca63e538637..ec0282d53427d4261d4afd93bc4da1763fbd81a2 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FilterBooleanOperatorTest.php
@@ -59,7 +59,7 @@ public function testFilterBooleanOperator() {
       ['id' => 4],
     ];
 
-    $this->assertEqual(2, count($view->result));
+    $this->assertCount(2, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
 
     $view->destroy();
@@ -82,7 +82,7 @@ public function testFilterBooleanOperator() {
       ['id' => 5],
     ];
 
-    $this->assertEqual(3, count($view->result));
+    $this->assertCount(3, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
 
     $view->destroy();
@@ -106,7 +106,7 @@ public function testFilterBooleanOperator() {
       ['id' => 5],
     ];
 
-    $this->assertEqual(3, count($view->result));
+    $this->assertCount(3, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
   }
 
@@ -129,7 +129,7 @@ public function testFilterGroupedExposed() {
       ['id' => 5],
     ];
 
-    $this->assertEqual(3, count($view->result));
+    $this->assertCount(3, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
     $view->destroy();
 
@@ -144,7 +144,7 @@ public function testFilterGroupedExposed() {
       ['id' => 4],
     ];
 
-    $this->assertEqual(2, count($view->result));
+    $this->assertCount(2, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
 
     $view->destroy();
@@ -162,7 +162,7 @@ public function testFilterGroupedExposed() {
       ['id' => 5],
     ];
 
-    $this->assertEqual(3, count($view->result));
+    $this->assertCount(3, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
   }
 
diff --git a/core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php b/core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php
index a528a27f19f2852eef5eab9dc78a95151c0a3a02..eaada3ef04f0135b6a60e82061930e48c579f54c 100644
--- a/core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php
+++ b/core/modules/views/tests/src/Kernel/Handler/FilterInOperatorTest.php
@@ -70,7 +70,7 @@ public function testFilterInOperatorSimple() {
       ],
     ];
 
-    $this->assertEqual(2, count($view->result));
+    $this->assertCount(2, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
 
     $view->destroy();
@@ -104,7 +104,7 @@ public function testFilterInOperatorSimple() {
       ],
     ];
 
-    $this->assertEqual(3, count($view->result));
+    $this->assertCount(3, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
   }
 
@@ -130,7 +130,7 @@ public function testFilterInOperatorGroupedExposedSimple() {
       ],
     ];
 
-    $this->assertEqual(2, count($view->result));
+    $this->assertCount(2, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
   }
 
@@ -160,7 +160,7 @@ public function testFilterNotInOperatorGroupedExposedSimple() {
       ],
     ];
 
-    $this->assertEqual(3, count($view->result));
+    $this->assertCount(3, $view->result);
     $this->assertIdenticalResultset($view, $expected_result, $this->columnMap);
   }
 
diff --git a/core/modules/views/tests/src/Kernel/ModuleTest.php b/core/modules/views/tests/src/Kernel/ModuleTest.php
index 99b6087471d8af2c35cc296c653ccdf711cd2ee5..97894626385844cede21d5fdd6d65b3bbebea5c9 100644
--- a/core/modules/views/tests/src/Kernel/ModuleTest.php
+++ b/core/modules/views/tests/src/Kernel/ModuleTest.php
@@ -275,23 +275,23 @@ public function testViewsEmbedView() {
 
     $result = views_embed_view('test_argument');
     $renderer->renderPlain($result);
-    $this->assertEqual(count($result['view_build']['#view']->result), 5);
+    $this->assertCount(5, $result['view_build']['#view']->result);
 
     $result = views_embed_view('test_argument', 'default', 1);
     $renderer->renderPlain($result);
-    $this->assertEqual(count($result['view_build']['#view']->result), 1);
+    $this->assertCount(1, $result['view_build']['#view']->result);
 
     $result = views_embed_view('test_argument', 'default', '1,2');
     $renderer->renderPlain($result);
-    $this->assertEqual(count($result['view_build']['#view']->result), 2);
+    $this->assertCount(2, $result['view_build']['#view']->result);
 
     $result = views_embed_view('test_argument', 'default', '1,2', 'John');
     $renderer->renderPlain($result);
-    $this->assertEqual(count($result['view_build']['#view']->result), 1);
+    $this->assertCount(1, $result['view_build']['#view']->result);
 
     $result = views_embed_view('test_argument', 'default', '1,2', 'John,George');
     $renderer->renderPlain($result);
-    $this->assertEqual(count($result['view_build']['#view']->result), 2);
+    $this->assertCount(2, $result['view_build']['#view']->result);
   }
 
   /**
@@ -300,39 +300,39 @@ public function testViewsEmbedView() {
   public function testViewsPreview() {
     $view = Views::getView('test_argument');
     $result = $view->preview('default');
-    $this->assertEqual(count($result['#view']->result), 5);
+    $this->assertCount(5, $result['#view']->result);
 
     $view = Views::getView('test_argument');
     $result = $view->preview('default', ['0' => 1]);
-    $this->assertEqual(count($result['#view']->result), 1);
+    $this->assertCount(1, $result['#view']->result);
 
     $view = Views::getView('test_argument');
     $result = $view->preview('default', ['3' => 1]);
-    $this->assertEqual(count($result['#view']->result), 1);
+    $this->assertCount(1, $result['#view']->result);
 
     $view = Views::getView('test_argument');
     $result = $view->preview('default', ['0' => '1,2']);
-    $this->assertEqual(count($result['#view']->result), 2);
+    $this->assertCount(2, $result['#view']->result);
 
     $view = Views::getView('test_argument');
     $result = $view->preview('default', ['3' => '1,2']);
-    $this->assertEqual(count($result['#view']->result), 2);
+    $this->assertCount(2, $result['#view']->result);
 
     $view = Views::getView('test_argument');
     $result = $view->preview('default', ['0' => '1,2', '1' => 'John']);
-    $this->assertEqual(count($result['#view']->result), 1);
+    $this->assertCount(1, $result['#view']->result);
 
     $view = Views::getView('test_argument');
     $result = $view->preview('default', ['3' => '1,2', '4' => 'John']);
-    $this->assertEqual(count($result['#view']->result), 1);
+    $this->assertCount(1, $result['#view']->result);
 
     $view = Views::getView('test_argument');
     $result = $view->preview('default', ['0' => '1,2', '1' => 'John,George']);
-    $this->assertEqual(count($result['#view']->result), 2);
+    $this->assertCount(2, $result['#view']->result);
 
     $view = Views::getView('test_argument');
     $result = $view->preview('default', ['3' => '1,2', '4' => 'John,George']);
-    $this->assertEqual(count($result['#view']->result), 2);
+    $this->assertCount(2, $result['#view']->result);
   }
 
   /**
diff --git a/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php b/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php
index 02f6eceb743b8a4c78209a716299fda8b40cf088..a6787b17d4ac64f684c22d1a6051b6c3a4bc926d 100644
--- a/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php
+++ b/core/modules/views/tests/src/Kernel/Plugin/CacheTest.php
@@ -81,7 +81,7 @@ public function testTimeResultCaching() {
     // Test the default (non-paged) display.
     $this->executeView($view);
     // Verify the result.
-    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');
+    $this->assertCount(5, $view->result, 'The number of returned rows match.');
 
     // Add another man to the beatles.
     $record = [
@@ -97,7 +97,7 @@ public function testTimeResultCaching() {
     $view->destroy();
     $this->executeView($view);
     // Verify the result.
-    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');
+    $this->assertCount(5, $view->result, 'The number of returned rows match.');
   }
 
   /**
@@ -141,7 +141,7 @@ public function testTimeResultCachingWithFilter() {
     $dataset = [['name' => 'John']];
 
     // Verify the result.
-    $this->assertEqual(1, count($view->result), 'The number of returned rows match.');
+    $this->assertCount(1, $view->result, 'The number of returned rows match.');
     $this->assertIdenticalResultSet($view, $dataset, [
       'views_test_data_name' => 'name',
     ]);
@@ -172,7 +172,7 @@ public function testTimeResultCachingWithFilter() {
     $dataset = [['name' => 'Ringo']];
 
     // Verify the result.
-    $this->assertEqual(1, count($view->result), 'The number of returned rows match.');
+    $this->assertCount(1, $view->result, 'The number of returned rows match.');
     $this->assertIdenticalResultSet($view, $dataset, [
       'views_test_data_name' => 'name',
     ]);
@@ -235,7 +235,7 @@ public function testNoneResultCaching() {
 
     $this->executeView($view);
     // Verify the result.
-    $this->assertEqual(5, count($view->result), 'The number of returned rows match.');
+    $this->assertCount(5, $view->result, 'The number of returned rows match.');
 
     // Add another man to the beatles.
     $record = [
@@ -255,7 +255,7 @@ public function testNoneResultCaching() {
 
     $this->executeView($view);
     // Verify the result.
-    $this->assertEqual(6, count($view->result), 'The number of returned rows match.');
+    $this->assertCount(6, $view->result, 'The number of returned rows match.');
   }
 
   /**
diff --git a/core/modules/views/tests/src/Kernel/Plugin/DisplayExtenderTest.php b/core/modules/views/tests/src/Kernel/Plugin/DisplayExtenderTest.php
index fc4b2f40243e4d2a9e0988c244002481e984df6a..09a14e1d18f9f7ee21b786a958422e309d7ef108 100644
--- a/core/modules/views/tests/src/Kernel/Plugin/DisplayExtenderTest.php
+++ b/core/modules/views/tests/src/Kernel/Plugin/DisplayExtenderTest.php
@@ -27,12 +27,12 @@ class DisplayExtenderTest extends ViewsKernelTestBase {
    */
   public function testDisplayExtenders() {
     $this->config('views.settings')->set('display_extenders', ['display_extender_test'])->save();
-    $this->assertEqual(count(Views::getEnabledDisplayExtenders()), 1, 'Make sure that there is only one enabled display extender.');
+    $this->assertCount(1, Views::getEnabledDisplayExtenders(), 'Make sure that there is only one enabled display extender.');
 
     $view = Views::getView('test_view');
     $view->initDisplay();
 
-    $this->assertEqual(count($view->display_handler->getExtenders()), 1, 'Make sure that only one extender is initialized.');
+    $this->assertCount(1, $view->display_handler->getExtenders(), 'Make sure that only one extender is initialized.');
 
     $display_extender = $view->display_handler->getExtenders()['display_extender_test'];
     $this->assertInstanceOf(DisplayExtenderTestData::class, $display_extender);
diff --git a/core/modules/views/tests/src/Kernel/Plugin/ExposedFormRenderTest.php b/core/modules/views/tests/src/Kernel/Plugin/ExposedFormRenderTest.php
index f6459aa6e0f19ff0bed34d108f70338ff4c8c97c..4a2bc63f64aecba105749d7d01805195efd40134 100644
--- a/core/modules/views/tests/src/Kernel/Plugin/ExposedFormRenderTest.php
+++ b/core/modules/views/tests/src/Kernel/Plugin/ExposedFormRenderTest.php
@@ -50,7 +50,7 @@ public function testExposedFormRender() {
     $this->assertFieldByXPath('//form/@action', $expected_action, 'The expected value for the action attribute was found.');
     // Make sure the description is shown.
     $result = $this->xpath('//form//div[contains(@id, :id) and normalize-space(text())=:description]', [':id' => 'edit-type--description', ':description' => t('Exposed description')]);
-    $this->assertEqual(count($result), 1, 'Filter description was found.');
+    $this->assertCount(1, $result, 'Filter description was found.');
   }
 
   /**
diff --git a/core/modules/views/tests/src/Kernel/Plugin/RelationshipTest.php b/core/modules/views/tests/src/Kernel/Plugin/RelationshipTest.php
index 9f8975eba826fceeb68b8678e7794501145dbb7f..421b73643b5610730acb59c6032a54b4c9d57634 100644
--- a/core/modules/views/tests/src/Kernel/Plugin/RelationshipTest.php
+++ b/core/modules/views/tests/src/Kernel/Plugin/RelationshipTest.php
@@ -173,9 +173,9 @@ public function testRelationshipRender() {
 
     // Check that the output contains correct values.
     $xpath = '//div[@class="views-row" and div[@class="views-field views-field-id"]=:id and div[@class="views-field views-field-author"]=:author]';
-    $this->assertEqual(1, count($this->xpath($xpath, [':id' => 1, ':author' => $author1->getAccountName()])));
-    $this->assertEqual(1, count($this->xpath($xpath, [':id' => 2, ':author' => $author2->getAccountName()])));
-    $this->assertEqual(1, count($this->xpath($xpath, [':id' => 3, ':author' => ''])));
+    $this->assertCount(1, $this->xpath($xpath, [':id' => 1, ':author' => $author1->getAccountName()]));
+    $this->assertCount(1, $this->xpath($xpath, [':id' => 2, ':author' => $author2->getAccountName()]));
+    $this->assertCount(1, $this->xpath($xpath, [':id' => 3, ':author' => '']));
   }
 
 }
diff --git a/core/modules/views/tests/src/Kernel/QueryGroupByTest.php b/core/modules/views/tests/src/Kernel/QueryGroupByTest.php
index 1fed680f4f5f44d2db702d82f329445c75a10032..61b795d6aa298833dbcf305b1f817e1c1454ce45 100644
--- a/core/modules/views/tests/src/Kernel/QueryGroupByTest.php
+++ b/core/modules/views/tests/src/Kernel/QueryGroupByTest.php
@@ -67,7 +67,7 @@ public function testAggregateCount() {
     $view = Views::getView('test_aggregate_count');
     $this->executeView($view);
 
-    $this->assertEqual(count($view->result), 2, 'Make sure the count of items is right.');
+    $this->assertCount(2, $view->result, 'Make sure the count of items is right.');
 
     $types = [];
     foreach ($view->result as $item) {
@@ -105,7 +105,7 @@ public function groupByTestHelper($aggregation_function, $values) {
 
     $this->executeView($view);
 
-    $this->assertEqual(count($view->result), 2, 'Make sure the count of items is right.');
+    $this->assertCount(2, $view->result, 'Make sure the count of items is right.');
     // Group by name to identify the right count.
     $results = [];
     foreach ($view->result as $item) {
@@ -252,7 +252,7 @@ public function testGroupByFieldWithCardinality() {
 
     $view = Views::getView('test_group_by_count_multicardinality');
     $this->executeView($view);
-    $this->assertEqual(2, count($view->result));
+    $this->assertCount(2, $view->result);
 
     $this->assertEqual('3', $view->getStyle()->getField(0, 'id'));
     $this->assertEqual('1', $view->getStyle()->getField(0, 'field_test'));
@@ -266,7 +266,7 @@ public function testGroupByFieldWithCardinality() {
 
     $view = Views::getView('test_group_by_count_multicardinality');
     $this->executeView($view);
-    $this->assertEqual(5, count($view->result));
+    $this->assertCount(5, $view->result);
 
     $this->assertEqual('3', $view->getStyle()->getField(0, 'id'));
     $this->assertEqual('1', $view->getStyle()->getField(0, 'field_test'));
@@ -288,7 +288,7 @@ public function testGroupByFieldWithCardinality() {
     $view = Views::getView('test_group_by_count_multicardinality');
     $this->executeView($view);
 
-    $this->assertEqual(6, count($view->result));
+    $this->assertCount(6, $view->result);
     $this->assertEqual('3', $view->getStyle()->getField(5, 'id'));
     $this->assertEqual('6', $view->getStyle()->getField(5, 'field_test'));
   }
@@ -328,7 +328,7 @@ public function testGroupByWithFieldsNotExistingOnBundle() {
     $view = Views::getView('test_group_by_field_not_within_bundle');
     $this->executeView($view);
 
-    $this->assertEqual(2, count($view->result));
+    $this->assertCount(2, $view->result);
     // The first result is coming from entity_test_mul2, so no field could be
     // rendered.
     $this->assertEqual('', $view->getStyle()->getField(0, 'field_test'));
diff --git a/core/modules/views/tests/src/Kernel/ViewElementTest.php b/core/modules/views/tests/src/Kernel/ViewElementTest.php
index 921fac70b16f58437878137443c6e6dd9206efc1..29b7437de613489bd2195ddd45be1ae2d6ca9f16 100644
--- a/core/modules/views/tests/src/Kernel/ViewElementTest.php
+++ b/core/modules/views/tests/src/Kernel/ViewElementTest.php
@@ -37,7 +37,7 @@ public function testViewElement() {
 
     // There should be 5 rows in the results.
     $xpath = $this->xpath('//div[@class="views-row"]');
-    $this->assertEqual(count($xpath), 5);
+    $this->assertCount(5, $xpath);
 
     // Add an argument and save the view.
     $view->displayHandlers->get('default')->overrideOption('arguments', [
@@ -65,7 +65,7 @@ public function testViewElement() {
     $this->setRawContent($renderer->renderRoot($render));
     // There should be 1 row in the results, 'John' arg 25.
     $xpath = $this->xpath('//div[@class="views-row"]');
-    $this->assertEqual(count($xpath), 1);
+    $this->assertCount(1, $xpath);
   }
 
   /**
@@ -90,7 +90,7 @@ public function testViewElementEmbed() {
 
     // There should be 5 rows in the results.
     $xpath = $this->xpath('//div[@class="views-row"]');
-    $this->assertEqual(count($xpath), 5);
+    $this->assertCount(5, $xpath);
 
     // Add an argument and save the view.
     $view->displayHandlers->get('default')->overrideOption('arguments', [
@@ -118,7 +118,7 @@ public function testViewElementEmbed() {
     $this->setRawContent($renderer->renderRoot($render));
     // There should be 1 row in the results, 'John' arg 25.
     $xpath = $this->xpath('//div[@class="views-row"]');
-    $this->assertEqual(count($xpath), 1);
+    $this->assertCount(1, $xpath);
 
     // Tests the render array with an exposed filter.
     $view = Views::getView('test_view_embed');
@@ -126,7 +126,7 @@ public function testViewElementEmbed() {
     $this->setRawContent($renderer->renderRoot($render));
 
     // Ensure that the exposed form is rendered.
-    $this->assertEqual(1, count($this->xpath('//form[@class="views-exposed-form"]')));
+    $this->assertCount(1, $this->xpath('//form[@class="views-exposed-form"]'));
   }
 
 }
diff --git a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php
index f697a6834fb8a0d5f96f2a8a89fb50214a667dac..1e5b716334e062903ecd53fe29fe6f437007e611 100644
--- a/core/modules/views/tests/src/Kernel/ViewExecutableTest.php
+++ b/core/modules/views/tests/src/Kernel/ViewExecutableTest.php
@@ -476,7 +476,7 @@ public function testValidateNestedLoops() {
     });
     // Assert that there were 9 total errors across 3 displays.
     $this->assertIdentical(9, $total_error_count);
-    $this->assertIdentical(3, count($errors));
+    $this->assertCount(3, $errors);
   }
 
   /**
diff --git a/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
index 3b09d2bdddc1a26b1cc5cc6c523212636c8ccd7c..da2d440f6823cd3293c2782693a78466bad1aa8b 100644
--- a/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DefaultViewsTest.php
@@ -176,21 +176,21 @@ public function testSplitListing() {
     $this->drupalGet('admin/structure/views');
 
     $elements = $this->xpath($xpath, $arguments);
-    $this->assertIdentical(count($elements), 0, 'A disabled view is not found in the enabled views table.');
+    $this->assertCount(0, $elements, 'A disabled view is not found in the enabled views table.');
 
     $arguments[':status'] = 'views-list-section disabled';
     $elements = $this->xpath($xpath, $arguments);
-    $this->assertIdentical(count($elements), 1, 'A disabled view is found in the disabled views table.');
+    $this->assertCount(1, $elements, 'A disabled view is found in the disabled views table.');
 
     // Enable the view.
     $this->clickViewsOperationLink(t('Enable'), '/test_view_status/');
 
     $elements = $this->xpath($xpath, $arguments);
-    $this->assertIdentical(count($elements), 0, 'After enabling a view, it is not found in the disabled views table.');
+    $this->assertCount(0, $elements, 'After enabling a view, it is not found in the disabled views table.');
 
     $arguments[':status'] = 'views-list-section enabled';
     $elements = $this->xpath($xpath, $arguments);
-    $this->assertIdentical(count($elements), 1, 'After enabling a view, it is found in the enabled views table.');
+    $this->assertCount(1, $elements, 'After enabling a view, it is found in the enabled views table.');
 
     // Attempt to disable the view by path directly, with no token.
     $this->drupalGet('admin/structure/views/view/test_view_status/disable');
diff --git a/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php b/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php
index 7bdce08fefe880f43e538f96370c4cc937df8419..9f6e07633d84ca57390df5afcd743fe352675eab 100644
--- a/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php
+++ b/core/modules/views_ui/tests/src/Functional/DisplayCRUDTest.php
@@ -104,7 +104,7 @@ public function testRemoveDisplay() {
   public function testDefaultDisplay() {
     $this->drupalGet('admin/structure/views/view/test_display');
     $elements = $this->xpath('//*[@id="views-page-1-display-title"]');
-    $this->assertEqual(count($elements), 1, 'The page display is loaded as the default display.');
+    $this->assertCount(1, $elements, 'The page display is loaded as the default display.');
   }
 
   /**
diff --git a/core/modules/views_ui/tests/src/Functional/FilterBooleanWebTest.php b/core/modules/views_ui/tests/src/Functional/FilterBooleanWebTest.php
index f62c8c0ae8867afe0a46ea01eb4ace04537359a9..3a2546d59a17c30994fdbabc3a09536b9b89f3ce 100644
--- a/core/modules/views_ui/tests/src/Functional/FilterBooleanWebTest.php
+++ b/core/modules/views_ui/tests/src/Functional/FilterBooleanWebTest.php
@@ -58,7 +58,7 @@ public function testFilterBooleanUI() {
     $this->assertEqual($result[1]->getAttribute('checked'), 'checked');
 
     // Test that there is a remove link for each group.
-    $this->assertEqual(count($this->cssSelect('a.views-remove-link')), 3);
+    $this->assertCount(3, $this->cssSelect('a.views-remove-link'));
 
     // Test selecting a default and removing an item.
     $edit = [];
diff --git a/core/modules/views_ui/tests/src/Functional/HandlerTest.php b/core/modules/views_ui/tests/src/Functional/HandlerTest.php
index 706889eeaa162c9d4fc72eb5a4d15bbf3a0b0be5..dc2101b81789140421774fbd73d1a3e55062e571 100644
--- a/core/modules/views_ui/tests/src/Functional/HandlerTest.php
+++ b/core/modules/views_ui/tests/src/Functional/HandlerTest.php
@@ -211,7 +211,7 @@ public function testBrokenHandlers() {
       $href = "admin/structure/views/nojs/handler/test_view_broken/default/$type/id_broken";
 
       $result = $this->xpath('//a[contains(@href, :href)]', [':href' => $href]);
-      $this->assertEqual(count($result), 1, new FormattableMarkup('Handler (%type) edit link found.', ['%type' => $type]));
+      $this->assertCount(1, $result, new FormattableMarkup('Handler (%type) edit link found.', ['%type' => $type]));
 
       $text = 'Broken/missing handler';
 
@@ -283,7 +283,7 @@ public function testErrorMissingHelp() {
    */
   public function assertNoDuplicateField($field_name, $entity_type) {
     $elements = $this->xpath('//td[.=:entity_type]/preceding-sibling::td[@class="title" and .=:title]', [':title' => $field_name, ':entity_type' => $entity_type]);
-    $this->assertEqual(1, count($elements), $field_name . ' appears just once in ' . $entity_type . '.');
+    $this->assertCount(1, $elements, $field_name . ' appears just once in ' . $entity_type . '.');
   }
 
 }
diff --git a/core/modules/views_ui/tests/src/Functional/PreviewTest.php b/core/modules/views_ui/tests/src/Functional/PreviewTest.php
index 7cd200347705ceffe58b40c2f63c12a02fdccb28..65dbaef25a2ab7d37e136dde93f6dad9dc36f3f1 100644
--- a/core/modules/views_ui/tests/src/Functional/PreviewTest.php
+++ b/core/modules/views_ui/tests/src/Functional/PreviewTest.php
@@ -33,7 +33,7 @@ public function testPreviewContextual() {
     $this->drupalPostForm(NULL, $edit = [], t('Update preview'));
 
     $elements = $this->xpath('//div[@id="views-live-preview"]//ul[contains(@class, :ul-class)]/li[contains(@class, :li-class)]', [':ul-class' => 'contextual-links', ':li-class' => 'filter-add']);
-    $this->assertEqual(count($elements), 1, 'The contextual link to add a new field is shown.');
+    $this->assertCount(1, $elements, 'The contextual link to add a new field is shown.');
 
     $this->drupalPostForm(NULL, $edit = ['view_args' => '100'], t('Update preview'));
 
@@ -54,19 +54,19 @@ public function testPreviewUI() {
     $this->drupalPostForm(NULL, $edit = [], t('Update preview'));
 
     $elements = $this->xpath('//div[@class = "view-content"]/div[contains(@class, views-row)]');
-    $this->assertEqual(count($elements), 5);
+    $this->assertCount(5, $elements);
 
     // Filter just the first result.
     $this->drupalPostForm(NULL, $edit = ['view_args' => '1'], t('Update preview'));
 
     $elements = $this->xpath('//div[@class = "view-content"]/div[contains(@class, views-row)]');
-    $this->assertEqual(count($elements), 1);
+    $this->assertCount(1, $elements);
 
     // Filter for no results.
     $this->drupalPostForm(NULL, $edit = ['view_args' => '100'], t('Update preview'));
 
     $elements = $this->xpath('//div[@class = "view-content"]/div[contains(@class, views-row)]');
-    $this->assertEqual(count($elements), 0);
+    $this->assertCount(0, $elements);
 
     // Test that area text and exposed filters are present and rendered.
     $this->assertFieldByName('id', NULL, 'ID exposed filter field found.');
@@ -127,7 +127,7 @@ public function testPreviewUI() {
     $this->drupalPostForm("admin/structure/views/nojs/display/test_preview/default/title", $edit = ['title' => 'Double & escaped'], t('Apply'));
     $this->drupalPostForm(NULL, [], t('Update preview'));
     $elements = $this->xpath('//div[@id="views-live-preview"]/div[contains(@class, views-query-info)]//td[text()=:text]', [':text' => 'Double & escaped']);
-    $this->assertEqual(1, count($elements));
+    $this->assertCount(1, $elements);
   }
 
   /**
@@ -145,7 +145,7 @@ public function testPreviewAdditionalInfo() {
     // Check for implementation of hook_views_preview_info_alter().
     // @see views_ui_test.module
     $elements = $this->xpath('//div[@id="views-live-preview"]/div[contains(@class, views-query-info)]//td[text()=:text]', [':text' => 'Test row count']);
-    $this->assertEqual(count($elements), 1, 'Views Query Preview Info area altered.');
+    $this->assertCount(1, $elements, 'Views Query Preview Info area altered.');
     // Check that additional assets are attached.
     $this->assertStringContainsString('views_ui_test/views_ui_test.test', $this->getDrupalSettings()['ajaxPageState']['libraries'], 'Attached library found.');
     $this->assertRaw('css/views_ui_test.test.css', 'Attached CSS asset found.');
diff --git a/core/modules/views_ui/tests/src/Functional/SettingsTest.php b/core/modules/views_ui/tests/src/Functional/SettingsTest.php
index ae419644dd20f19c66bf535c4365ed3cd64fdfc2..6c16a7e161fd12424e72741ece156e6e3b93e9a0 100644
--- a/core/modules/views_ui/tests/src/Functional/SettingsTest.php
+++ b/core/modules/views_ui/tests/src/Functional/SettingsTest.php
@@ -110,7 +110,7 @@ public function testEditUI() {
 
     $this->drupalPostForm(NULL, [], t('Update preview'));
     $xpath = $this->xpath('//div[@class="views-query-info"]/pre');
-    $this->assertEqual(count($xpath), 0, 'The views sql is hidden.');
+    $this->assertCount(0, $xpath, 'The views sql is hidden.');
 
     $edit = [
       'ui_show_sql_query_enabled' => TRUE,
@@ -122,7 +122,7 @@ public function testEditUI() {
 
     $this->drupalPostForm(NULL, [], t('Update preview'));
     $xpath = $this->xpath('//div[@class="views-query-info"]//pre');
-    $this->assertEqual(count($xpath), 1, 'The views sql is shown.');
+    $this->assertCount(1, $xpath, 'The views sql is shown.');
     $this->assertStringNotContainsString('db_condition_placeholder', $xpath[0]->getText(), 'No placeholders are shown in the views sql.');
     $this->assertStringContainsString(Database::getConnection()->escapeField("node_field_data.status") . " = '1'", $xpath[0]->getText(), 'The placeholders in the views sql is replace by the actual value.');
 
diff --git a/core/modules/views_ui/tests/src/Kernel/TagTest.php b/core/modules/views_ui/tests/src/Kernel/TagTest.php
index b6b0cee81ad30f88345cb5d867f54b3d815eba07..32e188f1fc2716bfd55f94d5cb71c957680ee796 100644
--- a/core/modules/views_ui/tests/src/Kernel/TagTest.php
+++ b/core/modules/views_ui/tests/src/Kernel/TagTest.php
@@ -42,7 +42,7 @@ public function testViewsUiAutocompleteTag() {
     $request->query->set('q', 'autocomplete_tag_test');
     $result = $controller->autocompleteTag($request);
     $matches = (array) json_decode($result->getContent(), TRUE);
-    $this->assertEqual(count($matches), 10, 'Make sure the maximum amount of tag results is 10.');
+    $this->assertCount(10, $matches, 'Make sure the maximum amount of tag results is 10.');
 
     // Make sure the returned array has the proper format.
     $suggestions = array_map(function ($tag) {
@@ -56,7 +56,7 @@ public function testViewsUiAutocompleteTag() {
     $request->query->set('q', 'autocomplete_tag_test_even');
     $result = $controller->autocompleteTag($request);
     $matches = (array) json_decode($result->getContent(), TRUE);
-    $this->assertEqual(count($matches), 8, 'Make sure that only a subset is returned.');
+    $this->assertCount(8, $matches, 'Make sure that only a subset is returned.');
     foreach ($matches as $tag) {
       $this->assertContains($tag['value'], $tags);
     }
@@ -65,7 +65,7 @@ public function testViewsUiAutocompleteTag() {
     $request->query->set('q', $this->randomMachineName());
     $result = $controller->autocompleteTag($request);
     $matches = (array) json_decode($result->getContent());
-    $this->assertEqual(count($matches), 0, "Make sure an invalid tag doesn't return anything.");
+    $this->assertCount(0, $matches, "Make sure an invalid tag doesn't return anything.");
   }
 
 }
diff --git a/core/profiles/standard/tests/src/Functional/StandardTest.php b/core/profiles/standard/tests/src/Functional/StandardTest.php
index 1f7c111edfb582b5c94eeed32c7bbad13dbb090f..45efb5c579336230193c41596165627d49f39c45 100644
--- a/core/profiles/standard/tests/src/Functional/StandardTest.php
+++ b/core/profiles/standard/tests/src/Functional/StandardTest.php
@@ -69,14 +69,14 @@ public function testStandard() {
       ':id' => 'block-bartik-help',
     ]);
 
-    $this->assertEqual(count($elements), 1, 'Found complementary role on help block.');
+    $this->assertCount(1, $elements, 'Found complementary role on help block.');
 
     $this->drupalGet('');
     $elements = $this->xpath('//div[@role=:role and @id=:id]', [
       ':role' => 'complementary',
       ':id' => 'block-bartik-powered',
     ]);
-    $this->assertEqual(count($elements), 1, 'Found complementary role on powered by block.');
+    $this->assertCount(1, $elements, 'Found complementary role on powered by block.');
 
     // Verify anonymous user can see the block.
     $this->drupalLogout();
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php
index d3283c0778d85d10af85445ee6f26f8291c90739..ba52dd479121e98b1625a7efaaf315c4dca04245 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormCacheTest.php
@@ -33,7 +33,7 @@ public function testFormCacheUsage() {
     $this->drupalLogin($this->rootUser);
 
     // Ensure that the cache is empty.
-    $this->assertEqual(0, count($key_value_expirable->getAll()));
+    $this->assertCount(0, $key_value_expirable->getAll());
 
     // Visit an AJAX form that is not cached, 3 times.
     $uncached_form_url = Url::fromRoute('ajax_forms_test.commands_form');
@@ -42,7 +42,7 @@ public function testFormCacheUsage() {
     $this->drupalGet($uncached_form_url);
 
     // The number of cache entries should not have changed.
-    $this->assertEqual(0, count($key_value_expirable->getAll()));
+    $this->assertCount(0, $key_value_expirable->getAll());
   }
 
   /**
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
index 7cab905c0d10deb63c2bf00e254f544017208058..721174dc3f71d8873e6d6f591845ebea76dfcf2d 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/AjaxFormPageCacheTest.php
@@ -37,7 +37,7 @@ protected function setUp(): void {
    */
   protected function getFormBuildId() {
     $build_id_fields = $this->xpath('//input[@name="form_build_id"]');
-    $this->assertEquals(count($build_id_fields), 1, 'One form build id field on the page');
+    $this->assertCount(1, $build_id_fields, 'One form build id field on the page');
     return $build_id_fields[0]->getValue();
   }
 
diff --git a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php
index e6b525fa343866e38138081b0711769029662ab0..8b52d89a7955def2f9c7167f606e2bdc6282445d 100644
--- a/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php
+++ b/core/tests/Drupal/FunctionalJavascriptTests/Ajax/MultiFormTest.php
@@ -82,7 +82,7 @@ public function testMultiForm() {
     $session = $this->getSession();
     $page = $session->getPage();
     $fields = $page->findAll('xpath', $form_xpath . $field_xpath);
-    $this->assertEqual(count($fields), 2);
+    $this->assertCount(2, $fields);
     foreach ($fields as $field) {
       $this->assertCount(1, $field->findAll('xpath', '.' . $field_items_xpath_suffix), 'Found the correct number of field items on the initial page.');
       $this->assertFieldsByValue($field->find('xpath', '.' . $button_xpath_suffix), NULL, 'Found the "add more" button on the initial page.');
@@ -106,7 +106,7 @@ public function testMultiForm() {
         // After AJAX request and response page will update.
         $page_updated = $session->getPage();
         $field = $page_updated->findAll('xpath', '.' . $field_xpath);
-        $this->assertEqual(count($field[0]->find('xpath', '.' . $field_items_xpath_suffix)), $i + 2, 'Found the correct number of field items after an AJAX submission.');
+        $this->assertCount($i + 2, $field[0]->find('xpath', '.' . $field_items_xpath_suffix), 'Found the correct number of field items after an AJAX submission.');
         $this->assertFieldsByValue($field[0]->find('xpath', '.' . $button_xpath_suffix), NULL, 'Found the "add more" button after an AJAX submission.');
         $this->assertNoDuplicateIds();
       }
diff --git a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php
index 5577df2bf6fae29f00216cbe8b2a4c285bb94e9d..c65df1edef91885cdfd1a656180353651961686f 100644
--- a/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php
+++ b/core/tests/Drupal/FunctionalTests/Bootstrap/UncaughtExceptionTest.php
@@ -279,7 +279,7 @@ public function testLoggerException() {
 
     // Find fatal error logged to the error.log
     $errors = file(\Drupal::root() . '/' . $this->siteDirectory . '/error.log');
-    $this->assertIdentical(count($errors), 8, 'The error + the error that the logging service is broken has been written to the error log.');
+    $this->assertCount(8, $errors, 'The error + the error that the logging service is broken has been written to the error log.');
     $this->assertStringContainsString('Failed to log error', $errors[0], 'The error handling logs when an error could not be logged to the logger.');
 
     $expected_path = \Drupal::root() . '/core/modules/system/tests/modules/error_service_test/src/MonkeysInTheControlRoom.php';
diff --git a/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php b/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php
index 3428de11518673b4d202857862e31e0c3f0a8146..d4b8b1609cc0155de970cd1a6568a3d0818b935c 100644
--- a/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php
+++ b/core/tests/Drupal/FunctionalTests/Datetime/TimestampTest.php
@@ -116,7 +116,7 @@ public function testWidget() {
 
     // Make sure the "datetime_timestamp" widget is on the page.
     $fields = $this->xpath('//div[contains(@class, "field--widget-datetime-timestamp") and @id="edit-field-timestamp-wrapper"]');
-    $this->assertEquals(1, count($fields));
+    $this->assertCount(1, $fields);
 
     // Look for the widget elements and make sure they are empty.
     $this->assertSession()->fieldExists('field_timestamp[0][value][date]');
diff --git a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php
index 477cd38434bdb383e0ef6710b09f75c2ef2c5616..570354028cf87636c048a9abbfb5355fd0db4385 100644
--- a/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php
+++ b/core/tests/Drupal/FunctionalTests/Installer/InstallerTest.php
@@ -63,7 +63,7 @@ protected function setUpProfile() {
     // Assert that the expected title is present.
     $this->assertEqual('Select an installation profile', $this->cssSelect('main h2')[0]->getText());
     $result = $this->xpath('//span[contains(@class, :class) and contains(text(), :text)]', [':class' => 'visually-hidden', ':text' => 'Select an installation profile']);
-    $this->assertEqual(count($result), 1, "Title/Label not displayed when '#title_display' => 'invisible' attribute is set");
+    $this->assertCount(1, $result, "Title/Label not displayed when '#title_display' => 'invisible' attribute is set");
 
     parent::setUpProfile();
   }
diff --git a/core/tests/Drupal/FunctionalTests/MailCaptureTest.php b/core/tests/Drupal/FunctionalTests/MailCaptureTest.php
index 74e2f07ef8c1441ccf70754c8505990aece78d94..8acae8629d667c21ee2544b868d61a26131d46bd 100644
--- a/core/tests/Drupal/FunctionalTests/MailCaptureTest.php
+++ b/core/tests/Drupal/FunctionalTests/MailCaptureTest.php
@@ -39,14 +39,14 @@ public function testMailSend() {
 
     // Before we send the email, drupalGetMails should return an empty array.
     $captured_emails = $this->drupalGetMails();
-    $this->assertEqual(count($captured_emails), 0, 'The captured emails queue is empty.', 'Email');
+    $this->assertCount(0, $captured_emails, 'The captured emails queue is empty.');
 
     // Send the email.
     \Drupal::service('plugin.manager.mail')->getInstance(['module' => 'simpletest', 'key' => 'drupal_mail_test'])->mail($message);
 
     // Ensure that there is one email in the captured emails array.
     $captured_emails = $this->drupalGetMails();
-    $this->assertEqual(count($captured_emails), 1, 'One email was captured.', 'Email');
+    $this->assertCount(1, $captured_emails, 'One email was captured.');
 
     // Assert that the email was sent by iterating over the message properties
     // and ensuring that they are captured intact.
@@ -68,22 +68,22 @@ public function testMailSend() {
 
     // There should now be 6 emails captured.
     $captured_emails = $this->drupalGetMails();
-    $this->assertEqual(count($captured_emails), 6, 'All emails were captured.', 'Email');
+    $this->assertCount(6, $captured_emails, 'All emails were captured.');
 
     // Test different ways of getting filtered emails via drupalGetMails().
     $captured_emails = $this->drupalGetMails(['id' => 'drupal_mail_test']);
-    $this->assertEqual(count($captured_emails), 1, 'Only one email is returned when filtering by id.', 'Email');
+    $this->assertCount(1, $captured_emails, 'Only one email is returned when filtering by id.');
     $captured_emails = $this->drupalGetMails(['id' => 'drupal_mail_test', 'subject' => $subject]);
-    $this->assertEqual(count($captured_emails), 1, 'Only one email is returned when filtering by id and subject.', 'Email');
+    $this->assertCount(1, $captured_emails, 'Only one email is returned when filtering by id and subject.');
     $captured_emails = $this->drupalGetMails(['id' => 'drupal_mail_test', 'subject' => $subject, 'from' => 'this_was_not_used@example.com']);
-    $this->assertEqual(count($captured_emails), 0, 'No emails are returned when querying with an unused from address.', 'Email');
+    $this->assertCount(0, $captured_emails, 'No emails are returned when querying with an unused from address.');
 
     // Send the last email again, so we can confirm that the
     // drupalGetMails-filter correctly returns all emails with a given
     // property/value.
     \Drupal::service('plugin.manager.mail')->getInstance(['module' => 'drupal_mail_test', 'key' => $index])->mail($message);
     $captured_emails = $this->drupalGetMails(['id' => 'drupal_mail_test_4']);
-    $this->assertEqual(count($captured_emails), 2, 'All emails with the same id are returned when filtering by id.', 'Email');
+    $this->assertCount(2, $captured_emails, 'All emails with the same id are returned when filtering by id.');
   }
 
 }
diff --git a/core/tests/Drupal/KernelTests/Config/TypedConfigTest.php b/core/tests/Drupal/KernelTests/Config/TypedConfigTest.php
index 9c4fcd557bb398207ca7b9e5016d9c26a578d3fd..ff9f7afa01bc1d5075af415d05649e1cfb28c86f 100644
--- a/core/tests/Drupal/KernelTests/Config/TypedConfigTest.php
+++ b/core/tests/Drupal/KernelTests/Config/TypedConfigTest.php
@@ -66,7 +66,7 @@ public function testTypedDataAPI() {
     $this->assertInstanceOf(StringInterface::class, $sequence->get('hum1'));
     $this->assertEquals('hum1', $sequence->get('hum1')->getValue());
     $this->assertEquals('hum2', $sequence->get('hum2')->getValue());
-    $this->assertEquals(2, count($sequence->getIterator()));
+    $this->assertCount(2, $sequence->getIterator());
     // Verify the item metadata is available.
     $this->assertInstanceOf(SequenceDataDefinition::class, $sequence->getDataDefinition());
 
diff --git a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
index 4dc11cee2a6ba1ad5f58e1d5c29c2bb8bd59feeb..5a77d5feb7d1b55ba96b9a2c9197d47ebc8963e3 100644
--- a/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Asset/AttachedAssetsTest.php
@@ -172,12 +172,12 @@ public function testAggregation() {
     $build['#attached']['library'][] = 'core/drupal.vertical-tabs';
     $assets = AttachedAssets::createFromRenderArray($build);
 
-    $this->assertEqual(1, count($this->assetResolver->getCssAssets($assets, TRUE)), 'There is a sole aggregated CSS asset.');
+    $this->assertCount(1, $this->assetResolver->getCssAssets($assets, TRUE), 'There is a sole aggregated CSS asset.');
 
     list($header_js, $footer_js) = $this->assetResolver->getJsAssets($assets, TRUE);
     $this->assertEqual([], \Drupal::service('asset.js.collection_renderer')->render($header_js), 'There are 0 JavaScript assets in the header.');
     $rendered_footer_js = \Drupal::service('asset.js.collection_renderer')->render($footer_js);
-    $this->assertEqual(2, count($rendered_footer_js), 'There are 2 JavaScript assets in the footer.');
+    $this->assertCount(2, $rendered_footer_js, 'There are 2 JavaScript assets in the footer.');
     $this->assertEqual('drupal-settings-json', $rendered_footer_js[0]['#attributes']['data-drupal-selector'], 'The first of the two JavaScript assets in the footer has drupal settings.');
     $this->assertStringStartsWith(base_path(), $rendered_footer_js[1]['#attributes']['src'], 'The second of the two JavaScript assets in the footer has the sole aggregated JavaScript asset.');
   }
diff --git a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
index 4451ec71b3f0acd0b4e40a6122387d17e4c4cb4f..c4eafa195b4c7c0c22657bd7d6af9b14d6e9df77 100644
--- a/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
+++ b/core/tests/Drupal/KernelTests/Core/Cache/GenericCacheBackendUnitTestBase.php
@@ -507,18 +507,18 @@ public function testInvalidate() {
 
     $cids = $reference;
     $ret = $backend->getMultiple($cids);
-    $this->assertEqual(count($ret), 4, 'Four items returned.');
+    $this->assertCount(4, $ret, 'Four items returned.');
 
     $backend->invalidate('test1');
     $backend->invalidateMultiple(['test2', 'test3']);
 
     $cids = $reference;
     $ret = $backend->getMultiple($cids);
-    $this->assertEqual(count($ret), 1, 'Only one item element returned.');
+    $this->assertCount(1, $ret, 'Only one item element returned.');
 
     $cids = $reference;
     $ret = $backend->getMultiple($cids, TRUE);
-    $this->assertEqual(count($ret), 4, 'Four items returned.');
+    $this->assertCount(4, $ret, 'Four items returned.');
 
     // Calling invalidateMultiple() with an empty array should not cause an
     // error.
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php
index 1f669c2cd9ddfae427fd30709f6b1d7d4732f8a6..be0d2db284d51d9a532f2ce1f1df904de9e016af 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigCRUDTest.php
@@ -184,7 +184,7 @@ public function testCRUD() {
     // previously accessed with get()
     $new_config = $config_factory->get('non_existing_key');
     $this->assertTrue($new_config->isNew());
-    $this->assertEqual(0, count($config_factory->loadMultiple(['non_existing_key'])), 'loadMultiple() does not return new objects');
+    $this->assertCount(0, $config_factory->loadMultiple(['non_existing_key']), 'loadMultiple() does not return new objects');
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php
index ba5bce5c6c66deb89a50d9b58c08f3a8d7f1826c..0ad2e2c8a65745e0f91bfb6c9e40ca404a495483 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigDiffTest.php
@@ -87,7 +87,7 @@ public function testDiff() {
     // Prove the fields match.
     $edits = $diff->getEdits();
     $this->assertEqual($edits[0]->type, 'copy', 'The first item in the diff is a copy.');
-    $this->assertEqual(count($edits), 1, 'There is one item in the diff');
+    $this->assertCount(1, $edits, 'There is one item in the diff');
 
     // Rename the entity.
     $new_test_entity_id = $this->randomMachineName();
@@ -102,7 +102,7 @@ public function testDiff() {
       ['id: ' . $test_entity_id]);
     $this->assertYamlEdit($edits, 'label', 'copy');
     $this->assertEqual($edits[2]->type, 'copy', 'The third item in the diff is a copy.');
-    $this->assertEqual(count($edits), 3, 'There are three items in the diff.');
+    $this->assertCount(3, $edits, 'There are three items in the diff.');
   }
 
   /**
@@ -128,7 +128,7 @@ public function testCollectionDiff() {
     $diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name);
     $edits = $diff->getEdits();
     $this->assertEqual($edits[0]->type, 'copy', 'The first item in the diff is a copy.');
-    $this->assertEqual(count($edits), 1, 'There is one item in the diff');
+    $this->assertCount(1, $edits, 'There is one item in the diff');
 
     // Test that the differences are detected when diffing the collection.
     $diff = \Drupal::service('config.manager')->diff($active, $sync, $config_name, NULL, 'test');
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php
index 08c96a8a657f33d75a6496660b78ddee46c3db69..fe9490d32ede91245a1de3f1d98fd9856b6a5225 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigEntityUnitTest.php
@@ -83,10 +83,10 @@ public function testStorageMethods() {
     $this->assertSame($entity->uuid(), $entity_loaded_by_uuid->uuid());
 
     $entities = $this->storage->loadByProperties();
-    $this->assertEqual(count($entities), 3, 'Three entities are loaded when no properties are specified.');
+    $this->assertCount(3, $entities, 'Three entities are loaded when no properties are specified.');
 
     $entities = $this->storage->loadByProperties(['style' => $style]);
-    $this->assertEqual(count($entities), 2, 'Two entities are loaded when the style property is specified.');
+    $this->assertCount(2, $entities, 'Two entities are loaded when the style property is specified.');
 
     // Assert that both returned entities have a matching style property.
     foreach ($entities as $entity) {
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php
index 466b6fb7b2af65e9c5171af3b10c10f7bebac60f..515d60ac04273554f42d36baa1d00be83b3b85f5 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigFileContentTest.php
@@ -159,17 +159,17 @@ public function testReadWriteConfig() {
     // Get file listing for all files starting with 'foo'. Should return
     // two elements.
     $files = $storage->listAll('foo');
-    $this->assertEqual(count($files), 2, 'Two files listed with the prefix \'foo\'.');
+    $this->assertCount(2, $files, 'Two files listed with the prefix \'foo\'.');
 
     // Get file listing for all files starting with 'biff'. Should return
     // one element.
     $files = $storage->listAll('biff');
-    $this->assertEqual(count($files), 1, 'One file listed with the prefix \'biff\'.');
+    $this->assertCount(1, $files, 'One file listed with the prefix \'biff\'.');
 
     // Get file listing for all files starting with 'foo.bar'. Should return
     // one element.
     $files = $storage->listAll('foo.bar');
-    $this->assertEqual(count($files), 1, 'One file listed with the prefix \'foo.bar\'.');
+    $this->assertCount(1, $files, 'One file listed with the prefix \'foo.bar\'.');
 
     // Get file listing for all files starting with 'bar'. Should return
     // an empty array.
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRecreateTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRecreateTest.php
index 34a0b4247f48f80df43617e531ea747ef9f3686b..2cbb3ebed7798e7d1fd5ce4975726f331c34a3cf 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRecreateTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImportRecreateTest.php
@@ -88,9 +88,9 @@ public function testRecreateEntity() {
     // will be recreated.
     $creates = $this->configImporter->getUnprocessedConfiguration('create');
     $deletes = $this->configImporter->getUnprocessedConfiguration('delete');
-    $this->assertEqual(5, count($creates), 'There are 5 configuration items to create.');
-    $this->assertEqual(5, count($deletes), 'There are 5 configuration items to delete.');
-    $this->assertEqual(0, count($this->configImporter->getUnprocessedConfiguration('update')), 'There are no configuration items to update.');
+    $this->assertCount(5, $creates, 'There are 5 configuration items to create.');
+    $this->assertCount(5, $deletes, 'There are 5 configuration items to delete.');
+    $this->assertCount(0, $this->configImporter->getUnprocessedConfiguration('update'), 'There are no configuration items to update.');
     $this->assertSame($creates, array_reverse($deletes), 'Deletes and creates contain the same configuration names in opposite orders due to dependencies.');
 
     $this->configImporter->import();
diff --git a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
index b90a19d7896ccccf33a03b8a2fe99716400351de..dd49d08b58d393ac052a0c5477924ca8a0f1c054 100644
--- a/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php
@@ -157,7 +157,7 @@ public function testDeleted() {
 
     $this->assertFalse($this->configImporter->hasUnprocessedConfigurationChanges());
     $logs = $this->configImporter->getErrors();
-    $this->assertEqual(count($logs), 0);
+    $this->assertCount(0, $logs);
   }
 
   /**
@@ -211,7 +211,7 @@ public function testNew() {
     // Verify that there is nothing more to import.
     $this->assertFalse($this->configImporter->hasUnprocessedConfigurationChanges());
     $logs = $this->configImporter->getErrors();
-    $this->assertEqual(count($logs), 0);
+    $this->assertCount(0, $logs);
   }
 
   /**
@@ -256,7 +256,7 @@ public function testSecondaryWritePrimaryFirst() {
     $this->assertEqual($secondary->label(), $values_secondary['label']);
 
     $logs = $this->configImporter->getErrors();
-    $this->assertEqual(count($logs), 1);
+    $this->assertCount(1, $logs);
     $this->assertEqual($logs[0], new FormattableMarkup('Deleted and replaced configuration entity "@name"', ['@name' => $name_secondary]));
   }
 
@@ -302,7 +302,7 @@ public function testSecondaryWriteSecondaryFirst() {
     $this->assertEqual($secondary->label(), $values_secondary['label']);
 
     $logs = $this->configImporter->getErrors();
-    $this->assertEqual(count($logs), 1);
+    $this->assertCount(1, $logs);
     $this->assertEqual($logs[0], Html::escape("Unexpected error during import with operation create for $name_primary: 'config_test' entity with ID 'secondary' already exists."));
   }
 
@@ -384,7 +384,7 @@ public function testSecondaryUpdateDeletedDeleterFirst() {
     $this->assertEqual($other->label(), $values_other['label']);
 
     $logs = $this->configImporter->getErrors();
-    $this->assertEqual(count($logs), 1);
+    $this->assertCount(1, $logs);
     $this->assertEqual($logs[0], new FormattableMarkup('Update target "@name" is missing.', ['@name' => $name_deletee]));
   }
 
@@ -435,7 +435,7 @@ public function testSecondaryUpdateDeletedDeleteeFirst() {
     $this->assertNull($entity_storage->load('deleter'));
     $this->assertNull($entity_storage->load('deletee'));
     $logs = $this->configImporter->getErrors();
-    $this->assertEqual(count($logs), 0);
+    $this->assertCount(0, $logs);
   }
 
   /**
@@ -477,7 +477,7 @@ public function testSecondaryDeletedDeleteeSecond() {
     // delete occurred in \Drupal\config_test\Entity\ConfigTest::postDelete()
     // this does not matter.
     $logs = $this->configImporter->getErrors();
-    $this->assertEqual(count($logs), 0);
+    $this->assertCount(0, $logs);
   }
 
   /**
@@ -534,7 +534,7 @@ public function testUpdated() {
     // Verify that there is nothing more to import.
     $this->assertFalse($this->configImporter->hasUnprocessedConfigurationChanges());
     $logs = $this->configImporter->getErrors();
-    $this->assertEqual(count($logs), 0);
+    $this->assertCount(0, $logs);
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/Database/AlterTest.php b/core/tests/Drupal/KernelTests/Core/Database/AlterTest.php
index 6ee99afb829a6212af0d2673e2bd245426be2cfa..84c87b876b77776a685b4f36925d943d5ef7e514 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/AlterTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/AlterTest.php
@@ -21,7 +21,7 @@ public function testSimpleAlter() {
 
     $result = $query->execute()->fetchAll();
 
-    $this->assertEqual(count($result), 2, 'Returned the correct number of rows.');
+    $this->assertCount(2, $result, 'Returned the correct number of rows.');
   }
 
   /**
@@ -38,7 +38,7 @@ public function testAlterWithJoin() {
 
     $records = $result->fetchAll();
 
-    $this->assertEqual(count($records), 2, 'Returned the correct number of rows.');
+    $this->assertCount(2, $records, 'Returned the correct number of rows.');
 
     $this->assertEqual($records[0]->name, 'George', 'Correct data retrieved.');
     $this->assertEqual($records[0]->$tid_field, 4, 'Correct data retrieved.');
@@ -66,7 +66,7 @@ public function testAlterChangeConditional() {
 
     $records = $result->fetchAll();
 
-    $this->assertEqual(count($records), 1, 'Returned the correct number of rows.');
+    $this->assertCount(1, $records, 'Returned the correct number of rows.');
     $this->assertEqual($records[0]->$name_field, 'John', 'Correct data retrieved.');
     $this->assertEqual($records[0]->$tid_field, 2, 'Correct data retrieved.');
     $this->assertEqual($records[0]->$pid_field, 1, 'Correct data retrieved.');
diff --git a/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php b/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php
index 916f0a51a7267f19f5d40857948922eda7ba0b1b..c3f46b1f91196c3e7547e71e6c2a921a85394e7c 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/FetchTest.php
@@ -28,7 +28,7 @@ public function testQueryFetchDefault() {
       $this->assertSame('John', $record->name);
     }
 
-    $this->assertIdentical(count($records), 1, 'There is only one record.');
+    $this->assertCount(1, $records, 'There is only one record.');
   }
 
   /**
@@ -43,7 +43,7 @@ public function testQueryFetchObject() {
       $this->assertSame('John', $record->name);
     }
 
-    $this->assertIdentical(count($records), 1, 'There is only one record.');
+    $this->assertCount(1, $records, 'There is only one record.');
   }
 
   /**
@@ -59,7 +59,7 @@ public function testQueryFetchArray() {
       $this->assertSame('John', $record['name']);
     }
 
-    $this->assertIdentical(count($records), 1, 'There is only one record.');
+    $this->assertCount(1, $records, 'There is only one record.');
   }
 
   /**
@@ -76,7 +76,7 @@ public function testQueryFetchClass() {
       $this->assertSame('John', $record->name);
     }
 
-    $this->assertIdentical(count($records), 1, 'There is only one record.');
+    $this->assertCount(1, $records, 'There is only one record.');
   }
 
   /**
@@ -129,7 +129,7 @@ public function testQueryFetchNum() {
       $this->assertSame('John', $record[0]);
     }
 
-    $this->assertIdentical(count($records), 1, 'There is only one record');
+    $this->assertCount(1, $records, 'There is only one record');
   }
 
   /**
@@ -147,7 +147,7 @@ public function testQueryFetchBoth() {
       $this->assertSame('John', $record['name']);
     }
 
-    $this->assertIdentical(count($records), 1, 'There is only one record.');
+    $this->assertCount(1, $records, 'There is only one record.');
   }
 
   /**
@@ -169,7 +169,7 @@ public function testQueryFetchAllColumn() {
   public function testQueryFetchCol() {
     $result = $this->connection->query('SELECT name FROM {test} WHERE age > :age', [':age' => 25]);
     $column = $result->fetchCol();
-    $this->assertIdentical(count($column), 3, 'fetchCol() returns the right number of records.');
+    $this->assertCount(3, $column, 'fetchCol() returns the right number of records.');
 
     $result = $this->connection->query('SELECT name FROM {test} WHERE age > :age', [':age' => 25]);
     $i = 0;
diff --git a/core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php b/core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php
index 3b4a920c776243ff6aa3a5c866f9de1147a55a25..4b13851722eb912075873c076408270b82a20944 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/LoggingTest.php
@@ -28,7 +28,7 @@ public function testEnableLogging() {
 
     $queries = Database::getLog('testing', 'default');
 
-    $this->assertEqual(count($queries), 3, 'Correct number of queries recorded.');
+    $this->assertCount(3, $queries, 'Correct number of queries recorded.');
 
     foreach ($queries as $query) {
       $this->assertEqual($query['caller']['function'], __FUNCTION__, 'Correct function in query log.');
@@ -50,8 +50,8 @@ public function testEnableMultiLogging() {
     $queries1 = Database::getLog('testing1');
     $queries2 = Database::getLog('testing2');
 
-    $this->assertEqual(count($queries1), 2, 'Correct number of queries recorded for log 1.');
-    $this->assertEqual(count($queries2), 1, 'Correct number of queries recorded for log 2.');
+    $this->assertCount(2, $queries1, 'Correct number of queries recorded for log 1.');
+    $this->assertCount(1, $queries2, 'Correct number of queries recorded for log 2.');
   }
 
   /**
@@ -71,7 +71,7 @@ public function testEnableTargetLogging() {
 
     $queries1 = Database::getLog('testing1');
 
-    $this->assertEqual(count($queries1), 2, 'Recorded queries from all targets.');
+    $this->assertCount(2, $queries1, 'Recorded queries from all targets.');
     $this->assertEqual($queries1[0]['target'], 'default', 'First query used default target.');
     $this->assertEqual($queries1[1]['target'], 'replica', 'Second query used replica target.');
   }
@@ -97,7 +97,7 @@ public function testEnableTargetLoggingNoTarget() {
 
     $queries1 = Database::getLog('testing1');
 
-    $this->assertEqual(count($queries1), 2, 'Recorded queries from all targets.');
+    $this->assertCount(2, $queries1, 'Recorded queries from all targets.');
     $this->assertEqual($queries1[0]['target'], 'default', 'First query used default target.');
     $this->assertEqual($queries1[1]['target'], 'default', 'Second query used default target as fallback.');
   }
@@ -125,8 +125,8 @@ public function testEnableMultiConnectionLogging() {
     $queries1 = Database::getLog('testing1');
     $queries2 = Database::getLog('testing1', 'test2');
 
-    $this->assertEqual(count($queries1), 1, 'Correct number of queries recorded for first connection.');
-    $this->assertEqual(count($queries2), 1, 'Correct number of queries recorded for second connection.');
+    $this->assertCount(1, $queries1, 'Correct number of queries recorded for first connection.');
+    $this->assertCount(1, $queries2, 'Correct number of queries recorded for second connection.');
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/Database/QueryTest.php b/core/tests/Drupal/KernelTests/Core/Database/QueryTest.php
index a8560b56c01aff0ffcfc416f6e575175d0b78565..bff32113f250f5d0ebe535a0e5c8cebb799658ea 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/QueryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/QueryTest.php
@@ -14,10 +14,10 @@ class QueryTest extends DatabaseTestBase {
    */
   public function testArraySubstitution() {
     $names = $this->connection->query('SELECT name FROM {test} WHERE age IN ( :ages[] ) ORDER BY age', [':ages[]' => [25, 26, 27]])->fetchAll();
-    $this->assertEqual(count($names), 3, 'Correct number of names returned');
+    $this->assertCount(3, $names, 'Correct number of names returned');
 
     $names = $this->connection->query('SELECT name FROM {test} WHERE age IN ( :ages[] ) ORDER BY age', [':ages[]' => [25]])->fetchAll();
-    $this->assertEqual(count($names), 1, 'Correct number of names returned');
+    $this->assertCount(1, $names, 'Correct number of names returned');
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/Database/RangeQueryTest.php b/core/tests/Drupal/KernelTests/Core/Database/RangeQueryTest.php
index 24f0f7f95dc93ad326e91510e77e35c97501404a..cc78ad12fbdf11070d3d61dd624ff5a71f3b0973 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/RangeQueryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/RangeQueryTest.php
@@ -15,7 +15,7 @@ class RangeQueryTest extends DatabaseTestBase {
   public function testRangeQuery() {
     // Test if return correct number of rows.
     $range_rows = $this->connection->queryRange("SELECT name FROM {test} ORDER BY name", 1, 3)->fetchAll();
-    $this->assertEqual(count($range_rows), 3, 'Range query work and return correct number of rows.');
+    $this->assertCount(3, $range_rows, 'Range query work and return correct number of rows.');
 
     // Test if return target data.
     $raw_rows = $this->connection->query('SELECT name FROM {test} ORDER BY name')->fetchAll();
diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php
index ef939abfef34eda43c4720bcdb5a027379c5e9ec..f5f795476774446c2171085cb026f260eb5623ab 100644
--- a/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php
@@ -38,7 +38,7 @@ public function testSimpleComment() {
     $query = (string) $query;
     $expected = "/* Testing query comments */";
 
-    $this->assertEqual(count($records), 4, 'Returned the correct number of rows.');
+    $this->assertCount(4, $records, 'Returned the correct number of rows.');
     $this->assertStringContainsString($expected, $query, 'The flattened query contains the comment string.');
   }
 
@@ -218,7 +218,7 @@ public function testNullCondition() {
       ->condition('age', NULL)
       ->execute()->fetchCol();
 
-    $this->assertEqual(count($names), 0, 'No records found when comparing to NULL.');
+    $this->assertCount(0, $names, 'No records found when comparing to NULL.');
   }
 
   /**
@@ -232,7 +232,7 @@ public function testIsNullCondition() {
       ->isNull('age')
       ->execute()->fetchCol();
 
-    $this->assertEqual(count($names), 1, 'Correct number of records found with NULL age.');
+    $this->assertCount(1, $names, 'Correct number of records found with NULL age.');
     $this->assertEqual($names[0], 'Fozzie', 'Correct record returned for NULL age.');
   }
 
@@ -248,7 +248,7 @@ public function testIsNotNullCondition() {
       ->orderBy('name')
       ->execute()->fetchCol();
 
-    $this->assertEqual(count($names), 2, 'Correct number of records found withNOT NULL age.');
+    $this->assertCount(2, $names, 'Correct number of records found withNOT NULL age.');
     $this->assertEqual($names[0], 'Gonzo', 'Correct record returned for NOT NULL age.');
     $this->assertEqual($names[1], 'Kermit', 'Correct record returned for NOT NULL age.');
   }
@@ -317,7 +317,7 @@ public function testUnion() {
     $names = $query_1->execute()->fetchCol();
 
     // Ensure we only get 2 records.
-    $this->assertEqual(count($names), 2, 'UNION correctly discarded duplicates.');
+    $this->assertCount(2, $names, 'UNION correctly discarded duplicates.');
 
     $this->assertEqualsCanonicalizing(['George', 'Ringo'], $names);
   }
@@ -339,7 +339,7 @@ public function testUnionAll() {
     $names = $query_1->execute()->fetchCol();
 
     // Ensure we get all 3 records.
-    $this->assertEqual(count($names), 3, 'UNION ALL correctly preserved duplicates.');
+    $this->assertCount(3, $names, 'UNION ALL correctly preserved duplicates.');
 
     $this->assertEqual($names[0], 'George', 'First query returned correct first name.');
     $this->assertEqual($names[1], 'Ringo', 'Second query returned correct second name.');
@@ -388,7 +388,7 @@ public function testUnionOrder() {
     $names = $query_1->execute()->fetchCol();
 
     // Ensure we get all 3 records.
-    $this->assertEqual(count($names), 3, 'UNION returned rows from both queries.');
+    $this->assertCount(3, $names, 'UNION returned rows from both queries.');
 
     // Ensure that the names are in the correct reverse alphabetical order,
     // regardless of which query they came from.
@@ -418,7 +418,7 @@ public function testUnionOrderLimit() {
     $names = $query_1->execute()->fetchCol();
 
     // Ensure we get all only 2 of the 3 records.
-    $this->assertEqual(count($names), 2, 'UNION with a limit returned rows from both queries.');
+    $this->assertCount(2, $names, 'UNION with a limit returned rows from both queries.');
 
     // Ensure that the names are in the correct reverse alphabetical order,
     // regardless of which query they came from.
diff --git a/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php
index 6fe01aa5a8c275826404692ba6ac8656ae37d976..840445ed7a8f8a84b0555915f2637cf33608b7c3 100644
--- a/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Element/PathElementFormTest.php
@@ -153,7 +153,7 @@ public function testPathElement() {
     $form_builder->submitForm($this, $form_state);
 
     // Valid form state.
-    $this->assertEqual(count($form_state->getErrors()), 0);
+    $this->assertCount(0, $form_state->getErrors());
     $this->assertEqual($form_state->getValue('required_validate_route'), [
       'route_name' => 'entity.user.canonical',
       'route_parameters' => [
@@ -178,7 +178,7 @@ public function testPathElement() {
     $form_builder->submitForm($this, $form_state);
     $errors = $form_state->getErrors();
     // Should be missing 'required_validate' field.
-    $this->assertEqual(count($errors), 1);
+    $this->assertCount(1, $errors);
     $this->assertEqual($errors, ['required_validate' => t('@name field is required.', ['@name' => 'required_validate'])]);
 
     // Test invalid parameters.
@@ -194,7 +194,7 @@ public function testPathElement() {
 
     // Valid form state.
     $errors = $form_state->getErrors();
-    $this->assertEqual(count($errors), 3);
+    $this->assertCount(3, $errors);
     $this->assertEqual($errors, [
       'required_validate' => t('This path does not exist or you do not have permission to link to %path.', ['%path' => 'user/74']),
       'required_validate_route' => t('This path does not exist or you do not have permission to link to %path.', ['%path' => 'user/74']),
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php b/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php
index 166e3f13f860b181b476b63fee1e6c5e346acf24..ef578fbee59fb6c39f44a03a3c304529e36daafd 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/Element/EntityAutocompleteElementFormTest.php
@@ -211,7 +211,7 @@ public function testValidEntityAutocompleteElement() {
     $form_builder->submitForm($this, $form_state);
 
     // Valid form state.
-    $this->assertEqual(count($form_state->getErrors()), 0);
+    $this->assertCount(0, $form_state->getErrors());
 
     // Test the 'single' element.
     $this->assertEqual($form_state->getValue('single'), $this->referencedEntities[0]->id());
@@ -280,7 +280,7 @@ public function testInvalidEntityAutocompleteElement() {
         'single' => 'single - non-existent label',
       ]);
     $form_builder->submitForm($this, $form_state);
-    $this->assertEqual(count($form_state->getErrors()), 1);
+    $this->assertCount(1, $form_state->getErrors());
     $this->assertEqual($form_state->getErrors()['single'], t('There are no entities matching "%value".', ['%value' => 'single - non-existent label']));
 
     // Test 'single' with a entity ID that doesn't exist.
@@ -289,7 +289,7 @@ public function testInvalidEntityAutocompleteElement() {
         'single' => 'single - non-existent label (42)',
       ]);
     $form_builder->submitForm($this, $form_state);
-    $this->assertEqual(count($form_state->getErrors()), 1);
+    $this->assertCount(1, $form_state->getErrors());
     $this->assertEqual($form_state->getErrors()['single'], t('The referenced entity (%type: %id) does not exist.', ['%type' => 'entity_test', '%id' => 42]));
 
     // Do the same tests as above but on an element with '#validate_reference'
@@ -303,7 +303,7 @@ public function testInvalidEntityAutocompleteElement() {
 
     // The element without 'autocreate' support still has to emit a warning when
     // the input doesn't end with an entity ID enclosed in parentheses.
-    $this->assertEqual(count($form_state->getErrors()), 1);
+    $this->assertCount(1, $form_state->getErrors());
     $this->assertEqual($form_state->getErrors()['single_no_validate'], t('There are no entities matching "%value".', ['%value' => 'single - non-existent label']));
 
     $form_state = (new FormState())
@@ -315,7 +315,7 @@ public function testInvalidEntityAutocompleteElement() {
 
     // The input is complete (i.e. contains an entity ID at the end), no errors
     // are triggered.
-    $this->assertEqual(count($form_state->getErrors()), 0);
+    $this->assertCount(0, $form_state->getErrors());
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
index ebec18d7086858ccee9c8670cb3e4f933eb6181b..991862bbaf73a9875e2113a81b1d8f52cd27ee07 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityFieldTest.php
@@ -228,7 +228,7 @@ protected function doTestReadWrite($entity_type) {
       }
       $this->assertTrue(isset($entity->name), new FormattableMarkup('%entity_type: Name field is set.', ['%entity_type' => $entity_type]));
       $this->assertTrue($entity->name->isEmpty(), new FormattableMarkup('%entity_type: Name field is set.', ['%entity_type' => $entity_type]));
-      $this->assertIdentical(count($entity->name), 0, new FormattableMarkup('%entity_type: Name field contains no items.', ['%entity_type' => $entity_type]));
+      $this->assertCount(0, $entity->name, new FormattableMarkup('%entity_type: Name field contains no items.', ['%entity_type' => $entity_type]));
       $this->assertIdentical($entity->name->getValue(), [], new FormattableMarkup('%entity_type: Name field value is an empty array.', ['%entity_type' => $entity_type]));
       $this->assertFalse(isset($entity->name[0]), new FormattableMarkup('%entity_type: Name field item is not set.', ['%entity_type' => $entity_type]));
       $this->assertFalse(isset($entity->name[0]->value), new FormattableMarkup('%entity_type: First name item value is not set.', ['%entity_type' => $entity_type]));
@@ -303,13 +303,13 @@ protected function doTestReadWrite($entity_type) {
     unset($entity->name[3]);
 
     // Test removing and empty-ing list items.
-    $this->assertEqual(count($entity->name), 3, new FormattableMarkup('%entity_type: List has 3 items.', ['%entity_type' => $entity_type]));
+    $this->assertCount(3, $entity->name, new FormattableMarkup('%entity_type: List has 3 items.', ['%entity_type' => $entity_type]));
     unset($entity->name[1]);
-    $this->assertEqual(count($entity->name), 2, new FormattableMarkup('%entity_type: Second list item has been removed.', ['%entity_type' => $entity_type]));
+    $this->assertCount(2, $entity->name, new FormattableMarkup('%entity_type: Second list item has been removed.', ['%entity_type' => $entity_type]));
     $this->assertEqual($entity->name[1]->value, 'Third name', new FormattableMarkup('%entity_type: The subsequent items have been shifted up.', ['%entity_type' => $entity_type]));
     $this->assertEqual($entity->name[1]->getName(), 1, new FormattableMarkup('%entity_type: The items names have been updated to their new delta.', ['%entity_type' => $entity_type]));
     $entity->name[1] = NULL;
-    $this->assertEqual(count($entity->name), 2, new FormattableMarkup('%entity_type: Assigning NULL does not reduce array count.', ['%entity_type' => $entity_type]));
+    $this->assertCount(2, $entity->name, new FormattableMarkup('%entity_type: Assigning NULL does not reduce array count.', ['%entity_type' => $entity_type]));
     $this->assertTrue($entity->name[1]->isEmpty(), new FormattableMarkup('%entity_type: Assigning NULL empties the item.', ['%entity_type' => $entity_type]));
 
     // Test using isEmpty().
@@ -318,15 +318,15 @@ protected function doTestReadWrite($entity_type) {
     $entity->name->value = NULL;
     $this->assertTrue($entity->name[0]->isEmpty(), new FormattableMarkup('%entity_type: Name item is empty.', ['%entity_type' => $entity_type]));
     $this->assertTrue($entity->name->isEmpty(), new FormattableMarkup('%entity_type: Name field is empty.', ['%entity_type' => $entity_type]));
-    $this->assertEqual(count($entity->name), 1, new FormattableMarkup('%entity_type: Empty item is considered when counting.', ['%entity_type' => $entity_type]));
+    $this->assertCount(1, $entity->name, new FormattableMarkup('%entity_type: Empty item is considered when counting.', ['%entity_type' => $entity_type]));
     $this->assertEqual(count(iterator_to_array($entity->name->getIterator())), count($entity->name), new FormattableMarkup('%entity_type: Count matches iterator count.', ['%entity_type' => $entity_type]));
     $this->assertTrue($entity->name->getValue() === [0 => ['value' => NULL]], new FormattableMarkup('%entity_type: Name field value contains a NULL value.', ['%entity_type' => $entity_type]));
 
     // Test using filterEmptyItems().
     $entity->name = [NULL, 'foo'];
-    $this->assertEqual(count($entity->name), 2, new FormattableMarkup('%entity_type: List has 2 items.', ['%entity_type' => $entity_type]));
+    $this->assertCount(2, $entity->name, new FormattableMarkup('%entity_type: List has 2 items.', ['%entity_type' => $entity_type]));
     $entity->name->filterEmptyItems();
-    $this->assertEqual(count($entity->name), 1, new FormattableMarkup('%entity_type: The empty item was removed.', ['%entity_type' => $entity_type]));
+    $this->assertCount(1, $entity->name, new FormattableMarkup('%entity_type: The empty item was removed.', ['%entity_type' => $entity_type]));
     $this->assertEqual($entity->name[0]->value, 'foo', new FormattableMarkup('%entity_type: The items were renumbered.', ['%entity_type' => $entity_type]));
     $this->assertEqual($entity->name[0]->getName(), 0, new FormattableMarkup('%entity_type: The deltas were updated in the items.', ['%entity_type' => $entity_type]));
 
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php
index c63a718035f656760bac9989821aac63236249b3..985d1b8aff20b96c231b8f7d340d8f5d9410ebf5 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryRelationshipTest.php
@@ -132,7 +132,7 @@ public function testQuery() {
     $this->queryResults = $storage->getQuery()
       ->notExists("user_id.entity.name")
       ->execute();
-    $this->assertEqual(count($this->queryResults), 0);
+    $this->assertCount(0, $this->queryResults);
     // This returns the 0th entity as that's only one pointing to the 0th
     // term (test without specifying the field column).
     $this->queryResults = $storage->getQuery()
@@ -171,7 +171,7 @@ public function testQuery() {
     $this->queryResults = $storage->getQuery()
       ->notExists("user_id.entity:user.name")
       ->execute();
-    $this->assertEqual(count($this->queryResults), 0);
+    $this->assertCount(0, $this->queryResults);
     // This returns the 0th entity as that's only one pointing to the 0th
     // term (test without specifying the field column).
     $this->queryResults = $storage->getQuery()
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
index 70d3e9d727481948932ca5af84cd44eda71f821b..18d62125e91734e5e21891b4122ea2b1a41a7a8e 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php
@@ -803,127 +803,127 @@ public function testCaseSensitivity() {
       ->getQuery()
       ->condition('field_ci', $fixtures[0]['lowercase'] . $fixtures[1]['lowercase'])
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case insensitive, lowercase');
+    $this->assertCount(1, $result, 'Case insensitive, lowercase');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_ci', $fixtures[0]['uppercase'] . $fixtures[1]['uppercase'])
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case insensitive, uppercase');
+    $this->assertCount(1, $result, 'Case insensitive, uppercase');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_ci', $fixtures[0]['uppercase'] . $fixtures[1]['lowercase'])
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case insensitive, mixed.');
+    $this->assertCount(1, $result, 'Case insensitive, mixed.');
 
     // Check the case sensitive field, = operator.
     $result = $this->storage
       ->getQuery()
       ->condition('field_cs', $fixtures[0]['lowercase'] . $fixtures[1]['lowercase'])
       ->execute();
-    $this->assertIdentical(count($result), 0, 'Case sensitive, lowercase.');
+    $this->assertCount(0, $result, 'Case sensitive, lowercase.');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_cs', $fixtures[0]['uppercase'] . $fixtures[1]['uppercase'])
       ->execute();
-    $this->assertIdentical(count($result), 0, 'Case sensitive, uppercase.');
+    $this->assertCount(0, $result, 'Case sensitive, uppercase.');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_cs', $fixtures[0]['uppercase'] . $fixtures[1]['lowercase'])
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case sensitive, exact match.');
+    $this->assertCount(1, $result, 'Case sensitive, exact match.');
 
     // Check the case insensitive field, IN operator.
     $result = $this->storage
       ->getQuery()
       ->condition('field_ci', [$fixtures[0]['lowercase'] . $fixtures[1]['lowercase']], 'IN')
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case insensitive, lowercase');
+    $this->assertCount(1, $result, 'Case insensitive, lowercase');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_ci', [$fixtures[0]['uppercase'] . $fixtures[1]['uppercase']], 'IN')->execute();
-    $this->assertIdentical(count($result), 1, 'Case insensitive, uppercase');
+    $this->assertCount(1, $result, 'Case insensitive, uppercase');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_ci', [$fixtures[0]['uppercase'] . $fixtures[1]['lowercase']], 'IN')
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case insensitive, mixed');
+    $this->assertCount(1, $result, 'Case insensitive, mixed');
 
     // Check the case sensitive field, IN operator.
     $result = $this->storage
       ->getQuery()
       ->condition('field_cs', [$fixtures[0]['lowercase'] . $fixtures[1]['lowercase']], 'IN')
       ->execute();
-    $this->assertIdentical(count($result), 0, 'Case sensitive, lowercase');
+    $this->assertCount(0, $result, 'Case sensitive, lowercase');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_cs', [$fixtures[0]['uppercase'] . $fixtures[1]['uppercase']], 'IN')
       ->execute();
-    $this->assertIdentical(count($result), 0, 'Case sensitive, uppercase');
+    $this->assertCount(0, $result, 'Case sensitive, uppercase');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_cs', [$fixtures[0]['uppercase'] . $fixtures[1]['lowercase']], 'IN')
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case sensitive, mixed');
+    $this->assertCount(1, $result, 'Case sensitive, mixed');
 
     // Check the case insensitive field, STARTS_WITH operator.
     $result = $this->storage
       ->getQuery()
       ->condition('field_ci', $fixtures[0]['lowercase'], 'STARTS_WITH')
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case sensitive, lowercase.');
+    $this->assertCount(1, $result, 'Case sensitive, lowercase.');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_ci', $fixtures[0]['uppercase'], 'STARTS_WITH')
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case sensitive, exact match.');
+    $this->assertCount(1, $result, 'Case sensitive, exact match.');
 
     // Check the case sensitive field, STARTS_WITH operator.
     $result = $this->storage
       ->getQuery()
       ->condition('field_cs', $fixtures[0]['lowercase'], 'STARTS_WITH')
       ->execute();
-    $this->assertIdentical(count($result), 0, 'Case sensitive, lowercase.');
+    $this->assertCount(0, $result, 'Case sensitive, lowercase.');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_cs', $fixtures[0]['uppercase'], 'STARTS_WITH')
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case sensitive, exact match.');
+    $this->assertCount(1, $result, 'Case sensitive, exact match.');
 
     // Check the case insensitive field, ENDS_WITH operator.
     $result = $this->storage
       ->getQuery()
       ->condition('field_ci', $fixtures[1]['lowercase'], 'ENDS_WITH')
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case sensitive, lowercase.');
+    $this->assertCount(1, $result, 'Case sensitive, lowercase.');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_ci', $fixtures[1]['uppercase'], 'ENDS_WITH')
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case sensitive, exact match.');
+    $this->assertCount(1, $result, 'Case sensitive, exact match.');
 
     // Check the case sensitive field, ENDS_WITH operator.
     $result = $this->storage
       ->getQuery()
       ->condition('field_cs', $fixtures[1]['lowercase'], 'ENDS_WITH')
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case sensitive, lowercase.');
+    $this->assertCount(1, $result, 'Case sensitive, lowercase.');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_cs', $fixtures[1]['uppercase'], 'ENDS_WITH')
       ->execute();
-    $this->assertIdentical(count($result), 0, 'Case sensitive, exact match.');
+    $this->assertCount(0, $result, 'Case sensitive, exact match.');
 
     // Check the case insensitive field, CONTAINS operator, use the inner 8
     // characters of the uppercase and lowercase strings.
@@ -931,26 +931,26 @@ public function testCaseSensitivity() {
       ->getQuery()
       ->condition('field_ci', mb_substr($fixtures[0]['uppercase'] . $fixtures[1]['lowercase'], 4, 8), 'CONTAINS')
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case sensitive, lowercase.');
+    $this->assertCount(1, $result, 'Case sensitive, lowercase.');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_ci', mb_strtolower(mb_substr($fixtures[0]['uppercase'] . $fixtures[1]['lowercase'], 4, 8)), 'CONTAINS')
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case sensitive, exact match.');
+    $this->assertCount(1, $result, 'Case sensitive, exact match.');
 
     // Check the case sensitive field, CONTAINS operator.
     $result = $this->storage
       ->getQuery()
       ->condition('field_cs', mb_substr($fixtures[0]['uppercase'] . $fixtures[1]['lowercase'], 4, 8), 'CONTAINS')
       ->execute();
-    $this->assertIdentical(count($result), 1, 'Case sensitive, lowercase.');
+    $this->assertCount(1, $result, 'Case sensitive, lowercase.');
 
     $result = $this->storage
       ->getQuery()
       ->condition('field_cs', mb_strtolower(mb_substr($fixtures[0]['uppercase'] . $fixtures[1]['lowercase'], 4, 8)), 'CONTAINS')
       ->execute();
-    $this->assertIdentical(count($result), 0, 'Case sensitive, exact match.');
+    $this->assertCount(0, $result, 'Case sensitive, exact match.');
 
   }
 
@@ -989,7 +989,7 @@ public function testBaseFieldMultipleColumns() {
       ->condition('description.format', 'format1')
       ->execute();
 
-    $this->assertEqual(count($ids), 1);
+    $this->assertCount(1, $ids);
     $this->assertEqual($term1->id(), reset($ids));
   }
 
@@ -1002,7 +1002,7 @@ public function testPendingRevisions() {
       ->getQuery()
       ->condition('id', [14], 'IN')
       ->execute();
-    $this->assertEqual(count($result), 1);
+    $this->assertCount(1, $result);
 
     // Set a revision on entity 14 that isn't the current default.
     $entity = EntityTestMulRev::load(14);
@@ -1021,7 +1021,7 @@ public function testPendingRevisions() {
       ->getQuery()
       ->condition('id', [14], 'IN')
       ->execute();
-    $this->assertEqual(count($result), 1);
+    $this->assertCount(1, $result);
 
     // Verify that field conditions on the default and pending revision are
     // work as expected.
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php b/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php
index 24c256ee1c66e57b6d80b755b231ed2b83e5a02d..a7426b84d081abed64081e546110e5d6caf871c4 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/EntityTranslationTest.php
@@ -255,24 +255,24 @@ protected function doTestMultilingualProperties($entity_type) {
       ->save();
 
     $entities = $storage->loadMultiple();
-    $this->assertEqual(count($entities), 3, new FormattableMarkup('%entity_type: Three entities were created.', ['%entity_type' => $entity_type]));
+    $this->assertCount(3, $entities, new FormattableMarkup('%entity_type: Three entities were created.', ['%entity_type' => $entity_type]));
     $entities = $storage->loadMultiple([$translated_id]);
-    $this->assertEqual(count($entities), 1, new FormattableMarkup('%entity_type: One entity correctly loaded by id.', ['%entity_type' => $entity_type]));
+    $this->assertCount(1, $entities, new FormattableMarkup('%entity_type: One entity correctly loaded by id.', ['%entity_type' => $entity_type]));
     $entities = $storage->loadByProperties(['name' => $name]);
-    $this->assertEqual(count($entities), 2, new FormattableMarkup('%entity_type: Two entities correctly loaded by name.', ['%entity_type' => $entity_type]));
+    $this->assertCount(2, $entities, new FormattableMarkup('%entity_type: Two entities correctly loaded by name.', ['%entity_type' => $entity_type]));
     // @todo The default language condition should go away in favor of an
     // explicit parameter.
     $entities = $storage->loadByProperties(['name' => $properties[$langcode]['name'][0], $default_langcode_key => 0]);
-    $this->assertEqual(count($entities), 1, new FormattableMarkup('%entity_type: One entity correctly loaded by name translation.', ['%entity_type' => $entity_type]));
+    $this->assertCount(1, $entities, new FormattableMarkup('%entity_type: One entity correctly loaded by name translation.', ['%entity_type' => $entity_type]));
     $entities = $storage->loadByProperties([$langcode_key => $default_langcode, 'name' => $name]);
-    $this->assertEqual(count($entities), 1, new FormattableMarkup('%entity_type: One entity correctly loaded by name and language.', ['%entity_type' => $entity_type]));
+    $this->assertCount(1, $entities, new FormattableMarkup('%entity_type: One entity correctly loaded by name and language.', ['%entity_type' => $entity_type]));
 
     $entities = $storage->loadByProperties([$langcode_key => $langcode, 'name' => $properties[$langcode]['name'][0]]);
-    $this->assertEqual(count($entities), 0, new FormattableMarkup('%entity_type: No entity loaded by name translation specifying the translation language.', ['%entity_type' => $entity_type]));
+    $this->assertCount(0, $entities, new FormattableMarkup('%entity_type: No entity loaded by name translation specifying the translation language.', ['%entity_type' => $entity_type]));
     $entities = $storage->loadByProperties([$langcode_key => $langcode, 'name' => $properties[$langcode]['name'][0], $default_langcode_key => 0]);
-    $this->assertEqual(count($entities), 1, new FormattableMarkup('%entity_type: One entity loaded by name translation and language specifying to look for translations.', ['%entity_type' => $entity_type]));
+    $this->assertCount(1, $entities, new FormattableMarkup('%entity_type: One entity loaded by name translation and language specifying to look for translations.', ['%entity_type' => $entity_type]));
     $entities = $storage->loadByProperties(['user_id' => $properties[$langcode]['user_id'][0], $default_langcode_key => NULL]);
-    $this->assertEqual(count($entities), 2, new FormattableMarkup('%entity_type: Two entities loaded by uid without caring about property translatability.', ['%entity_type' => $entity_type]));
+    $this->assertCount(2, $entities, new FormattableMarkup('%entity_type: Two entities loaded by uid without caring about property translatability.', ['%entity_type' => $entity_type]));
 
     // Test property conditions and orders with multiple languages in the same
     // query.
@@ -284,7 +284,7 @@ protected function doTestMultilingualProperties($entity_type) {
       ->condition($group)
       ->condition('name', $properties[$langcode]['name'][0], '=', $langcode)
       ->execute();
-    $this->assertEqual(count($result), 1, new FormattableMarkup('%entity_type: One entity loaded by name and uid using different language meta conditions.', ['%entity_type' => $entity_type]));
+    $this->assertCount(1, $result, new FormattableMarkup('%entity_type: One entity loaded by name and uid using different language meta conditions.', ['%entity_type' => $entity_type]));
 
     // Test mixed property and field conditions.
     $storage->resetCache($result);
@@ -304,7 +304,7 @@ protected function doTestMultilingualProperties($entity_type) {
       ->condition($default_langcode_group)
       ->condition($langcode_group)
       ->execute();
-    $this->assertEqual(count($result), 1, new FormattableMarkup('%entity_type: One entity loaded by name, uid and field value using different language meta conditions.', ['%entity_type' => $entity_type]));
+    $this->assertCount(1, $result, new FormattableMarkup('%entity_type: One entity loaded by name, uid and field value using different language meta conditions.', ['%entity_type' => $entity_type]));
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
index 822198606b1d9e24d9d2724e7741e63109af9943..2461d6b45cfc0de91755da56bb2e43fb5c2aae07 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/FieldSqlStorageTest.php
@@ -266,7 +266,7 @@ public function testFieldWrite() {
     $entity->{$this->fieldName} = NULL;
     $entity->save();
     $rows = $connection->select($this->table, 't')->fields('t')->execute()->fetchAllAssoc('delta', \PDO::FETCH_ASSOC);
-    $this->assertEqual(count($rows), 0);
+    $this->assertCount(0, $rows);
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php b/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php
index 8a8143149c67298bfe0f4f3494683d08ba537c4b..c83a6bde4caf5f18bde50c9042e7bbe24f68cc03 100644
--- a/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Entity/RevisionableContentEntityBaseTest.php
@@ -80,7 +80,7 @@ public function testRevisionableContentEntity() {
     }
     $this->assertItemsTableCount(6, $definition);
 
-    $this->assertEqual(6, count($revision_ids));
+    $this->assertCount(6, $revision_ids);
 
     // Delete the first 3 revisions.
     foreach (range(0, 2) as $key) {
diff --git a/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php b/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php
index d1eb0c7cfc9633736e05fd529c67ca12c9ea30d9..d3bb116c9a9f42a46a800a70ac3464a12fc3d644 100644
--- a/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php
+++ b/core/tests/Drupal/KernelTests/Core/File/ScanDirectoryTest.php
@@ -52,7 +52,7 @@ public function testReturn() {
     // passed to the callback.
     $all_files = $this->fileSystem->scanDirectory($this->path, '/^javascript-/');
     ksort($all_files);
-    $this->assertEqual(2, count($all_files), 'Found two, expected javascript files.');
+    $this->assertCount(2, $all_files, 'Found two, expected javascript files.');
 
     // Check the first file.
     $file = reset($all_files);
@@ -78,18 +78,18 @@ public function testOptionCallback() {
 
     // When nothing is matched nothing should be passed to the callback.
     $all_files = $this->fileSystem->scanDirectory($this->path, '/^NONEXISTINGFILENAME/', ['callback' => 'file_test_file_scan_callback']);
-    $this->assertEqual(0, count($all_files), 'No files were found.');
+    $this->assertCount(0, $all_files, 'No files were found.');
     $results = file_test_file_scan_callback();
     file_test_file_scan_callback_reset();
-    $this->assertEqual(0, count($results), 'No files were passed to the callback.');
+    $this->assertCount(0, $results, 'No files were passed to the callback.');
 
     // Grab a listing of all the JavaScript files and check that they're
     // passed to the callback.
     $all_files = $this->fileSystem->scanDirectory($this->path, '/^javascript-/', ['callback' => 'file_test_file_scan_callback']);
-    $this->assertEqual(2, count($all_files), 'Found two, expected javascript files.');
+    $this->assertCount(2, $all_files, 'Found two, expected javascript files.');
     $results = file_test_file_scan_callback();
     file_test_file_scan_callback_reset();
-    $this->assertEqual(2, count($results), 'Files were passed to the callback.');
+    $this->assertCount(2, $results, 'Files were passed to the callback.');
   }
 
   /**
@@ -100,11 +100,11 @@ public function testOptionCallback() {
   public function testOptionNoMask() {
     // Grab a listing of all the JavaScript files.
     $all_files = $this->fileSystem->scanDirectory($this->path, '/^javascript-/');
-    $this->assertEqual(2, count($all_files), 'Found two, expected javascript files.');
+    $this->assertCount(2, $all_files, 'Found two, expected javascript files.');
 
     // Now use the nomask parameter to filter out the .script file.
     $filtered_files = $this->fileSystem->scanDirectory($this->path, '/^javascript-/', ['nomask' => '/.script$/']);
-    $this->assertEqual(1, count($filtered_files), 'Filtered correctly.');
+    $this->assertCount(1, $filtered_files, 'Filtered correctly.');
   }
 
   /**
@@ -148,7 +148,7 @@ public function testOptionRecurse() {
     $this->assertTrue(empty($files), "Without recursion couldn't find javascript files.");
 
     $files = $this->fileSystem->scanDirectory($this->path . '/..', '/^javascript-/', ['recurse' => TRUE]);
-    $this->assertEqual(2, count($files), 'With recursion we found the expected javascript files.');
+    $this->assertCount(2, $files, 'With recursion we found the expected javascript files.');
   }
 
   /**
@@ -159,7 +159,7 @@ public function testOptionRecurse() {
    */
   public function testOptionMinDepth() {
     $files = $this->fileSystem->scanDirectory($this->path, '/^javascript-/', ['min_depth' => 0]);
-    $this->assertEqual(2, count($files), 'No minimum-depth gets files in current directory.');
+    $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.');
diff --git a/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php b/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php
index e38aa5705d4e3f5fa87ba624e54cb81eea530d8f..7f09c2f3af9e940454178de465a535225676ad80 100644
--- a/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Form/FormDefaultHandlersTest.php
@@ -92,11 +92,11 @@ public function testDefaultAndCustomHandlers() {
 
     $handlers = $form_state->get('test_handlers');
 
-    $this->assertIdentical(count($handlers['validate']), 2);
+    $this->assertCount(2, $handlers['validate']);
     $this->assertIdentical($handlers['validate'][0], 'customValidateForm');
     $this->assertIdentical($handlers['validate'][1], 'validateForm');
 
-    $this->assertIdentical(count($handlers['submit']), 2);
+    $this->assertCount(2, $handlers['submit']);
     $this->assertIdentical($handlers['submit'][0], 'customSubmitForm');
     $this->assertIdentical($handlers['submit'][1], 'submitForm');
   }
diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php
index 42d43058a59e2a0eb60805cc24a9e7aad7fb3c72..e9cc0963556f9af616382d3f348c08ebbfc86411 100644
--- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php
+++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/DatabaseStorageExpirableTest.php
@@ -132,7 +132,7 @@ public function testExpiration() {
     $this->assertNull($stores[0]->get('yesterday'));
     $this->assertTrue($stores[0]->has('troubles'));
     $this->assertIdentical($stores[0]->get('troubles'), 'here to stay');
-    $this->assertIdentical(count($stores[0]->getMultiple(['yesterday', 'troubles'])), 1);
+    $this->assertCount(1, $stores[0]->getMultiple(['yesterday', 'troubles']));
 
     // Store items set to expire in the past in various ways.
     $stores[0]->setWithExpire($this->randomMachineName(), $this->objects[0], -7 * $day);
@@ -149,7 +149,7 @@ public function testExpiration() {
 
     // Ensure only non-expired items are retrieved.
     $all = $stores[0]->getAll();
-    $this->assertIdentical(count($all), 2);
+    $this->assertCount(2, $all);
     foreach (['troubles', 'still'] as $key) {
       $this->assertTrue(!empty($all[$key]));
     }
diff --git a/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php b/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php
index bbf927f6a2b46deb7eb52e8783c3c52c89dcd2e5..c702fb92967e650635f20976dd7316afa5ee7064 100644
--- a/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php
+++ b/core/tests/Drupal/KernelTests/Core/KeyValueStore/GarbageCollectionTest.php
@@ -40,7 +40,7 @@ public function testGarbageCollection() {
     for ($i = 0; $i <= 3; $i++) {
       $store->setWithExpire('key_' . $i, $this->randomObject(), rand(500, 100000));
     }
-    $this->assertIdentical(count($store->getAll()), 4, 'Four items were written to the storage.');
+    $this->assertCount(4, $store->getAll(), 'Four items were written to the storage.');
 
     // Manually expire the data.
     for ($i = 0; $i <= 3; $i++) {
@@ -65,7 +65,7 @@ public function testGarbageCollection() {
       [
         ':collection' => $collection,
       ])->fetchAll();
-    $this->assertIdentical(count($result), 1, 'Only one item remains after garbage collection');
+    $this->assertCount(1, $result, 'Only one item remains after garbage collection');
 
   }
 
diff --git a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkDefaultIntegrationTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkDefaultIntegrationTest.php
index 47fbe2bb933a8db7bcdbfa6ffe017b5960f51aa4..ae8e506d88d492ea0145cd646c94a18e8cdc1e5b 100644
--- a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkDefaultIntegrationTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkDefaultIntegrationTest.php
@@ -34,7 +34,7 @@ public function testMoveToRoot() {
     $this->assertEqual($menu_link['menu_name'], 'test');
 
     $tree = \Drupal::menuTree()->load('test', new MenuTreeParameters());
-    $this->assertEqual(count($tree), 1);
+    $this->assertCount(1, $tree);
     $this->assertEqual($tree['menu_test.parent']->link->getPluginId(), 'menu_test.parent');
     $this->assertEqual($tree['menu_test.parent']->subtree['menu_test.child']->link->getPluginId(), 'menu_test.child');
 
@@ -46,7 +46,7 @@ public function testMoveToRoot() {
     $this->assertEqual($menu_link['menu_name'], 'test');
 
     $tree = \Drupal::menuTree()->load('test', new MenuTreeParameters());
-    $this->assertEqual(count($tree), 2);
+    $this->assertCount(2, $tree);
     $this->assertEqual($tree['menu_test.parent']->link->getPluginId(), 'menu_test.parent');
     $this->assertEqual($tree['menu_test.child']->link->getPluginId(), 'menu_test.child');
 
diff --git a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php
index f792faa9fa3efa5042aa64a2eb075928da1d22f2..235352a2c3b8576ff7e2c113671d24ea5e8fee02 100644
--- a/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuLinkTreeTest.php
@@ -69,17 +69,17 @@ public function testDeleteLinksInMenu() {
     \Drupal::entityTypeManager()->getStorage('menu_link_content')->create(['link' => ['uri' => 'internal:/menu_name_test'], 'menu_name' => 'menu2', 'bundle' => 'menu_link_content', 'title' => 'Link test'])->save();
 
     $output = $this->linkTree->load('menu1', new MenuTreeParameters());
-    $this->assertEqual(count($output), 2);
+    $this->assertCount(2, $output);
     $output = $this->linkTree->load('menu2', new MenuTreeParameters());
-    $this->assertEqual(count($output), 1);
+    $this->assertCount(1, $output);
 
     $this->menuLinkManager->deleteLinksInMenu('menu1');
 
     $output = $this->linkTree->load('menu1', new MenuTreeParameters());
-    $this->assertEqual(count($output), 0);
+    $this->assertCount(0, $output);
 
     $output = $this->linkTree->load('menu2', new MenuTreeParameters());
-    $this->assertEqual(count($output), 1);
+    $this->assertCount(1, $output);
   }
 
   /**
@@ -125,7 +125,7 @@ public function testCreateLinksInMenu() {
     $parameters->setRoot('test.example2');
     $tree = $this->linkTree->load($instance->getMenuName(), $parameters);
     $top_link = reset($tree);
-    $this->assertEqual(count($top_link->subtree), 1);
+    $this->assertCount(1, $top_link->subtree);
     $child = reset($top_link->subtree);
     $this->assertEqual($child->link->getPluginId(), $links[3]->getPluginId());
     $height = $this->linkTree->getSubtreeHeight('test.example2');
diff --git a/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php b/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php
index 9b85daf392b4a269d944900b0122b7b33d3e2b1f..14e6171aa93c8d38792dab2f0c30f7963aaa6a6c 100644
--- a/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Menu/MenuTreeStorageTest.php
@@ -234,32 +234,32 @@ public function testLoadTree() {
 
     $data = $this->treeStorage->loadTreeData('tools', new MenuTreeParameters());
     $tree = $data['tree'];
-    $this->assertEqual(count($tree['test1']['subtree']), 1);
-    $this->assertEqual(count($tree['test1']['subtree']['test2']['subtree']), 1);
-    $this->assertEqual(count($tree['test1']['subtree']['test2']['subtree']['test3']['subtree']), 0);
-    $this->assertEqual(count($tree['test4']['subtree']), 1);
-    $this->assertEqual(count($tree['test4']['subtree']['test5']['subtree']), 0);
+    $this->assertCount(1, $tree['test1']['subtree']);
+    $this->assertCount(1, $tree['test1']['subtree']['test2']['subtree']);
+    $this->assertCount(0, $tree['test1']['subtree']['test2']['subtree']['test3']['subtree']);
+    $this->assertCount(1, $tree['test4']['subtree']);
+    $this->assertCount(0, $tree['test4']['subtree']['test5']['subtree']);
 
     $parameters = new MenuTreeParameters();
     $parameters->setActiveTrail(['test4', 'test5']);
     $data = $this->treeStorage->loadTreeData('tools', $parameters);
     $tree = $data['tree'];
-    $this->assertEqual(count($tree['test1']['subtree']), 1);
+    $this->assertCount(1, $tree['test1']['subtree']);
     $this->assertFalse($tree['test1']['in_active_trail']);
-    $this->assertEqual(count($tree['test1']['subtree']['test2']['subtree']), 1);
+    $this->assertCount(1, $tree['test1']['subtree']['test2']['subtree']);
     $this->assertFalse($tree['test1']['subtree']['test2']['in_active_trail']);
-    $this->assertEqual(count($tree['test1']['subtree']['test2']['subtree']['test3']['subtree']), 0);
+    $this->assertCount(0, $tree['test1']['subtree']['test2']['subtree']['test3']['subtree']);
     $this->assertFalse($tree['test1']['subtree']['test2']['subtree']['test3']['in_active_trail']);
-    $this->assertEqual(count($tree['test4']['subtree']), 1);
+    $this->assertCount(1, $tree['test4']['subtree']);
     $this->assertTrue($tree['test4']['in_active_trail']);
-    $this->assertEqual(count($tree['test4']['subtree']['test5']['subtree']), 0);
+    $this->assertCount(0, $tree['test4']['subtree']['test5']['subtree']);
     $this->assertTrue($tree['test4']['subtree']['test5']['in_active_trail']);
 
     // Add some conditions to ensure that conditions work as expected.
     $parameters = new MenuTreeParameters();
     $parameters->addCondition('parent', 'test1');
     $data = $this->treeStorage->loadTreeData('tools', $parameters);
-    $this->assertEqual(count($data['tree']), 1);
+    $this->assertCount(1, $data['tree']);
     $this->assertEqual($data['tree']['test2']['definition']['id'], 'test2');
     $this->assertEqual($data['tree']['test2']['subtree'], []);
 
@@ -277,9 +277,9 @@ public function testLoadTree() {
     $parameters = new MenuTreeParameters();
     $parameters->onlyEnabledLinks();
     $data = $this->treeStorage->loadTreeData('tools', $parameters);
-    $this->assertEqual(count($data['tree']), 1);
+    $this->assertCount(1, $data['tree']);
     $this->assertEqual($data['tree']['test1']['definition']['id'], 'test1');
-    $this->assertEqual(count($data['tree']['test1']['subtree']), 1);
+    $this->assertCount(1, $data['tree']['test1']['subtree']);
     $this->assertEqual($data['tree']['test1']['subtree']['test2']['definition']['id'], 'test2');
     $this->assertEqual($data['tree']['test1']['subtree']['test2']['subtree'], []);
 
@@ -415,7 +415,7 @@ protected function assertMenuLink($id, array $expected_properties, array $parent
       $query->condition($field, $value);
     }
     $all = $query->execute()->fetchAll(\PDO::FETCH_ASSOC);
-    $this->assertEqual(count($all), 1, "Found link $id matching all the expected properties");
+    $this->assertCount(1, $all, "Found link $id matching all the expected properties");
     $raw = reset($all);
 
     // Put the current link onto the front.
diff --git a/core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php b/core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php
index a7dc9fc4957c927e0fe9b9ed600acecfa8825e13..04cd66edcceec2ee263f700cadddd608cf373aaf 100644
--- a/core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Render/Element/TableTest.php
@@ -33,7 +33,7 @@ public function testThemeTableStickyHeaders() {
     $this->render($table);
     // Make sure tableheader.js was attached.
     $tableheader = $this->xpath("//script[contains(@src, 'tableheader.js')]");
-    $this->assertEqual(count($tableheader), 1);
+    $this->assertCount(1, $tableheader);
     $this->assertRaw('sticky-enabled');
   }
 
@@ -58,7 +58,7 @@ public function testThemeTableNoStickyHeaders() {
     $this->render($table);
     // Make sure tableheader.js was not attached.
     $tableheader = $this->xpath("//script[contains(@src, 'tableheader.js')]");
-    $this->assertEqual(count($tableheader), 0);
+    $this->assertCount(0, $tableheader);
     $this->assertNoRaw('sticky-enabled');
   }
 
diff --git a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php
index 410cc414736d85530a32bd6d85ea3fe6fc2a337b..0d4252944df98fe3f270d814218ce2846ab539f6 100644
--- a/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php
@@ -147,7 +147,7 @@ public function testCandidateOutlines() {
   public function testEmptyPathCandidatesOutlines() {
     $provider = new TestRouteProvider(Database::getConnection(), $this->state, $this->currentPath, $this->cache, $this->pathProcessor, $this->cacheTagsInvalidator, 'test_routes');
     $candidates = $provider->getCandidateOutlines([]);
-    $this->assertEqual(count($candidates), 0, 'Empty parts should return no candidates.');
+    $this->assertCount(0, $candidates, 'Empty parts should return no candidates.');
   }
 
   /**
@@ -198,7 +198,7 @@ public function testOutlinePathMatch() {
       $this->assertEqual($route->compile()->getPatternOutline(), '/path/%/one', 'Found path has correct pattern');
     }
 
-    $this->assertEqual(count($routes), 2, 'The correct number of routes was found.');
+    $this->assertCount(2, $routes, 'The correct number of routes was found.');
     $this->assertNotNull($routes->get('route_a'), 'The first matching route was found.');
     $this->assertNotNull($routes->get('route_b'), 'The second matching route was not found.');
   }
@@ -243,11 +243,11 @@ public function testMixedCasePaths($path, $expected_route_name, $method = 'GET')
     $routes = $provider->getRouteCollectionForRequest($request);
 
     if ($expected_route_name) {
-      $this->assertEquals(1, count($routes), 'The correct number of routes was found.');
+      $this->assertCount(1, $routes, 'The correct number of routes was found.');
       $this->assertNotNull($routes->get($expected_route_name), 'The first matching route was found.');
     }
     else {
-      $this->assertEquals(0, count($routes), 'No routes matched.');
+      $this->assertCount(0, $routes, 'No routes matched.');
     }
   }
 
@@ -315,7 +315,7 @@ public function testOutlinePathMatchTrailingSlash() {
       $this->assertEqual($route->compile()->getPatternOutline(), '/path/%/one', 'Found path has correct pattern');
     }
 
-    $this->assertEqual(count($routes), 2, 'The correct number of routes was found.');
+    $this->assertCount(2, $routes, 'The correct number of routes was found.');
     $this->assertNotNull($routes->get('route_a'), 'The first matching route was found.');
     $this->assertNotNull($routes->get('route_b'), 'The second matching route was not found.');
   }
@@ -350,7 +350,7 @@ public function testOutlinePathMatchDefaults() {
         $this->assertEqual($route->compile()->getPatternOutline(), '/some/path', 'Found path has correct pattern');
       }
 
-      $this->assertEqual(count($routes), 1, 'The correct number of routes was found.');
+      $this->assertCount(1, $routes, 'The correct number of routes was found.');
       $this->assertNotNull($routes->get('poink'), 'The first matching route was found.');
     }
     catch (ResourceNotFoundException $e) {
@@ -389,7 +389,7 @@ public function testOutlinePathMatchDefaultsCollision() {
         $this->assertEqual($route->compile()->getPatternOutline(), '/some/path', 'Found path has correct pattern');
       }
 
-      $this->assertEqual(count($routes), 1, 'The correct number of routes was found.');
+      $this->assertCount(1, $routes, 'The correct number of routes was found.');
       $this->assertNotNull($routes->get('poink'), 'The first matching route was found.');
     }
     catch (ResourceNotFoundException $e) {
@@ -425,7 +425,7 @@ public function testOutlinePathMatchDefaultsCollision2() {
       $routes = $provider->getRouteCollectionForRequest($request);
       $routes_array = $routes->all();
 
-      $this->assertEqual(count($routes), 2, 'The correct number of routes was found.');
+      $this->assertCount(2, $routes, 'The correct number of routes was found.');
       $this->assertEqual(['narf', 'poink'], array_keys($routes_array), 'Ensure the fitness was taken into account.');
       $this->assertNotNull($routes->get('narf'), 'The first matching route was found.');
       $this->assertNotNull($routes->get('poink'), 'The second matching route was found.');
@@ -464,7 +464,7 @@ public function testOutlinePathMatchDefaultsCollision3() {
       $routes = $provider->getRouteCollectionForRequest($request);
       $routes_array = $routes->all();
 
-      $this->assertEqual(count($routes), 2, 'The correct number of routes was found.');
+      $this->assertCount(2, $routes, 'The correct number of routes was found.');
       $this->assertEqual(['poink', 'poink2'], array_keys($routes_array), 'Ensure the fitness and name were taken into account in the sort.');
       $this->assertNotNull($routes->get('poink'), 'The first matching route was found.');
       $this->assertNotNull($routes->get('poink2'), 'The second matching route was found.');
@@ -503,7 +503,7 @@ public function testOutlinePathMatchZero() {
         $this->assertEqual($route->compile()->getPatternOutline(), '/some/path/%', 'Found path has correct pattern');
       }
 
-      $this->assertEqual(count($routes), 1, 'The correct number of routes was found.');
+      $this->assertCount(1, $routes, 'The correct number of routes was found.');
     }
     catch (ResourceNotFoundException $e) {
       $this->fail('No matchout route found with 0 as argument value');
@@ -557,7 +557,7 @@ public function testRouteCaching() {
     $cache = $this->cache->get('route:[language]=en:/path/add/one:');
     $this->assertEqual('/path/add/one', $cache->data['path']);
     $this->assertEqual([], $cache->data['query']);
-    $this->assertEqual(3, count($cache->data['routes']));
+    $this->assertCount(3, $cache->data['routes']);
 
     // A path with query parameters.
     $path = '/path/add/one?foo=bar';
@@ -567,7 +567,7 @@ public function testRouteCaching() {
     $cache = $this->cache->get('route:[language]=en:/path/add/one:foo=bar');
     $this->assertEqual('/path/add/one', $cache->data['path']);
     $this->assertEqual(['foo' => 'bar'], $cache->data['query']);
-    $this->assertEqual(3, count($cache->data['routes']));
+    $this->assertCount(3, $cache->data['routes']);
 
     // A path with placeholders.
     $path = '/path/1/one';
@@ -577,7 +577,7 @@ public function testRouteCaching() {
     $cache = $this->cache->get('route:[language]=en:/path/1/one:');
     $this->assertEqual('/path/1/one', $cache->data['path']);
     $this->assertEqual([], $cache->data['query']);
-    $this->assertEqual(2, count($cache->data['routes']));
+    $this->assertCount(2, $cache->data['routes']);
 
     // A path with a path alias.
     $this->createPathAlias('/path/add/one', '/path/add-one');
@@ -592,7 +592,7 @@ public function testRouteCaching() {
     $cache = $this->cache->get('route:[language]=en:/path/add-one:');
     $this->assertEqual('/path/add/one', $cache->data['path']);
     $this->assertEqual([], $cache->data['query']);
-    $this->assertEqual(3, count($cache->data['routes']));
+    $this->assertCount(3, $cache->data['routes']);
 
     // Test with a different current language by switching out the default
     // language.
@@ -607,7 +607,7 @@ public function testRouteCaching() {
     $cache = $this->cache->get('route:[language]=gsw-berne:/path/add-one:');
     $this->assertEquals('/path/add/one', $cache->data['path']);
     $this->assertEquals([], $cache->data['query']);
-    $this->assertEquals(3, count($cache->data['routes']));
+    $this->assertCount(3, $cache->data['routes']);
   }
 
   /**
@@ -640,7 +640,7 @@ public function testRouteByName() {
     $this->assertTrue($exception_thrown, 'Random route was not found.');
 
     $routes = $provider->getRoutesByNames(['route_c', 'route_d', $this->randomMachineName()]);
-    $this->assertEqual(count($routes), 2, 'Only two valid routes found.');
+    $this->assertCount(2, $routes, 'Only two valid routes found.');
     $this->assertEqual($routes['route_c']->getPath(), '/path/two');
     $this->assertEqual($routes['route_d']->getPath(), '/path/three');
   }
@@ -659,13 +659,13 @@ public function testGetRoutesByPatternWithLongPatterns() {
     $result = $provider->getRoutesByPattern($shortest);
     $this->assertEqual($result->count(), 0);
     $candidates = $provider->getCandidateOutlines(explode('/', trim($shortest, '/')));
-    $this->assertEqual(count($candidates), 7);
+    $this->assertCount(7, $candidates);
     // A longer patten is not found and returns no candidates
     $path_to_test = '/test/1/test2/2/test3/3/4/5/6/test4';
     $result = $provider->getRoutesByPattern($path_to_test);
     $this->assertEqual($result->count(), 0);
     $candidates = $provider->getCandidateOutlines(explode('/', trim($path_to_test, '/')));
-    $this->assertEqual(count($candidates), 0);
+    $this->assertCount(0, $candidates);
 
     // Add a matching route and dump it.
     $dumper = new MatcherDumper($connection, $this->state, 'test_routes');
@@ -681,7 +681,7 @@ public function testGetRoutesByPatternWithLongPatterns() {
     $this->assertEqual(serialize($result->get('long_pattern')), serialize($collection->get('long_pattern')), 'The right route was found.');
     // We now have a single candidate outline.
     $candidates = $provider->getCandidateOutlines(explode('/', trim($path_to_test, '/')));
-    $this->assertEqual(count($candidates), 1);
+    $this->assertCount(1, $candidates);
     // Longer and shorter patterns are not found. Both are longer than 3, so
     // we should not have any candidates either. The fact that we do not
     // get any candidates for a longer path is a security feature.
@@ -689,18 +689,18 @@ public function testGetRoutesByPatternWithLongPatterns() {
     $result = $provider->getRoutesByPattern($longer);
     $this->assertEqual($result->count(), 0);
     $candidates = $provider->getCandidateOutlines(explode('/', trim($longer, '/')));
-    $this->assertEqual(count($candidates), 1);
+    $this->assertCount(1, $candidates);
     $shorter = '/test/1/test2/2/test3';
     $result = $provider->getRoutesByPattern($shorter);
     $this->assertEqual($result->count(), 0);
     $candidates = $provider->getCandidateOutlines(explode('/', trim($shorter, '/')));
-    $this->assertEqual(count($candidates), 0);
+    $this->assertCount(0, $candidates);
     // This pattern has only 3 parts, so we will get candidates, but no routes.
     // This result is unchanged by running the dumper.
     $result = $provider->getRoutesByPattern($shortest);
     $this->assertEqual($result->count(), 0);
     $candidates = $provider->getCandidateOutlines(explode('/', trim($shortest, '/')));
-    $this->assertEqual(count($candidates), 7);
+    $this->assertCount(7, $candidates);
   }
 
   /**
diff --git a/core/tests/Drupal/KernelTests/Core/Test/AssertMailTraitTest.php b/core/tests/Drupal/KernelTests/Core/Test/AssertMailTraitTest.php
index 9b71fb357e8838404f024747c514b40182bdd06a..7ce78183f16e1ba3fd0efb53169aa5936dad22b4 100644
--- a/core/tests/Drupal/KernelTests/Core/Test/AssertMailTraitTest.php
+++ b/core/tests/Drupal/KernelTests/Core/Test/AssertMailTraitTest.php
@@ -43,7 +43,7 @@ public function testAssertMailTrait() {
 
     // Ensure that there is one email in the captured emails array.
     $captured_emails = $this->getMails();
-    $this->assertEquals(count($captured_emails), 1, 'One email was captured.');
+    $this->assertCount(1, $captured_emails, 'One email was captured.');
 
     // Assert that the email was sent by iterating over the message properties
     // and ensuring that they are captured intact.
diff --git a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php
index 9792a8917930510abe0f9a5930f0b826332e3154..345d31075cf743e0aab1d8e923b55549b11d4086 100644
--- a/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php
+++ b/core/tests/Drupal/KernelTests/Core/TypedData/TypedDataTest.php
@@ -399,24 +399,24 @@ public function testTypedDataLists() {
     // Test dealing with NULL items.
     $typed_data[] = NULL;
     $this->assertTrue($typed_data->isEmpty());
-    $this->assertEqual(count($typed_data), 1);
+    $this->assertCount(1, $typed_data);
     $typed_data[] = '';
     $this->assertFalse($typed_data->isEmpty());
-    $this->assertEqual(count($typed_data), 2);
+    $this->assertCount(2, $typed_data);
     $typed_data[] = 'three';
     $this->assertFalse($typed_data->isEmpty());
-    $this->assertEqual(count($typed_data), 3);
+    $this->assertCount(3, $typed_data);
 
     $this->assertEqual($typed_data->getValue(), [NULL, '', 'three']);
     // Test unsetting.
     unset($typed_data[1]);
-    $this->assertEqual(count($typed_data), 2);
+    $this->assertCount(2, $typed_data);
     // Check that items were shifted.
     $this->assertEqual($typed_data[1]->getValue(), 'three');
 
     // Getting a not set list item returns NULL, and does not create a new item.
     $this->assertNull($typed_data[2]);
-    $this->assertEqual(count($typed_data), 2);
+    $this->assertCount(2, $typed_data);
 
     // Test setting the list with less values.
     $typed_data->setValue(['one']);
diff --git a/core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php b/core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php
index a710a409da310399e20bb8ac643f5e75be44f773..f455ea410af8ccf72cbf176d7ef308de2a6aed84 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/Doctrine/DocParserTest.php
@@ -37,7 +37,7 @@ public function testNestedArraysWithNestedAnnotation()
 
         $this->assertInstanceOf(Name::class, $annot);
         $this->assertNull($annot->value);
-        $this->assertEquals(3, count($annot->foo));
+        $this->assertCount(3, $annot->foo);
         $this->assertEquals(1, $annot->foo[0]);
         $this->assertEquals(2, $annot->foo[1]);
         $this->assertIsArray($annot->foo[2]);
@@ -106,7 +106,7 @@ public function testBasicAnnotations()
 DOCBLOCK;
 
         $result = $parser->parse($docblock);
-        $this->assertEquals(1, count($result));
+        $this->assertCount(1, $result);
         $annot = $result[0];
         $this->assertInstanceOf(Name::class, $annot);
         $this->assertEquals("bar", $annot->foo);
@@ -153,7 +153,7 @@ public function testNamespacedAnnotations()
 DOCBLOCK;
 
         $result = $parser->parse($docblock);
-        $this->assertEquals(1, count($result));
+        $this->assertCount(1, $result);
         $annot = $result[0];
         $this->assertInstanceOf(Name::class, $annot);
         $this->assertEquals("bar", $annot->foo);
@@ -181,7 +181,7 @@ public function testTypicalMethodDocBlock()
 DOCBLOCK;
 
         $result = $parser->parse($docblock);
-        $this->assertEquals(2, count($result));
+        $this->assertCount(2, $result);
         $this->assertTrue(isset($result[0]));
         $this->assertTrue(isset($result[1]));
         $annot = $result[0];
@@ -204,7 +204,7 @@ public function testAnnotationWithoutConstructor()
 DOCBLOCK;
 
         $result     = $parser->parse($docblock);
-        $this->assertEquals(count($result), 1);
+        $this->assertCount(1, $result);
         $annot      = $result[0];
 
         $this->assertNotNull($annot);
@@ -225,7 +225,7 @@ public function testAnnotationWithoutConstructor()
 
 
         $result     = $parser->parse($docblock);
-        $this->assertEquals(count($result), 1);
+        $this->assertCount(1, $result);
         $annot      = $result[0];
 
         $this->assertNotNull($annot);
@@ -244,7 +244,7 @@ public function testAnnotationWithoutConstructor()
 DOCBLOCK;
 
         $result     = $parser->parse($docblock);
-        $this->assertEquals(count($result), 1);
+        $this->assertCount(1, $result);
         $annot      = $result[0];
 
         $this->assertEquals($annot->data, "Some data");
@@ -258,7 +258,7 @@ public function testAnnotationWithoutConstructor()
 DOCBLOCK;
 
         $result     = $parser->parse($docblock);
-        $this->assertEquals(count($result), 1);
+        $this->assertCount(1, $result);
         $annot      = $result[0];
 
         $this->assertEquals($annot->name, "Some name");
@@ -271,7 +271,7 @@ public function testAnnotationWithoutConstructor()
 DOCBLOCK;
 
         $result     = $parser->parse($docblock);
-        $this->assertEquals(count($result), 1);
+        $this->assertCount(1, $result);
         $annot      = $result[0];
 
         $this->assertEquals($annot->data, "Some data");
@@ -286,7 +286,7 @@ public function testAnnotationWithoutConstructor()
 DOCBLOCK;
 
         $result     = $parser->parse($docblock);
-        $this->assertEquals(count($result), 1);
+        $this->assertCount(1, $result);
         $annot      = $result[0];
 
         $this->assertEquals($annot->name, "Some name");
@@ -300,7 +300,7 @@ public function testAnnotationWithoutConstructor()
 DOCBLOCK;
 
         $result     = $parser->parse($docblock);
-        $this->assertEquals(count($result), 1);
+        $this->assertCount(1, $result);
         $annot      = $result[0];
 
         $this->assertEquals($annot->name, "Some name");
@@ -313,7 +313,7 @@ public function testAnnotationWithoutConstructor()
 DOCBLOCK;
 
         $result     = $parser->parse($docblock);
-        $this->assertEquals(count($result), 1);
+        $this->assertCount(1, $result);
         $this->assertInstanceOf(SomeAnnotationClassNameWithoutConstructorAndProperties::class, $result[0]);
     }
 
@@ -997,7 +997,7 @@ public function testAnnotationWithoutClassIsIgnoredWithoutWarning()
         $parser->setIgnoreNotImportedAnnotations(true);
         $result = $parser->parse("@param");
 
-        $this->assertEquals(0, count($result));
+        $this->assertCount(0, $result);
     }
 
     /**
@@ -1010,7 +1010,7 @@ public function testNotAnAnnotationClassIsIgnoredWithoutWarning()
         $parser->setIgnoredAnnotationNames(array('PHPUnit_Framework_TestCase' => true));
         $result = $parser->parse('@PHPUnit_Framework_TestCase');
 
-        $this->assertEquals(0, count($result));
+        $this->assertCount(0, $result);
     }
 
     public function testAnnotationDontAcceptSingleQuotes()
@@ -1030,7 +1030,7 @@ public function testAnnotationDoesntThrowExceptionWhenAtSignIsNotFollowedByIdent
         $parser = new DocParser();
         $result = $parser->parse("'@'");
 
-        $this->assertEquals(0, count($result));
+        $this->assertCount(0, $result);
     }
 
     /**
@@ -1060,7 +1060,7 @@ public function testAutoloadAnnotation()
         ));
         $annotations = $parser->parse('@Autoload');
 
-        $this->assertEquals(1, count($annotations));
+        $this->assertCount(1, $annotations);
         $this->assertInstanceOf('Drupal\Tests\Component\Annotation\Doctrine\Fixtures\Annotation\Autoload', $annotations[0]);
     }
 
@@ -1245,7 +1245,7 @@ public function testTrailingCommaIsAllowed()
             "Foo",
             "Bar",
         })');
-        $this->assertEquals(1, count($annots));
+        $this->assertCount(1, $annots);
         $this->assertEquals(array('Foo', 'Bar'), $annots[0]->value);
     }
 
@@ -1254,7 +1254,7 @@ public function testDefaultAnnotationValueIsNotOverwritten()
         $parser = $this->createTestParser();
 
         $annots = $parser->parse('@Drupal\Tests\Component\Annotation\Doctrine\Fixtures\Annotation\AnnotWithDefaultValue');
-        $this->assertEquals(1, count($annots));
+        $this->assertCount(1, $annots);
         $this->assertEquals('bar', $annots[0]->foo);
     }
 
@@ -1263,7 +1263,7 @@ public function testArrayWithColon()
         $parser = $this->createTestParser();
 
         $annots = $parser->parse('@Name({"foo": "bar"})');
-        $this->assertEquals(1, count($annots));
+        $this->assertCount(1, $annots);
         $this->assertEquals(array('foo' => 'bar'), $annots[0]->value);
     }
 
@@ -1284,7 +1284,7 @@ public function testEmptyArray()
         $parser = $this->createTestParser();
 
         $annots = $parser->parse('@Name({"foo": {}})');
-        $this->assertEquals(1, count($annots));
+        $this->assertCount(1, $annots);
         $this->assertEquals(array('foo' => array()), $annots[0]->value);
     }
 
@@ -1293,7 +1293,7 @@ public function testKeyHasNumber()
         $parser = $this->createTestParser();
         $annots = $parser->parse('@SettingsAnnotation(foo="test", bar2="test")');
 
-        $this->assertEquals(1, count($annots));
+        $this->assertCount(1, $annots);
         $this->assertEquals(array('foo' => 'test', 'bar2' => 'test'), $annots[0]->settings);
     }
 
diff --git a/core/tests/Drupal/Tests/Component/Annotation/Doctrine/Ticket/DCOM58Test.php b/core/tests/Drupal/Tests/Component/Annotation/Doctrine/Ticket/DCOM58Test.php
index a13dfbfa44bc424a88f87306610fe8440d1d2e8b..32521db77bdb2e5858352dd881ef1cd5f83b0e3c 100644
--- a/core/tests/Drupal/Tests/Component/Annotation/Doctrine/Ticket/DCOM58Test.php
+++ b/core/tests/Drupal/Tests/Component/Annotation/Doctrine/Ticket/DCOM58Test.php
@@ -37,7 +37,7 @@ public function testIssueGlobalNamespace()
 
         $annots     = $parser->parse($docblock);
 
-        $this->assertEquals(1, count($annots));
+        $this->assertCount(1, $annots);
         $this->assertInstanceOf("Drupal\Tests\Component\Annotation\Doctrine\Ticket\Doctrine\ORM\Mapping\Entity", $annots[0]);
     }
 
@@ -49,7 +49,7 @@ public function testIssueNamespaces()
 
         $annots     = $parser->parse($docblock);
 
-        $this->assertEquals(1, count($annots));
+        $this->assertCount(1, $annots);
         $this->assertInstanceOf("Drupal\Tests\Component\Annotation\Doctrine\Ticket\Doctrine\ORM\Entity", $annots[0]);
     }
 
@@ -62,7 +62,7 @@ public function testIssueMultipleNamespaces()
 
         $annots     = $parser->parse($docblock);
 
-        $this->assertEquals(1, count($annots));
+        $this->assertCount(1, $annots);
         $this->assertInstanceOf("Drupal\Tests\Component\Annotation\Doctrine\Ticket\Doctrine\ORM\Mapping\Entity", $annots[0]);
     }
 
@@ -72,9 +72,9 @@ public function testIssueWithNamespacesOrImports()
         $parser     = new DocParser();
         $annots     = $parser->parse($docblock);
 
-        $this->assertEquals(1, count($annots));
+        $this->assertCount(1, $annots);
         $this->assertInstanceOf("Entity", $annots[0]);
-        $this->assertEquals(1, count($annots));
+        $this->assertCount(1, $annots);
     }
 
 
@@ -84,7 +84,7 @@ public function testIssueSimpleAnnotationReader()
         $reader->addNamespace('Drupal\Tests\Component\Annotation\Doctrine\Ticket\Doctrine\ORM\Mapping');
         $annots     = $reader->getClassAnnotations(new \ReflectionClass(__NAMESPACE__."\MappedClass"));
 
-        $this->assertEquals(1, count($annots));
+        $this->assertCount(1, $annots);
         $this->assertInstanceOf("Drupal\Tests\Component\Annotation\Doctrine\Ticket\Doctrine\ORM\Mapping\Entity", $annots[0]);
     }
 
diff --git a/core/tests/Drupal/Tests/Component/Graph/GraphTest.php b/core/tests/Drupal/Tests/Component/Graph/GraphTest.php
index 940217c64f6f0382b47778468292a82016a7bda2..eb7d7e3cbd16f1ae3ba1cc2a3446a4908406beed 100644
--- a/core/tests/Drupal/Tests/Component/Graph/GraphTest.php
+++ b/core/tests/Drupal/Tests/Component/Graph/GraphTest.php
@@ -149,7 +149,7 @@ protected function assertComponents($graph, $expected_components) {
         $result_components[] = $graph[$vertex]['component'];
         unset($unassigned_vertices[$vertex]);
       }
-      $this->assertEquals(1, count(array_unique($result_components)), sprintf('Expected one unique component for vertices %s, got %s', $this->displayArray($component), $this->displayArray($result_components)));
+      $this->assertCount(1, array_unique($result_components), sprintf('Expected one unique component for vertices %s, got %s', $this->displayArray($component), $this->displayArray($result_components)));
     }
     $this->assertEquals([], $unassigned_vertices, sprintf('Vertices not assigned to a component: %s', $this->displayArray($unassigned_vertices, TRUE)));
   }
diff --git a/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php b/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php
index 0396cc012de3c44a0946f02dbfde606a69ebee10..7e5fe84836be9aa2c9a4099a328c6faa9262d788 100644
--- a/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Asset/CssCollectionGrouperUnitTest.php
@@ -104,7 +104,7 @@ public function testGrouper() {
 
     $groups = $this->grouper->group($css_assets);
 
-    $this->assertSame(5, count($groups), "5 groups created.");
+    $this->assertCount(5, $groups, "5 groups created.");
 
     // Check group 1.
     $group = $groups[0];
@@ -112,7 +112,7 @@ public function testGrouper() {
     $this->assertSame('file', $group['type']);
     $this->assertSame('all', $group['media']);
     $this->assertTrue($group['preprocess']);
-    $this->assertSame(3, count($group['items']));
+    $this->assertCount(3, $group['items']);
     $this->assertContains($css_assets['system.base.css'], $group['items']);
     $this->assertContains($css_assets['js.module.css'], $group['items']);
 
@@ -122,7 +122,7 @@ public function testGrouper() {
     $this->assertSame('file', $group['type']);
     $this->assertSame('all', $group['media']);
     $this->assertTrue($group['preprocess']);
-    $this->assertSame(1, count($group['items']));
+    $this->assertCount(1, $group['items']);
     $this->assertContains($css_assets['field.css'], $group['items']);
 
     // Check group 3.
@@ -131,7 +131,7 @@ public function testGrouper() {
     $this->assertSame('external', $group['type']);
     $this->assertSame('all', $group['media']);
     $this->assertTrue($group['preprocess']);
-    $this->assertSame(1, count($group['items']));
+    $this->assertCount(1, $group['items']);
     $this->assertContains($css_assets['external.css'], $group['items']);
 
     // Check group 4.
@@ -140,7 +140,7 @@ public function testGrouper() {
     $this->assertSame('file', $group['type']);
     $this->assertSame('all', $group['media']);
     $this->assertTrue($group['preprocess']);
-    $this->assertSame(1, count($group['items']));
+    $this->assertCount(1, $group['items']);
     $this->assertContains($css_assets['elements.css'], $group['items']);
 
     // Check group 5.
@@ -149,7 +149,7 @@ public function testGrouper() {
     $this->assertSame('file', $group['type']);
     $this->assertSame('print', $group['media']);
     $this->assertTrue($group['preprocess']);
-    $this->assertSame(1, count($group['items']));
+    $this->assertCount(1, $group['items']);
     $this->assertContains($css_assets['print.css'], $group['items']);
   }
 
diff --git a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
index f1270b9efd42094d3506d35b5be17e2836866385..ddc85b9c70cadf55115581a6160706d469b275f9 100644
--- a/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/ContentEntityBaseUnitTest.php
@@ -375,8 +375,8 @@ public function testValidate() {
     $this->typedDataManager->expects($this->exactly(2))
       ->method('getValidator')
       ->will($this->returnValue($validator));
-    $this->assertSame(0, count($this->entity->validate()));
-    $this->assertSame(1, count($this->entity->validate()));
+    $this->assertCount(0, $this->entity->validate());
+    $this->assertCount(1, $this->entity->validate());
   }
 
   /**
diff --git a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php
index b210ed2e00d1a58d9894563f5db2cf200ca9ec37..855db2982cf37f61eafaa8759d9bd4dcce716f4b 100644
--- a/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php
+++ b/core/tests/Drupal/Tests/Core/Entity/TypedData/EntityAdapterUnitTest.php
@@ -349,7 +349,7 @@ public function testToArray() {
     // Mock field objects return NULL values, so test keys only.
     $this->assertArrayHasKey('id', $array);
     $this->assertArrayHasKey('revision_id', $array);
-    $this->assertEquals(count($array), 2);
+    $this->assertCount(2, $array);
   }
 
   /**
@@ -426,7 +426,7 @@ public function testGetIterator() {
     $fields = iterator_to_array($iterator);
     $this->assertArrayHasKey('id', $fields);
     $this->assertArrayHasKey('revision_id', $fields);
-    $this->assertEquals(count($fields), 2);
+    $this->assertCount(2, $fields);
 
     $this->entityAdapter->setValue(NULL);
     $this->assertEquals(new \ArrayIterator([]), $this->entityAdapter->getIterator());
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php
index dc888f2eaff661f46abbe5367c73d55bbe6a5ca6..938fbbc01b1200a8004b220e099af9ffed218f4b 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/ContainerDerivativeDiscoveryDecoratorTest.php
@@ -45,7 +45,7 @@ public function testGetDefinitions() {
     $definitions = $discovery->getDefinitions();
 
     // Ensure that both the instances from container and non-container test derivatives got added.
-    $this->assertEquals(4, count($definitions));
+    $this->assertCount(4, $definitions);
   }
 
 }
diff --git a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
index 53825622c9b62a1c794a21be621e95b404d3aa04..975e3e4ece95dc7ad6abf376f7eca6043868705a 100644
--- a/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
+++ b/core/tests/Drupal/Tests/Core/Plugin/Discovery/DerivativeDiscoveryDecoratorTest.php
@@ -50,7 +50,7 @@ public function testGetDerivativeFetcher() {
     $definitions = $discovery->getDefinitions();
 
     // Ensure that both test derivatives got added.
-    $this->assertEquals(2, count($definitions));
+    $this->assertCount(2, $definitions);
     $this->assertEquals('non_container_aware_discovery', $definitions['non_container_aware_discovery:test_discovery_0']['id']);
     $this->assertEquals('\Drupal\Tests\Core\Plugin\Discovery\TestDerivativeDiscovery', $definitions['non_container_aware_discovery:test_discovery_0']['deriver']);
 
@@ -76,7 +76,7 @@ public function testGetDerivativeFetcherWithAnnotationObjects() {
     $definitions = $discovery->getDefinitions();
 
     // Ensure that both test derivatives got added.
-    $this->assertEquals(2, count($definitions));
+    $this->assertCount(2, $definitions);
     $this->assertInstanceOf('\stdClass', $definitions['non_container_aware_discovery:test_discovery_0']);
     $this->assertEquals('non_container_aware_discovery', $definitions['non_container_aware_discovery:test_discovery_0']->id);
     $this->assertEquals('\Drupal\Tests\Core\Plugin\Discovery\TestDerivativeDiscoveryWithObject', $definitions['non_container_aware_discovery:test_discovery_0']->deriver);
diff --git a/core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php b/core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php
index 257abc9faf1a9dc1e95034e29f234964557ef205..8b5e9c0d4c2e6f523ac3c660df8a45da5f0c2e55 100644
--- a/core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/AcceptHeaderMatcherTest.php
@@ -75,7 +75,7 @@ public function testAcceptFiltering($accept_header, $format, $included_route, $e
     $request->headers->set('Accept', $accept_header);
     $request->setRequestFormat($format);
     $routes = $this->matcher->filter($collection, $request);
-    $this->assertEquals(count($routes), 4, 'The correct number of routes was found.');
+    $this->assertCount(4, $routes, 'The correct number of routes was found.');
     $this->assertNotNull($routes->get($included_route), "Route $included_route was found when matching $accept_header.");
     $this->assertNull($routes->get($excluded_route), "Route $excluded_route was not found when matching $accept_header.");
     foreach ($routes as $name => $route) {
diff --git a/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php b/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php
index 90c864e725f6dca68a08698e77f889b100753780..cc2d004c92aadecfb63f5bf42d803e30ccb02848 100644
--- a/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php
+++ b/core/tests/Drupal/Tests/Core/Routing/ContentTypeHeaderMatcherTest.php
@@ -52,7 +52,7 @@ public function testSafeRequestFilter($method) {
 
     $request = Request::create('path/two', $method);
     $routes = $this->matcher->filter($collection, $request);
-    $this->assertEquals(count($routes), 7, 'The correct number of routes was found.');
+    $this->assertCount(7, $routes, 'The correct number of routes was found.');
   }
 
   public function providerTestSafeRequestFilter() {
@@ -75,7 +75,7 @@ public function testJsonRequest() {
     $request = Request::create('path/two', 'POST');
     $request->headers->set('Content-type', 'application/json');
     $routes = $this->matcher->filter($collection, $request);
-    $this->assertEquals(count($routes), 6, 'The correct number of routes was found.');
+    $this->assertCount(6, $routes, 'The correct number of routes was found.');
     $this->assertNotNull($routes->get('route_f'), 'The json route was found.');
     $this->assertNull($routes->get('route_g'), 'The xml route was not found.');
     foreach ($routes as $name => $route) {
@@ -96,7 +96,7 @@ public function testPostForm() {
     $request = Request::create('path/two', 'POST');
     $request->headers->set('Content-type', 'application/www-form-urlencoded');
     $routes = $this->matcher->filter($collection, $request);
-    $this->assertEquals(count($routes), 5, 'The correct number of routes was found.');
+    $this->assertCount(5, $routes, 'The correct number of routes was found.');
     $this->assertNull($routes->get('route_f'), 'The json route was found.');
     $this->assertNull($routes->get('route_g'), 'The xml route was not found.');
   }
diff --git a/core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php b/core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php
index 500f4a3b579692d9650a736f56991d02a350c8b3..ccb00ff82c9b69ac501fab41c806a5aef8f45c54 100644
--- a/core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php
+++ b/core/tests/Drupal/Tests/Core/Test/JUnitConverterTest.php
@@ -29,7 +29,7 @@ public function testXmlToRowsWithErrors() {
     $phpunit_error_xml = __DIR__ . '/fixtures/phpunit_error.xml';
 
     $res = JUnitConverter::xmlToRows(1, $phpunit_error_xml);
-    $this->assertEquals(count($res), 4, 'All testcases got extracted');
+    $this->assertCount(4, $res, 'All testcases got extracted');
     $this->assertNotEquals($res[0]['status'], 'pass');
     $this->assertEquals($res[0]['status'], 'fail');