| @@ 230-249 (lines=20) @@ | ||
| 227 | return $dm; |
|
| 228 | } |
|
| 229 | ||
| 230 | public function testLoadAssociationWithoutObject() |
|
| 231 | { |
|
| 232 | $em = $this->getEntityManager(); |
|
| 233 | ||
| 234 | $em->expects($this->once()) |
|
| 235 | ->method('persist'); |
|
| 236 | ||
| 237 | $em->expects($this->once()) |
|
| 238 | ->method('getReference'); |
|
| 239 | ||
| 240 | $writer = new DoctrineWriter($em, 'DdeboerPort:TestEntity'); |
|
| 241 | ||
| 242 | $item = array( |
|
| 243 | 'firstProperty' => 'some value', |
|
| 244 | 'secondProperty' => 'some other value', |
|
| 245 | 'firstAssociation' => 'firstAssociationId' |
|
| 246 | ); |
|
| 247 | ||
| 248 | $writer->writeItem($item); |
|
| 249 | } |
|
| 250 | ||
| 251 | public function testLoadAssociationWithPresetObject() |
|
| 252 | { |
|
| @@ 251-271 (lines=21) @@ | ||
| 248 | $writer->writeItem($item); |
|
| 249 | } |
|
| 250 | ||
| 251 | public function testLoadAssociationWithPresetObject() |
|
| 252 | { |
|
| 253 | $em = $this->getEntityManager(); |
|
| 254 | ||
| 255 | $em->expects($this->once()) |
|
| 256 | ->method('persist'); |
|
| 257 | ||
| 258 | $em->expects($this->never()) |
|
| 259 | ->method('getReference'); |
|
| 260 | ||
| 261 | $writer = new DoctrineWriter($em, 'DdeboerPort:TestEntity'); |
|
| 262 | ||
| 263 | $association = new TestEntity(); |
|
| 264 | $item = array( |
|
| 265 | 'firstProperty' => 'some value', |
|
| 266 | 'secondProperty' => 'some other value', |
|
| 267 | 'firstAssociation' => $association, |
|
| 268 | ); |
|
| 269 | ||
| 270 | $writer->writeItem($item); |
|
| 271 | } |
|
| 272 | ||
| 273 | /** |
|
| 274 | * Test to make sure that we are clearing the write entity |
|