| @@ 115-125 (lines=11) @@ | ||
| 112 | $this->assertEquals($user->username, $userNew->username); |
|
| 113 | } |
|
| 114 | ||
| 115 | public function testUpdate2() |
|
| 116 | { |
|
| 117 | $user = $this->dm->find($this->type, 1); |
|
| 118 | $user->username = "new-name"; |
|
| 119 | ||
| 120 | $this->dm->flush(); |
|
| 121 | $this->dm->clear(); |
|
| 122 | ||
| 123 | $newUser = $this->dm->find($this->type, 1); |
|
| 124 | $this->assertEquals('new-name', $newUser->username); |
|
| 125 | } |
|
| 126 | ||
| 127 | public function testRemove() |
|
| 128 | { |
|
| @@ 171-182 (lines=12) @@ | ||
| 168 | $user = $this->dm->find($this->type.'2', 1); |
|
| 169 | } |
|
| 170 | ||
| 171 | public function testNullConversionHandledAutomatically() |
|
| 172 | { |
|
| 173 | $user1 = $this->dm->find($this->type, 1); |
|
| 174 | $user1->username = null; |
|
| 175 | ||
| 176 | $this->dm->flush(); |
|
| 177 | $this->dm->clear(); |
|
| 178 | ||
| 179 | $pUser1 = $this->dm->find($this->type, 1); |
|
| 180 | ||
| 181 | $this->assertNull($pUser1->username); |
|
| 182 | } |
|
| 183 | ||
| 184 | public function testFindWrongTypesDoesNotMessUnitOfWork() |
|
| 185 | { |
|
| @@ 127-138 (lines=12) @@ | ||
| 124 | /** |
|
| 125 | * @group GH-80 |
|
| 126 | */ |
|
| 127 | public function testEmptyStringInEmbeddedDocument() |
|
| 128 | { |
|
| 129 | $user = $this->dm->find('Doctrine\Tests\Models\CMS\CmsUser', $this->userId); |
|
| 130 | $user->address->street = ""; |
|
| 131 | ||
| 132 | $this->dm->flush(); |
|
| 133 | $this->dm->clear(); |
|
| 134 | ||
| 135 | $user = $this->dm->find('Doctrine\Tests\Models\CMS\CmsUser', $user->id); |
|
| 136 | ||
| 137 | $this->assertEquals("", $user->address->street); |
|
| 138 | } |
|
| 139 | } |
|
| 140 | ||
| 141 | class PreUpdateSubscriber2 implements EventSubscriber |
|