diff --git a/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php b/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php index 0e6e1d71d5..1cee228eb6 100644 --- a/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php +++ b/core/modules/views/tests/src/Functional/Plugin/MiniPagerTest.php @@ -81,7 +81,7 @@ public function testMiniPagerRender() { $view->setDisplay('page_4'); $this->executeView($view); $this->assertTrue($view->get_total_rows, 'The query was set to calculate the total number of rows.'); - $this->assertSame(count($this->nodes), $view->total_rows, 'The total row count is equal to the number of nodes.'); + $this->assertSame(count($this->nodes), (int) $view->total_rows, 'The total row count is equal to the number of nodes.'); $this->drupalGet('test_mini_pager_total', ['query' => ['page' => 1]]); $this->assertText('of ' . count($this->nodes), 'The first page shows the total row count.'); diff --git a/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php b/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php index 2f512f6696..06fe8a9069 100644 --- a/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php +++ b/core/modules/workspaces/tests/src/Kernel/WorkspaceIntegrationTest.php @@ -914,10 +914,10 @@ protected function assertEntityQuery(array $expected_values, $entity_type_id) { }); // Check entity query counts. - $result = $storage->getQuery()->count()->execute(); + $result = (int) $storage->getQuery()->count()->execute(); $this->assertSame(count($expected_default_revisions), $result); - $result = $storage->getAggregateQuery()->count()->execute(); + $result = (int) $storage->getAggregateQuery()->count()->execute(); $this->assertSame(count($expected_default_revisions), $result); // Check entity queries with no conditions. diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php index 941562d4bf..00f1620555 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SelectTest.php @@ -360,9 +360,7 @@ public function testUnionCount() { $query_1->union($query_2, 'ALL'); $names = $query_1->execute()->fetchCol(); - - $query_3 = $query_1->countQuery(); - $count = $query_3->execute()->fetchField(); + $count = (int) $query_1->countQuery()->execute()->fetchField(); // Ensure the counts match. $this->assertSame(count($names), $count, "The count query's result matched the number of rows in the UNION query."); diff --git a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php index c98e043e43..dacb515b35 100644 --- a/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Entity/ConfigEntityQueryTest.php @@ -689,7 +689,12 @@ public function testLookupKeys() { * Array of expected entity IDs. */ protected function assertResults($expected) { - $this->assertEquals($expected, $this->queryResults); + $expected_count = count($expected); + $this->assertCount($expected_count, $this->queryResults); + foreach ($expected as $value) { + // This also tests whether $this->queryResults[$value] is even set at all. + $this->assertIdentical($this->queryResults[$value], $value); + } } } diff --git a/core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php b/core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php index 83854c8243..c7161494fd 100644 --- a/core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php +++ b/core/tests/Drupal/KernelTests/Core/Installer/InstallerLanguageTest.php @@ -31,7 +31,7 @@ public function testInstallerTranslationFiles() { $file_translation = new FileTranslation('core/tests/fixtures/files/translations', $this->container->get('file_system')); foreach ($expected_translation_files as $langcode => $files_expected) { $files_found = $file_translation->findTranslationFiles($langcode); - $this->assertSame(count($files_expected), count($files_found), FormattableMarkup('@count installer languages found.', ['@count' => count($files_expected)])); + $this->assertSame(count($files_expected), count($files_found), new FormattableMarkup('@count installer languages found.', ['@count' => count($files_expected)])); foreach ($files_found as $file) { $this->assertContains($file->filename, $files_expected, new FormattableMarkup('@file found.', ['@file' => $file->filename])); }