1
0
mirror of synced 2025-02-21 14:43:14 +03:00

Add missing methods to the mock

This commit is contained in:
Michaël Gallego 2014-01-04 19:11:55 +01:00 committed by Marco Pivetta
parent 7551b1ad00
commit 632382b069
3 changed files with 15 additions and 3 deletions

View File

@ -161,7 +161,7 @@ abstract class AbstractEntityPersister implements CachedEntityPersister
*/ */
public function getCountSQL($criteria = array()) public function getCountSQL($criteria = array())
{ {
return $this->persister->count($criteria); return $this->persister->getCountSQL($criteria);
} }
/** /**

View File

@ -23,6 +23,7 @@ use Closure;
use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection; use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\Criteria; use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\Selectable;
use Doctrine\ORM\Persisters\BasicEntityPersister; use Doctrine\ORM\Persisters\BasicEntityPersister;
/** /**
@ -31,7 +32,7 @@ use Doctrine\ORM\Persisters\BasicEntityPersister;
* @since 2.5 * @since 2.5
* @author Michaël Gallego <mic.gallego@gmail.com> * @author Michaël Gallego <mic.gallego@gmail.com>
*/ */
class LazyCriteriaCollection implements Collection class LazyCriteriaCollection implements Collection, Selectable
{ {
/** /**
* @var BasicEntityPersister * @var BasicEntityPersister
@ -354,4 +355,13 @@ class LazyCriteriaCollection implements Collection
$this->collection = new ArrayCollection($elements); $this->collection = new ArrayCollection($elements);
$this->initialized = true; $this->initialized = true;
} }
/**
* {@inheritDoc}
*/
function matching(Criteria $criteria)
{
$this->initialize();
return $this->collection->matching($criteria);
}
} }

View File

@ -55,6 +55,7 @@ abstract class AbstractEntityPersisterTest extends OrmTestCase
'getInserts', 'getInserts',
'getInsertSQL', 'getInsertSQL',
'getSelectSQL', 'getSelectSQL',
'getCountSQL',
'expandParameters', 'expandParameters',
'expandCriteriaParameters', 'expandCriteriaParameters',
'getSelectConditionStatementSQL', 'getSelectConditionStatementSQL',
@ -66,6 +67,7 @@ abstract class AbstractEntityPersisterTest extends OrmTestCase
'load', 'load',
'loadById', 'loadById',
'loadOneToOneEntity', 'loadOneToOneEntity',
'count',
'refresh', 'refresh',
'loadCriteria', 'loadCriteria',
'loadAll', 'loadAll',
@ -435,4 +437,4 @@ abstract class AbstractEntityPersisterTest extends OrmTestCase
$this->assertNull($persister->exists($entity, array())); $this->assertNull($persister->exists($entity, array()));
} }
} }