Ejemplo n.º 1
0
 /**
  * @param TestEntity $entity
  * @param string $expectedText
  */
 private function assertTextInReloadedEntityEquals(TestEntity $entity, $expectedText)
 {
     /* @var $reloadedEntity TestEntity */
     $reloadedEntity = $this->infrastructure->getRepository($entity)->find($entity->getId());
     $loadedText = $reloadedEntity->getText();
     $this->assertInstanceOf('\\Webfactory\\Bundle\\PolyglotBundle\\TranslatableInterface', $loadedText);
     $this->assertSame($expectedText, $loadedText->__toString());
 }
 /**
  * Ensures that the infrastructure logs queries, which are executed after an import.
  */
 public function testInfrastructureLogsQueriesThatAreExecutedAfterImport()
 {
     $entity = new TestEntity();
     $this->infrastructure->import($entity);
     $repository = $this->infrastructure->getRepository($entity);
     $repository->find(42);
     $queries = $this->infrastructure->getQueries();
     $this->assertInternalType('array', $queries);
     $this->assertCount(1, $queries);
 }
 /**
  * Ensures that different infrastructure instances provide database isolation.
  */
 public function testDifferentInfrastructureInstancesUseSeparatedDatabases()
 {
     $entity = new TestEntity();
     $anotherInfrastructure = new ORMInfrastructure(array('Webfactory\\Doctrine\\ORMTestInfrastructure\\ORMInfrastructureTest\\TestEntity'));
     $repository = $anotherInfrastructure->getRepository($entity);
     $this->infrastructure->import($entity);
     // Entity must not be visible in the scope of another infrastructure.
     $entities = $repository->findAll();
     $this->assertCount(0, $entities);
 }