@@ 75-95 (lines=21) @@ | ||
72 | $this->assertFalse($this->dm->contains($group2)); |
|
73 | } |
|
74 | ||
75 | public function testCascadeRemoveSingleDocument() |
|
76 | { |
|
77 | $user = new \Doctrine\Tests\Models\CMS\CmsUser(); |
|
78 | $user->username = "beberlei"; |
|
79 | $user->name = "Benjamin"; |
|
80 | ||
81 | $article = new \Doctrine\Tests\Models\CMS\CmsArticle(); |
|
82 | $article->text = "foo"; |
|
83 | $article->topic = "bar"; |
|
84 | $article->user = $user; |
|
85 | ||
86 | $this->dm->persist($article); |
|
87 | $this->dm->persist($user); |
|
88 | $this->dm->flush(); |
|
89 | ||
90 | $this->dm->remove($article); |
|
91 | $this->dm->flush(); |
|
92 | ||
93 | $this->assertFalse($this->dm->contains($user)); |
|
94 | $this->assertFalse($this->dm->contains($article)); |
|
95 | } |
|
96 | } |
@@ 152-169 (lines=18) @@ | ||
149 | $this->assertEquals('beberlei0', $users[0]->username); |
|
150 | } |
|
151 | ||
152 | public function testFindByIdUsesIdentityMap() |
|
153 | { |
|
154 | $this->dm = $this->createDocumentManager(); |
|
155 | ||
156 | $user = new \Doctrine\Tests\Models\CMS\CmsUser(); |
|
157 | $user->username = "beberlei"; |
|
158 | $user->status = "active"; |
|
159 | $user->name = "Benjamin"; |
|
160 | ||
161 | $this->dm->persist($user); |
|
162 | $this->dm->flush(); |
|
163 | $this->dm->clear(); |
|
164 | ||
165 | $user1 = $this->dm->getRepository('Doctrine\Tests\Models\CMS\CmsUser')->find($user->id); |
|
166 | $user2 = $this->dm->getRepository('Doctrine\Tests\Models\CMS\CmsUser')->find($user->id); |
|
167 | ||
168 | $this->assertSame($user1, $user2); |
|
169 | } |
|
170 | ||
171 | public function testFindByReusesIdentities() |
|
172 | { |