Conditions | 1 |
Paths | 1 |
Total Lines | 27 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
19 | public function testFetchingOfOneToOneRelations() : void |
||
20 | { |
||
21 | $initialCustomer = new GH6638Customer(); |
||
22 | |||
23 | $initialCart = new GH6638Cart(); |
||
24 | $initialCustomer->cart = $initialCart; |
||
25 | $initialCart->customer = $initialCustomer; |
||
26 | |||
27 | $this->_em->persist($initialCustomer); |
||
28 | $this->_em->persist($initialCart); |
||
29 | $this->_em->flush(); |
||
30 | $this->_em->clear(); |
||
31 | |||
32 | $repository = $this->_em->getRepository(GH6638Customer::class); |
||
33 | |||
34 | $customer = $repository->find($initialCustomer->id); |
||
35 | |||
36 | $this->assertInstanceOf(GH6638Cart::class, $customer->cart); |
||
37 | |||
38 | $customer->cart = null; |
||
39 | |||
40 | $this->assertNull($customer->cart); |
||
41 | |||
42 | $repository->findBy(['id' => $initialCustomer->id]); |
||
43 | |||
44 | $this->assertNull($customer->cart); |
||
45 | } |
||
46 | } |
||
84 |