diff --git a/core/tests/Drupal/KernelTests/Core/Database/SelectSubqueryTest.php b/core/tests/Drupal/KernelTests/Core/Database/SelectSubqueryTest.php index bc65544..98849bb 100644 --- a/core/tests/Drupal/KernelTests/Core/Database/SelectSubqueryTest.php +++ b/core/tests/Drupal/KernelTests/Core/Database/SelectSubqueryTest.php @@ -39,7 +39,7 @@ function testFromSubquerySelect() { // WHERE tt.task = 'code' $people = $select->execute()->fetchCol(); - $this->assertEqual(count($people), 1, 'Returned the correct number of rows.'); + $this->assertCount(1, $people, 'Returned the correct number of rows.'); } } @@ -66,7 +66,7 @@ function testFromSubquerySelectWithLimit() { // INNER JOIN test t ON t.id=tt.pid $people = $select->execute()->fetchCol(); - $this->assertEqual(count($people), 1, 'Returned the correct number of rows.'); + $this->assertCount(1, $people, 'Returned the correct number of rows.'); } /** @@ -89,7 +89,7 @@ function testConditionSubquerySelect() { // FROM test tt2 // WHERE tt2.pid IN (SELECT tt.pid AS pid FROM test_task tt WHERE tt.priority=1) $people = $select->execute()->fetchCol(); - $this->assertEqual(count($people), 5, 'Returned the correct number of rows.'); + $this->assertCount(5, $people, 'Returned the correct number of rows.'); } /** @@ -110,8 +110,7 @@ function testConditionSubquerySelect2() { // FROM test t // WHERE t.age < (SELECT AVG(t2.age) FROM test t2) $people = $select->execute()->fetchCol(); - $this->assertEqual(count($people), 2, 'Returned the correct number of rows.'); - $this->assertTrue(in_array('Paul', $people) && in_array('John', $people), 'Returned Paul and John.'); + $this->assertEquals(['John', 'Paul'], $people, 'Returned Paul and John.', 0.0, 10, TRUE); } /** @@ -137,8 +136,7 @@ function testConditionSubquerySelect3() { // FROM test t // WHERE (SELECT AVG(tt.priority) FROM test_task tt WHERE tt.pid = t.id) > (SELECT AVG(tt2.priority) FROM test_task tt2) $people = $select->execute()->fetchCol(); - $this->assertEqual(count($people), 1, 'Returned the correct number of rows.'); - $this->assertTrue(in_array('John', $people), 'Returned John.'); + $this->assertEquals(['John'], $people, 'Returned John.', 0.0, 10, TRUE); } /** @@ -176,9 +174,7 @@ function testConditionSubquerySelect4() { // BETWEEN (SELECT MIN(tt2.priority) AS expression FROM {test_task} tt2 WHERE (tt2.pid <> t.id)) // AND (SELECT AVG(tt3.priority) AS expression FROM {test_task} tt3 WHERE (tt3.pid <> t.id)); $people = $select->execute()->fetchCol(); - $this->assertEqual(count($people), 2, 'Returned the correct number of rows.'); - $this->assertTrue(in_array('George', $people), 'Returned George.'); - $this->assertTrue(in_array('Paul', $people), 'Returned Paul.'); + $this->assertEquals(['George', 'Paul'], $people, 'Returned George and Paul.', 0.0, 10, TRUE); } /** @@ -202,7 +198,7 @@ function testJoinSubquerySelect() { // INNER JOIN (SELECT tt.pid AS pid FROM test_task tt WHERE priority=1) tt ON t.id=tt.pid $people = $select->execute()->fetchCol(); - $this->assertEqual(count($people), 2, 'Returned the correct number of rows.'); + $this->assertCount(2, $people, 'Returned the correct number of rows.'); } /** @@ -232,7 +228,7 @@ function testExistsSubquerySelect() { // Ensure that we got the right record. $record = $result->fetch(); - $this->assertEqual($record->name, 'George', 'Fetched name is correct using EXISTS query.'); + $this->assertEquals('George', $record->name, 'Fetched name is correct using EXISTS query.'); } /** @@ -262,7 +258,7 @@ function testNotExistsSubquerySelect() { // Ensure that we got the right number of records. $people = $query->execute()->fetchCol(); - $this->assertEqual(count($people), 3, 'NOT EXISTS query returned the correct results.'); + $this->assertCount(3, $people, 'NOT EXISTS query returned the correct results.'); } }