public function setUp() { parent::setUp(); $this->ids = array(); $groupA = new Group('groupA'); $groupB = new Group('groupB'); $profile = new Profile(); $profile->setFirstname('Timothy'); $tim = new User(); $tim->setUsername('Tim'); $tim->setHits(10); $tim->addGroup($groupA); $tim->addGroup($groupB); $tim->setProfile($profile); $this->dm->persist($tim); $john = new User(); $john->setUsername('John'); $john->setHits(10); $this->dm->persist($john); $this->dm->flush(); $this->dm->clear(); $this->ids['tim'] = $tim->getId(); $this->ids['john'] = $john->getId(); $this->fc = $this->dm->getFilterCollection(); }
public function setUp() { parent::setUp(); $this->factory = new ClassMetadataFactory(); $this->factory->setDocumentManager($this->dm); $this->factory->setConfiguration($this->dm->getConfiguration()); }
public function setUp() { parent::setUp(); $this->classMetadata = $this->dm->getClassMetadata('Documents\\User'); $this->persister = $this->getMock('Doctrine\\ODM\\MongoDB\\Persisters\\BasicDocumentPersister', array('update', 'delete', 'executeInserts'), array($this->dm, $this->classMetadata)); $this->dm->getUnitOfWork()->setDocumentPersister('Documents\\User', $this->persister); }
public function setUp() { parent::setUp(); $user1 = new CmsUser(); $user1->username = "******"; $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 = "******"; $user2->name = "Roman"; $user2->status = "active"; $this->dm->persist($user1); $this->dm->persist($user2); $this->dm->persist($group1); $this->dm->persist($group2); $this->dm->flush(); $this->dm->clear(); $this->user1 = $this->dm->find(get_class($user1), $user1->id); $this->user2 = $this->dm->find(get_class($user1), $user2->id); }
public function setUp() { parent::setUp(); $class = \Documents\Sharded\ShardedOne::class; $this->skipTestIfNotSharded($class); $schemaManager = $this->dm->getSchemaManager(); $schemaManager->ensureDocumentSharding($class); }
public function setUp() { parent::setUp(); $this->listener = new MODM166EventListener(); $evm = $this->dm->getEventManager(); $evm->addEventListener(Events::onFlush, $this->listener); return $this->dm; }
public function setUp() { parent::setUp(); $this->user = new User(); $this->user->setUsername('boo'); $this->dm->persist($this->user); $this->dm->flush(); }
public function setUp() { parent::setUp(); $this->pb = $this->dm->getUnitOfWork()->getPersistenceBuilder(); $this->object = new ReferencedObject(); $this->dm->persist($this->object); $this->dm->flush(); }
public function setUp() { parent::setUp(); $user = new User(); $user->addGroup(new Group('Test')); $this->dm->persist($user); $this->dm->flush(); $this->dm->clear(); }
public function setUp() { parent::setUp(); $this->dm->getFilterCollection()->enable('testFilter'); $filter = $this->dm->getFilterCollection()->getFilter('testFilter'); $filter->setParameter('class', __NAMESPACE__ . '\\GH596Document'); $filter->setParameter('field', 'deleted'); $filter->setParameter('value', false); }
public function setUp() { parent::setUp(); $this->user = new User(); $this->user->setUsername('w00ting'); $this->dm->persist($this->user); $this->dm->flush(); $this->repository = $this->dm->getRepository('Documents\\User'); }
public function setUp() { parent::setUp(); $this->dm->getSchemaManager()->ensureDocumentIndexes(__NAMESPACE__ . '\\CommentableAction'); $this->dm->getSchemaManager()->ensureDocumentIndexes(__NAMESPACE__ . '\\GroupMainActivityStreamItem'); $this->dm->getSchemaManager()->ensureDocumentIndexes(__NAMESPACE__ . '\\GroupMembersActivityStreamItem'); $this->dm->getSchemaManager()->ensureDocumentIndexes(__NAMESPACE__ . '\\UserDashboardActivityStreamItem'); $this->dm->getSchemaManager()->ensureDocumentIndexes(__NAMESPACE__ . '\\UserProfileActivityStreamItem'); }
public function setUp() { parent::setUp(); $this->tmpDir = sys_get_temp_dir(); // We create a temporary directory for each test $this->testBucket = uniqid("doctrine_mongo_odm_"); $this->testBucketPath = $this->tmpDir . DIRECTORY_SEPARATOR . $this->testBucket; mkdir($this->testBucketPath); $this->generator = new DocumentRepositoryGenerator(); }
public function setUp() { parent::setUp(); $this->namespace = uniqid("doctrine_"); $this->tmpDir = \sys_get_temp_dir(); \mkdir($this->tmpDir . \DIRECTORY_SEPARATOR . $this->namespace); $this->generator = new DocumentGenerator(); $this->generator->setGenerateAnnotations(true); $this->generator->setGenerateStubMethods(true); $this->generator->setRegenerateDocumentIfExists(false); $this->generator->setUpdateDocumentIfExists(true); }
public function setUp() { parent::setUp(); $this->class = DocumentPersisterTestDocument::class; $collection = $this->dm->getDocumentCollection($this->class); $collection->drop(); foreach (array('a', 'b', 'c', 'd') as $name) { $document = array('dbName' => $name); $collection->insert($document); } $this->documentPersister = $this->uow->getDocumentPersister($this->class); }
public function setUp() { if (version_compare(phpversion('mongo'), '1.3.0', '<')) { $this->markTestSkipped('This test is not applicable to driver versions < 1.3.0'); } parent::setUp(); $user = new User(); $user->addGroup(new Group('Test')); $this->dm->persist($user); $this->dm->flush(); $this->dm->clear(); }
public function setUp() { parent::setUp(); $document = array('test' => 'test'); $this->dm->getDocumentCollection('Doctrine\\ODM\\MongoDB\\Tests\\Functional\\EagerTestDocument')->insert($document); $this->document = new EagerTestDocument(); $this->document->id = (string) $document['_id']; $this->document->test = 'test'; $qb = $this->dm->createQueryBuilder('Doctrine\\ODM\\MongoDB\\Tests\\Functional\\EagerTestDocument'); $qb->eagerCursor(true); $this->test = $qb->getQuery()->execute(); }
/** * {@inheritdoc} */ public function setUp() { parent::setUp(); $firstParent = new GH1229Parent(); $this->dm->persist($firstParent); $secondParent = new GH1229Parent(); $this->dm->persist($secondParent); $firstParent->addChild(new GH1229Child('type a')); $firstParent->addChild(new GH1229ChildTypeB('type b')); $this->dm->flush(); $this->dm->clear(); $this->firstParentId = $firstParent->id; $this->secondParentId = $secondParent->id; }
public function setUp() { parent::setUp(); $currencies = array('USD' => 1, 'EURO' => 1.7, 'JPN' => 0.0125); foreach ($currencies as $name => &$multiplier) { $multiplier = new Currency($name, $multiplier); $this->dm->persist($multiplier); } $stockItems = array(new StockItem('stock_item_0', new Money(9.99 * 0 + 5, $currencies['USD']), 5), new StockItem('stock_item_1', new Money(9.99 * 1 + 5, $currencies['USD']), 15 * 1 - 4), new StockItem('stock_item_2', new Money(9.99 * 2 + 5, $currencies['USD']), 15 * 2 - 4), new StockItem('stock_item_3', new Money(9.99 * 3 + 5, $currencies['USD']), 15 * 3 - 4), new StockItem('stock_item_4', new Money(9.99 * 4 + 5, $currencies['USD']), 15 * 4 - 4), new StockItem('stock_item_5', new Money(9.99 * 5 + 5, $currencies['USD']), 15 * 5 - 4), new StockItem('stock_item_6', new Money(9.99 * 6 + 5, $currencies['USD']), 15 * 6 - 4), new StockItem('stock_item_7', new Money(9.99 * 7 + 5, $currencies['USD']), 15 * 7 - 4), new StockItem('stock_item_8', new Money(9.99 * 8 + 5, $currencies['USD']), 15 * 8 - 4), new StockItem('stock_item_9', new Money(9.99 * 9 + 5, $currencies['USD']), 15 * 9 - 4)); $options = array(new Option('option_0', new Money(13.99, $currencies['USD']), $stockItems[0]), new Option('option_1', new Money(14.99, $currencies['USD']), $stockItems[1]), new Option('option_2', new Money(15.99, $currencies['USD']), $stockItems[2]), new Option('option_3', new Money(16.99, $currencies['USD']), $stockItems[3]), new Option('option_4', new Money(17.99, $currencies['USD']), $stockItems[4]), new Option('option_5', new Money(18.99, $currencies['USD']), $stockItems[5]), new Option('option_6', new Money(19.99, $currencies['USD']), $stockItems[6]), new Option('option_7', new Money(20.99, $currencies['USD']), $stockItems[7]), new Option('option_8', new Money(21.99, $currencies['USD']), $stockItems[8]), new Option('option_9', new Money(22.99, $currencies['USD']), $stockItems[9])); $products = array(new ConfigurableProduct('product_0'), new ConfigurableProduct('product_1'), new ConfigurableProduct('product_2'), new ConfigurableProduct('product_3'), new ConfigurableProduct('product_4'), new ConfigurableProduct('product_5'), new ConfigurableProduct('product_6'), new ConfigurableProduct('product_7'), new ConfigurableProduct('product_8'), new ConfigurableProduct('product_9')); $products[0]->addOption($options[0]); $products[0]->addOption($options[4]); $products[0]->addOption($options[6]); $products[1]->addOption($options[1]); $products[1]->addOption($options[2]); $products[1]->addOption($options[5]); $products[1]->addOption($options[7]); $products[1]->addOption($options[8]); $products[2]->addOption($options[3]); $products[2]->addOption($options[5]); $products[2]->addOption($options[7]); $products[2]->addOption($options[9]); $products[3]->addOption($options[0]); $products[3]->addOption($options[1]); $products[3]->addOption($options[2]); $products[3]->addOption($options[3]); $products[3]->addOption($options[4]); $products[3]->addOption($options[5]); $products[4]->addOption($options[4]); $products[4]->addOption($options[7]); $products[4]->addOption($options[2]); $products[4]->addOption($options[8]); $products[5]->addOption($options[9]); $products[6]->addOption($options[7]); $products[6]->addOption($options[8]); $products[6]->addOption($options[9]); $products[7]->addOption($options[4]); $products[7]->addOption($options[5]); $products[8]->addOption($options[2]); $products[9]->addOption($options[4]); $products[9]->addOption($options[3]); $products[9]->addOption($options[7]); foreach ($products as $product) { $this->dm->persist($product); } $this->dm->flush(); $this->dm->clear(); }
public function setUp() { parent::setUp(); $this->user = new User(); $this->user->setUsername('jwage'); $this->test = new SimpleReferenceUser(); $this->test->setName('test'); $this->test->setUser($this->user); $this->test->addUser($this->user); $this->test->addUser($this->user); $this->dm->persist($this->test); $this->dm->persist($this->user); $this->dm->flush(null, array('safe' => true)); $this->dm->clear(); }
public function setUp() { parent::setUp(); $currencies = array('USD' => 1, 'EURO' => 1.7, 'JPN' => 0.0125); foreach ($currencies as $name => &$multiplier) { $multiplier = new Currency($name, $multiplier); $this->dm->persist($multiplier); } $product = new ConfigurableProduct('T-Shirt'); $product->addOption(new Option('small', new Money(12.99, $currencies['USD']), new StockItem('T-shirt Size S', new Money(9.99, $currencies['USD']), 15))); $product->addOption(new Option('medium', new Money(14.99, $currencies['USD']), new StockItem('T-shirt Size M', new Money(11.99, $currencies['USD']), 15))); $product->addOption(new Option('large', new Money(17.99, $currencies['USD']), new StockItem('T-shirt Size L', new Money(13.99, $currencies['USD']), 15))); $this->dm->persist($product); $this->dm->flush(); foreach ($currencies as $currency) { $this->dm->detach($currency); } $this->dm->detach($product); unset($currencies, $product); }
public function setUp() { parent::setUp(); $this->dm->getSchemaManager()->ensureDocumentIndexes('Doctrine\\ODM\\MongoDB\\Tests\\Functional\\RequireIndexesDocument'); }
public function setUp() { parent::setUp(); $this->queryBuilder = $this->dm->createQueryBuilder('Documents\\Bars\\Bar'); $this->visitor = new QueryExpressionVisitor($this->queryBuilder); }
public function setUp() { parent::setUp(); $schemaManager = $this->dm->getSchemaManager(); $schemaManager->ensureDocumentSharding('Documents\\Sharded\\ShardedOne'); }
public function setUp() { parent::setUp(); }
public function setUp() { parent::setUp(); $this->pb = $this->dm->getUnitOfWork()->getPersistenceBuilder(); }
public function setUp() { parent::setUp(); $class = __NAMESPACE__ . '\\GH567Document'; $this->repository = $this->dm->getRepository($class); }
public function setUp() { parent::setUp(); $this->skipTestIfNotSharded(\Documents\Sharded\ShardedOne::class); }
public function setUp() { parent::setUp(); $this->listener = new ResolveTargetDocumentListener(); }