本文整理汇总了PHP中TestManager::getRepository方法的典型用法代码示例。如果您正苦于以下问题:PHP TestManager::getRepository方法的具体用法?PHP TestManager::getRepository怎么用?PHP TestManager::getRepository使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestManager
的用法示例。
在下文中一共展示了TestManager::getRepository方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test__construct
public function test__construct()
{
$metadata = new ClassMetadata(__NAMESPACE__ . '\\ModelTest');
$metadata->addModel('entity', __NAMESPACE__ . '\\EntityTest');
$metadata->setIdentifier('entity', 'id');
$metadataFactory = $this->getMock('Pok\\PoolDBM\\Mapping\\ClassMetadataFactory', array('getMetadataFor', 'setModelManager'));
$metadataFactory->expects($this->any())->method('getMetadataFor')->will($this->returnValue($metadata));
$refl = new \ReflectionClass('Pok\\PoolDBM\\Manager\\BaseManager');
$this->assertTrue($refl->isInstantiable());
$pool = new Pool();
$pool->addManager('entity', new EntityManager());
$manager = new TestManager(__NAMESPACE__ . '\\ModelTest', new ModelManager($pool, $metadataFactory));
$this->assertInstanceOf('Pok\\PoolDBM\\ModelRepository', $manager->getRepository($manager));
$this->assertInstanceOf(__NAMESPACE__ . '\\ModelTest', $manager->create());
$manager->save(new ModelTest());
$manager->save(new ModelTest(), true);
try {
$manager->save(new \stdClass());
} catch (\RuntimeException $e) {
$this->assertEquals('Manager "Pok\\PoolDBM\\Tests\\Manager\\TestManager" is unable to save model "stdClass"', $e->getMessage());
}
$manager->clear();
$this->assertInstanceOf(__NAMESPACE__ . '\\ModelTest', $manager->find(null));
$this->assertEquals(1, count($manager->findBy(array())));
$this->assertInstanceOf(__NAMESPACE__ . '\\ModelTest', $manager->findOneBy(array()));
$this->assertEquals(1, count($manager->findAll()));
}