/** * Test what happens when two initializers try to create the same base path. */ public function testInitializerTwice() { $initializer = new GenericInitializer('test', array('/test/path')); /** @var ManagerRegistry $registry */ $registry = $this->getContainer()->get('doctrine_phpcr'); $initializer->init($registry); $initializer->init($registry); $registry->getConnection()->save(); }
/** * @dataProvider provideInitializer */ public function testInitializer($name, $basePaths, $cnd) { $this->registry->expects($this->once())->method('getConnection')->will($this->returnValue($this->session)); if ($cnd) { $this->session->expects($this->once())->method('getWorkspace')->will($this->returnValue($this->workspace)); $this->workspace->expects($this->once())->method('getNodeTypeManager')->will($this->returnValue($this->nodeTypeManager)); $this->nodeTypeManager->expects($this->once())->method('registerNodeTypesCnd')->with($cnd); } if ($basePaths) { $this->node->expects($this->any())->method('addNode')->will($this->returnValue($this->node)); $this->session->expects($this->exactly(count($basePaths)))->method('getRootNode')->will($this->returnValue($this->node)); } $initializer = new GenericInitializer($name, $basePaths, $cnd); $initializer->init($this->registry); $this->assertEquals($name, $initializer->getName()); }