Skip to content

Commit 13a3eb5

Browse files
author
NatePage
committed
Created test to ensure backwards compatibility.
1 parent 074b1c9 commit 13a3eb5

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

tests/Gedmo/SoftDeleteable/SoftDeleteableEntityTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,33 @@ public function shouldBeAbleToHardDeleteSoftdeletedItems()
7878
$this->assertNull($user);
7979
}
8080

81+
/**
82+
* @test
83+
*/
84+
public function shouldNeedToClearEntityManagerNotToFetchSoftDeletedItemById()
85+
{
86+
$repo = $this->em->getRepository(self::USER_CLASS);
87+
88+
$newUser = new User();
89+
$newUser->setUsername($username = 'test_user');
90+
91+
$this->em->persist($newUser);
92+
$this->em->flush();
93+
94+
$userId = $newUser->getId();
95+
96+
$this->em->remove($newUser);
97+
$this->em->flush();
98+
99+
$user = $repo->find($userId);
100+
$this->assertInstanceOf(self::USER_CLASS, $user);
101+
102+
$this->em->clear();
103+
104+
$user = $repo->find($userId);
105+
$this->assertNull($user);
106+
}
107+
81108
/**
82109
* @test
83110
*/

0 commit comments

Comments
 (0)