File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
tests/Gedmo/SoftDeleteable Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff 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 */
You can’t perform that action at this time.
0 commit comments