Esempio n. 1
0
 public function purge()
 {
     $this->purger->setPurgeMode(ORMPurger::PURGE_MODE_TRUNCATE);
     $this->purger->purge();
     // Ensure to close the connection to avoid mysql timeout
     $em = $this->managerRegistry->getManager();
     $em->clear();
     $em->getConnection()->close();
 }
Esempio n. 2
0
 public function it_should_not_truncate_an_embedded_entity()
 {
     $this->given($metadataMock1 = $this->mockClassMetadataInfo(false, 'realTable'), $metadataMock2 = $this->mockClassMetadataInfo(true, 'embededTable'), $doctrineConnectionMock = $this->mockDoctrineConnection(), $classMetadataFactoryMock = $this->mockClassMetadataFactory(array($metadataMock1, $metadataMock2)), $managerMock = $this->mockEntityManager($classMetadataFactoryMock, $doctrineConnectionMock), $managerRegistryMock = $this->mockManagerRegistry($managerMock), $testedClass = new TestedClass($managerRegistryMock))->when($testedClass->purge())->then($this->mock($doctrineConnectionMock)->call('executeUpdate')->once());
 }