本文整理汇总了PHP中Doctrine\Tests\OrmFunctionalTestCase::setUp方法的典型用法代码示例。如果您正苦于以下问题:PHP OrmFunctionalTestCase::setUp方法的具体用法?PHP OrmFunctionalTestCase::setUp怎么用?PHP OrmFunctionalTestCase::setUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Doctrine\Tests\OrmFunctionalTestCase
的用法示例。
在下文中一共展示了OrmFunctionalTestCase::setUp方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->useModelSet('vct_onetomany_extralazy');
parent::setUp();
$inversed = new Entity\InversedOneToManyExtraLazyEntity();
$inversed->id1 = 'abc';
$owning1 = new Entity\OwningManyToOneExtraLazyEntity();
$owning1->id2 = 'def';
$owning2 = new Entity\OwningManyToOneExtraLazyEntity();
$owning2->id2 = 'ghi';
$owning3 = new Entity\OwningManyToOneExtraLazyEntity();
$owning3->id2 = 'jkl';
$inversed->associatedEntities->add($owning1);
$owning1->associatedEntity = $inversed;
$inversed->associatedEntities->add($owning2);
$owning2->associatedEntity = $inversed;
$inversed->associatedEntities->add($owning3);
$owning3->associatedEntity = $inversed;
$this->_em->persist($inversed);
$this->_em->persist($owning1);
$this->_em->persist($owning2);
$this->_em->persist($owning3);
$this->_em->flush();
$this->_em->clear();
}
示例2: setUp
protected function setUp()
{
$this->enableSecondLevelCache();
parent::setUp();
$targetPersister = $this->_em->getUnitOfWork()->getEntityPersister(City::CLASSNAME);
$this->structure = new DefaultCollectionHydrator($this->_em, $targetPersister);
}
示例3: setUp
protected function setUp()
{
$this->enableSecondLevelCache();
$this->useModelSet('cache');
parent::setUp();
$this->cache = $this->_em->getCache();
}
示例4: setUp
protected function setUp()
{
parent::setUp();
if (\extension_loaded('memcache') && @fsockopen('localhost', 11211)) {
$memcache = new \Memcache();
$memcache->addServer('localhost');
$memcache->flush();
$cacheDriver = new \Doctrine\Common\Cache\MemcacheCache();
$cacheDriver->setMemcache($memcache);
$this->_em->getMetadataFactory()->setCacheDriver($cacheDriver);
} else {
if (\extension_loaded('apc')) {
$this->_em->getMetadataFactory()->setCacheDriver(new \Doctrine\Common\Cache\ApcCache());
} else {
$this->markTestSkipped('Test only works with a cache enabled.');
}
}
try {
$this->_schemaTool->createSchema(array($this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC742User'), $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC742Comment')));
} catch (\Exception $e) {
}
// make sure classes will be deserialized from caches
$this->_em->getMetadataFactory()->setMetadataFor(__NAMESPACE__ . '\\DDC742User', null);
$this->_em->getMetadataFactory()->setMetadataFor(__NAMESPACE__ . '\\DDC742Comment', null);
}
示例5: setUp
protected function setUp()
{
$this->useModelSet('taxi');
parent::setUp();
list($bimmer, $crysler, $merc, $volvo) = $this->createCars('Doctrine\\Tests\\Models\\Taxi\\Car');
list($john, $foo) = $this->createDrivers('Doctrine\\Tests\\Models\\Taxi\\Driver');
$this->_em->flush();
$ride1 = new Ride($john, $bimmer);
$ride2 = new Ride($john, $merc);
$ride3 = new Ride($john, $volvo);
$ride4 = new Ride($foo, $merc);
$this->_em->persist($ride1);
$this->_em->persist($ride2);
$this->_em->persist($ride3);
$this->_em->persist($ride4);
$ride5 = new PaidRide($john, $bimmer);
$ride5->setFare(10.5);
$ride6 = new PaidRide($john, $merc);
$ride6->setFare(16.0);
$ride7 = new PaidRide($john, $volvo);
$ride7->setFare(20.7);
$ride8 = new PaidRide($foo, $merc);
$ride8->setFare(32.15);
$this->_em->persist($ride5);
$this->_em->persist($ride6);
$this->_em->persist($ride7);
$this->_em->persist($ride8);
$this->_em->flush();
}
示例6: setUp
protected function setUp()
{
$this->useModelSet('ecommerce');
$this->useModelSet('company');
parent::setUp();
$this->_factory = new ProxyFactory($this->_em, __DIR__ . '/../../Proxies', 'Doctrine\\Tests\\Proxies', true);
}
示例7: setUp
public function setUp()
{
$this->useModelSet('cms');
parent::setUp();
$user1 = new CmsUser();
$user1->username = "beberlei";
$user1->name = "Benjamin";
$user1->status = "active";
$group1 = new CmsGroup();
$group1->name = "test";
$group2 = new CmsGroup();
$group2->name = "test";
$user1->addGroup($group1);
$user1->addGroup($group2);
$user2 = new CmsUser();
$user2->username = "romanb";
$user2->name = "Roman";
$user2->status = "active";
$this->_em->persist($user1);
$this->_em->persist($user2);
$this->_em->persist($group1);
$this->_em->persist($group2);
$this->_em->flush();
$this->_em->clear();
$this->user1 = $this->_em->find(get_class($user1), $user1->id);
$this->user2 = $this->_em->find(get_class($user1), $user2->id);
}
示例8: setUp
protected function setUp()
{
parent::setUp();
DDC2494TinyIntType::$calls = array();
Type::addType('ddc2494_tinyint', __NAMESPACE__ . '\\DDC2494TinyIntType');
$this->_schemaTool->createSchema(array($this->_em->getClassMetadata(DDC2494Currency::CLASSNAME), $this->_em->getClassMetadata(DDC2494Campaign::CLASSNAME)));
}
示例9: setUp
protected function setUp()
{
parent::setUp();
$this->_schemaTool->createSchema(array($this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC2575Root'), $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC2575A'), $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC2575B')));
$entityRoot1 = new DDC2575Root(1);
$entityB1 = new DDC2575B(2);
$entityA1 = new DDC2575A($entityRoot1, $entityB1);
$this->_em->persist($entityRoot1);
$this->_em->persist($entityA1);
$this->_em->persist($entityB1);
$entityRoot2 = new DDC2575Root(3);
$entityB2 = new DDC2575B(4);
$entityA2 = new DDC2575A($entityRoot2, $entityB2);
$this->_em->persist($entityRoot2);
$this->_em->persist($entityA2);
$this->_em->persist($entityB2);
$this->_em->flush();
$this->rootsEntities[] = $entityRoot1;
$this->rootsEntities[] = $entityRoot2;
$this->aEntities[] = $entityA1;
$this->aEntities[] = $entityA2;
$this->bEntities[] = $entityB1;
$this->bEntities[] = $entityB2;
$this->_em->clear();
}
示例10: setUp
protected function setUp()
{
$this->cacheDataReflection = new \ReflectionProperty("Doctrine\\Common\\Cache\\ArrayCache", "data");
$this->cacheDataReflection->setAccessible(true);
$this->useModelSet('cms');
parent::setUp();
}
示例11: setUp
protected function setUp()
{
$this->useModelSet('cms');
$this->useModelSet('company');
parent::setUp();
$this->platform = $this->_em->getConnection()->getDatabasePlatform();
}
示例12: setUp
protected function setUp()
{
parent::setUp();
Type::addType(DDC2012TsVectorType::MYTYPE, __NAMESPACE__ . '\\DDC2012TsVectorType');
DDC2012TsVectorType::$calls = array();
$this->_schemaTool->createSchema(array($this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC2012Item'), $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC2012ItemPerson')));
}
示例13: setUp
protected function setUp()
{
parent::setUp();
if ($this->_em->getConnection()->getDatabasePlatform()->getName() !== 'postgresql') {
$this->markTestSkipped('The ' . __CLASS__ . ' requires the use of postgresql.');
}
}
示例14: setUp
protected function setUp()
{
parent::setUp();
try {
$this->_schemaTool->createSchema(array($this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1400Article'), $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1400User'), $this->_em->getClassMetadata(__NAMESPACE__ . '\\DDC1400UserState')));
} catch (\Exception $ignored) {
}
}
示例15: setUp
protected function setUp()
{
parent::setUp();
try {
$this->_schemaTool->createSchema(array($this->_em->getClassMetadata(__NAMESPACE__ . '\\PersistentCollectionHolder'), $this->_em->getClassMetadata(__NAMESPACE__ . '\\PersistentCollectionContent')));
} catch (\Exception $e) {
}
}