Skip to content

Commit 84e9b0c

Browse files
committed
Fix QueryResult::count()
1 parent f936606 commit 84e9b0c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/QueryResult.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ public function offsetUnset($offset)
107107
*/
108108
public function count()
109109
{
110-
return count($this->ref->data[$offset]);
110+
return count($this->ref->data);
111111
}
112112
}

tests/QueryResultTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,16 @@ public function testTextPattern()
6161
$result = $this->record->query('020$a{$q=\ib.}')->text();
6262
$this->assertEquals('9788200424420', $result);
6363
}
64+
65+
public function testCount()
66+
{
67+
$result = $this->record->query('02.');
68+
$this->assertCount(2, $result);
69+
}
70+
71+
public function testEmptyCount()
72+
{
73+
$result = $this->record->query('03.');
74+
$this->assertCount(0, $result);
75+
}
6476
}

0 commit comments

Comments
 (0)