Loading core/lib/Drupal/Core/Entity/Query/Sql/Query.php +1 −1 Original line number Diff line number Diff line Loading @@ -263,7 +263,7 @@ protected function finish() { */ protected function result() { if ($this->count) { return $this->sqlQuery->countQuery()->execute()->fetchField(); return (int) $this->sqlQuery->countQuery()->execute()->fetchField(); } // Return a keyed array of results. The key is either the revision_id or // the entity_id depending on whether the entity type supports revisions. Loading core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +6 −6 Original line number Diff line number Diff line Loading @@ -192,7 +192,7 @@ public function testEntityQuery() { ->condition("$figures.color", 'red') ->sort('id'); $count_query = clone $query; $this->assertEquals(12, $count_query->count()->execute()); $this->assertSame(12, $count_query->count()->execute()); $this->queryResults = $query->execute(); // Now bit 0 (1, 3, 5, 7, 9, 11, 13, 15) or bit 2 (4, 5, 6, 7, 12, 13, 14, // 15) needs to be set. Loading Loading @@ -452,7 +452,7 @@ public function testSort() { // 13 red tr // 15 red tr $count_query = clone $query; $this->assertEquals(15, $count_query->count()->execute()); $this->assertSame(15, $count_query->count()->execute()); $this->queryResults = $query->execute(); $this->assertResult(8, 12, 4, 2, 3, 10, 11, 14, 15, 6, 7, 1, 9, 13, 5); Loading Loading @@ -481,7 +481,7 @@ public function testSort() { ->sort("$greetings.format", 'DESC') ->sort('id', 'DESC'); $count_query = clone $query; $this->assertEquals(15, $count_query->count()->execute()); $this->assertSame(15, $count_query->count()->execute()); $this->queryResults = $query->execute(); $this->assertResult(15, 13, 7, 5, 11, 9, 3, 1, 14, 6, 10, 2, 12, 4, 8); } Loading Loading @@ -577,7 +577,7 @@ public function testCount() { ->exists("$field_name.color") ->count() ->execute(); $this->assertEquals(0, $count); $this->assertSame(0, $count); } /** Loading Loading @@ -622,7 +622,7 @@ public function testConditionCount() { ->condition($this->figures . '.shape', 'triangle'); // We added 2 conditions so count should be 2. $this->assertEquals(2, $and_condition_group->count()); $this->assertSame(2, $and_condition_group->count()); // Add an OR condition group with 2 conditions in it. $or_condition_group = $query->orConditionGroup() Loading @@ -630,7 +630,7 @@ public function testConditionCount() { ->condition($this->figures . '.shape', 'triangle'); // We added 2 conditions so count should be 2. $this->assertEquals(2, $or_condition_group->count()); $this->assertSame(2, $or_condition_group->count()); } /** Loading Loading
core/lib/Drupal/Core/Entity/Query/Sql/Query.php +1 −1 Original line number Diff line number Diff line Loading @@ -263,7 +263,7 @@ protected function finish() { */ protected function result() { if ($this->count) { return $this->sqlQuery->countQuery()->execute()->fetchField(); return (int) $this->sqlQuery->countQuery()->execute()->fetchField(); } // Return a keyed array of results. The key is either the revision_id or // the entity_id depending on whether the entity type supports revisions. Loading
core/tests/Drupal/KernelTests/Core/Entity/EntityQueryTest.php +6 −6 Original line number Diff line number Diff line Loading @@ -192,7 +192,7 @@ public function testEntityQuery() { ->condition("$figures.color", 'red') ->sort('id'); $count_query = clone $query; $this->assertEquals(12, $count_query->count()->execute()); $this->assertSame(12, $count_query->count()->execute()); $this->queryResults = $query->execute(); // Now bit 0 (1, 3, 5, 7, 9, 11, 13, 15) or bit 2 (4, 5, 6, 7, 12, 13, 14, // 15) needs to be set. Loading Loading @@ -452,7 +452,7 @@ public function testSort() { // 13 red tr // 15 red tr $count_query = clone $query; $this->assertEquals(15, $count_query->count()->execute()); $this->assertSame(15, $count_query->count()->execute()); $this->queryResults = $query->execute(); $this->assertResult(8, 12, 4, 2, 3, 10, 11, 14, 15, 6, 7, 1, 9, 13, 5); Loading Loading @@ -481,7 +481,7 @@ public function testSort() { ->sort("$greetings.format", 'DESC') ->sort('id', 'DESC'); $count_query = clone $query; $this->assertEquals(15, $count_query->count()->execute()); $this->assertSame(15, $count_query->count()->execute()); $this->queryResults = $query->execute(); $this->assertResult(15, 13, 7, 5, 11, 9, 3, 1, 14, 6, 10, 2, 12, 4, 8); } Loading Loading @@ -577,7 +577,7 @@ public function testCount() { ->exists("$field_name.color") ->count() ->execute(); $this->assertEquals(0, $count); $this->assertSame(0, $count); } /** Loading Loading @@ -622,7 +622,7 @@ public function testConditionCount() { ->condition($this->figures . '.shape', 'triangle'); // We added 2 conditions so count should be 2. $this->assertEquals(2, $and_condition_group->count()); $this->assertSame(2, $and_condition_group->count()); // Add an OR condition group with 2 conditions in it. $or_condition_group = $query->orConditionGroup() Loading @@ -630,7 +630,7 @@ public function testConditionCount() { ->condition($this->figures . '.shape', 'triangle'); // We added 2 conditions so count should be 2. $this->assertEquals(2, $or_condition_group->count()); $this->assertSame(2, $or_condition_group->count()); } /** Loading