public function testDateWithPrePersist() { // Given $user = new BaseUser(); $today = new \DateTime(); // When $user->prePersist(); // Then $this->assertTrue($user->getCreatedAt() instanceof \DateTime, 'Should contain a DateTime object'); $this->assertEquals($today->format('Y-m-d'), $user->getUpdatedAt()->format('Y-m-d'), 'Should be created today'); $this->assertTrue($user->getUpdatedAt() instanceof \DateTime, 'Should contain a DateTime object'); $this->assertEquals($today->format('Y-m-d'), $user->getUpdatedAt()->format('Y-m-d'), 'Should be updated today'); }