protected function setUp()
 {
     self::bootKernel(array('prepare_doctrine' => true));
     $manager = $this->getEntityManager();
     for ($i = 1; $i <= 50; $i++) {
         $entity = new TraitsEntity();
         $entity->setTitle(sprintf('Title %s', $i));
         $entity->setSummary(sprintf('Summary %s', $i));
         $manager->persist($entity);
     }
     $manager->flush();
 }
Пример #2
0
 public function testTimestamp()
 {
     $entity = new TraitsEntity();
     $this->assertNull($entity->getCreated());
     $this->assertNull($entity->getUpdated());
     $manager = $this->getEntityManager();
     $manager->persist($entity);
     $manager->flush();
     $this->assertInstanceOf('\\DateTime', $entity->getCreated());
     $this->assertInstanceOf('\\DateTime', $entity->getUpdated());
     $this->assertNotNull($entity->getId());
     $id = $entity->getId();
     /** @var TraitsEntity $entity */
     $entity = $manager->getRepository('\\Kyoushu\\CommonBundle\\Tests\\Entity\\TraitsEntity')->find($id);
     $this->assertNotNull($entity);
     $this->assertInstanceOf('\\DateTime', $entity->getCreated());
     $this->assertInstanceOf('\\DateTime', $entity->getUpdated());
 }