Skip to content
Snippets Groups Projects
Commit c1891492 authored by catch's avatar catch
Browse files

Issue #3320240 by solideogloria, tobiasb, smustgrave, alexpott: Entity count...

Issue #3320240 by solideogloria, tobiasb, smustgrave, alexpott: Entity count query returns a string instead of int
parent 45921343
No related branches found
No related tags found
No related merge requests found
......@@ -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.
......
......@@ -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.
......@@ -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);
......@@ -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);
}
......@@ -577,7 +577,7 @@ public function testCount() {
->exists("$field_name.color")
->count()
->execute();
$this->assertEquals(0, $count);
$this->assertSame(0, $count);
}
/**
......@@ -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()
......@@ -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());
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment