1
0
mirror of synced 2024-12-15 23:56:02 +03:00
doctrine2/tests/lib/mocks/Doctrine_EntityManagerMock.php

50 lines
1.2 KiB
PHP
Raw Normal View History

<?php
require_once 'lib/mocks/Doctrine_EntityPersisterMock.php';
class Doctrine_EntityManagerMock extends Doctrine_EntityManager
{
private $_persisterMock;
/**
* Enter description here...
*
* @param unknown_type $entityName
* @override
*/
public function getEntityPersister($entityName)
{
return $this->_persisterMock;
}
/* Mock API */
public function setEntityPersister($persister)
{
$this->_persisterMock = $persister;
}
2008-09-07 17:48:40 +04:00
/**
* Mock factory method.
*
* @param unknown_type $conn
* @param unknown_type $name
* @param Doctrine_Configuration $config
* @param Doctrine_EventManager $eventManager
* @return unknown
*/
2008-09-12 14:58:33 +04:00
public static function create($conn, $name, Doctrine_Common_Configuration $config = null,
2008-09-12 14:55:06 +04:00
Doctrine_Common_EventManager $eventManager = null)
2008-09-07 17:48:40 +04:00
{
if (is_null($config)) {
2008-09-12 14:58:33 +04:00
$config = new Doctrine_Common_Configuration();
2008-09-07 17:48:40 +04:00
}
if (is_null($eventManager)) {
2008-09-12 14:55:06 +04:00
$eventManager = new Doctrine_Common_EventManager();
2008-09-07 17:48:40 +04:00
}
return new Doctrine_EntityManagerMock($conn, $name, $config, $eventManager);
}
}
?>