Adding manager that returns Doctrine style repositories
This commit is contained in:
parent
eb1900265f
commit
7dbc4221ae
7 changed files with 218 additions and 0 deletions
43
Tests/RepositoryTest.php
Normal file
43
Tests/RepositoryTest.php
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
<?php
|
||||
|
||||
namespace FOQ\ElasticaBundle\Tests;
|
||||
|
||||
use FOQ\ElasticaBundle\Repository;
|
||||
|
||||
/**
|
||||
* @author Richard Miller <info@limethinking.co.uk>
|
||||
*/
|
||||
class RepositoryTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
|
||||
public function testThatFindCallsFindOnFinder()
|
||||
{
|
||||
$testQuery = 'Test Query';
|
||||
|
||||
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$finderMock->expects($this->once())
|
||||
->method('find')
|
||||
->with($this->equalTo($testQuery));
|
||||
|
||||
$repository = new Repository($finderMock);
|
||||
$repository->find($testQuery);
|
||||
}
|
||||
|
||||
public function testThatFindPaginatedCallsFindPaginatedOnFinder()
|
||||
{
|
||||
$testQuery = 'Test Query';
|
||||
|
||||
$finderMock = $this->getMockBuilder('FOQ\ElasticaBundle\Finder\TransformedFinder')
|
||||
->disableOriginalConstructor()
|
||||
->getMock();
|
||||
$finderMock->expects($this->once())
|
||||
->method('findPaginated')
|
||||
->with($this->equalTo($testQuery));
|
||||
|
||||
$repository = new Repository($finderMock);
|
||||
$repository->findPaginated($testQuery);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue