-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add count method to InMemoryRepository (#42)
There's a non-interface method (that's noted as "add to interface in next major version" internally) to get a count of a result set. This adds the same to Mocktrine.
- Loading branch information
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -74,6 +74,18 @@ public function testSimpleFindBy(): void | |
$this->assertSame('[email protected]', $results[1]->getEmail()); | ||
} | ||
|
||
public function testCount(): void | ||
{ | ||
$repo = $this->getFixture(); | ||
self::assertSame(5, $repo->count([])); | ||
self::assertSame(2, $repo->count(['lastName' => 'last'])); | ||
self::assertSame(3, $repo->count(['lastName' => 'other'])); | ||
self::assertSame(1, $repo->count(['email' => '[email protected]', 'lastName' => 'last'])); | ||
self::assertSame(0, $repo->count(['email' => '[email protected]', 'lastName' => 'other'])); | ||
self::assertSame(1, $repo->count(['email' => '[email protected]'])); | ||
self::assertSame(0, $repo->count(['email' => '[email protected]'])); | ||
} | ||
|
||
public function testFindByWithArrayValue(): void | ||
{ | ||
$repo = $this->getFixture(); | ||
|