/** * @test */ public function shouldSoftlyDeleteIfColumnNameDifferFromPropertyName() { $repo = $this->em->getRepository(self::USER_CLASS); $newUser = new User(); $username = '******'; $newUser->setUsername($username); $this->em->persist($newUser); $this->em->flush(); $user = $repo->findOneBy(array('username' => $username)); $this->assertNull($user->getDeletedAt()); $this->em->remove($user); $this->em->flush(); $user = $repo->findOneBy(array('username' => $username)); $this->assertNull($user); }
public function testSoftDeleteableFilter() { $filter = $this->em->getFilters()->enable(self::SOFT_DELETEABLE_FILTER_NAME); $filter->disableForEntity(self::USER_CLASS); $repo = $this->em->getRepository(self::USER_CLASS); $newUser = new User(); $username = '******'; $newUser->setUsername($username); $this->em->persist($newUser); $this->em->flush(); $user = $repo->findOneBy(array('username' => $username)); $this->assertNull($user->getDeletedAt()); $this->em->remove($user); $this->em->flush(); $user = $repo->findOneBy(array('username' => $username)); $this->assertNotNull($user->getDeletedAt()); $filter->enableForEntity(self::USER_CLASS); $user = $repo->findOneBy(array('username' => $username)); $this->assertNull($user); }