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()); }