| Conditions | 1 |
| Paths | 1 |
| Total Lines | 31 |
| Code Lines | 18 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 20 | public function testPersistenceRoundTrip(): void { |
||
| 21 | $donation = new Donation(); |
||
| 22 | $payment = new SofortPayment(); |
||
| 23 | $donation->setPayment( $payment ); |
||
| 24 | |||
| 25 | $entityManager = TestEnvironment::newDefault()->getFactory()->getEntityManager(); |
||
| 26 | $entityManager->persist( $donation ); |
||
| 27 | $entityManager->flush(); |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var $retrievedPayment SofortPayment |
||
| 31 | */ |
||
| 32 | $retrievedPayment = $entityManager->getRepository( SofortPayment::class ) |
||
| 33 | ->findOneBy( [] ); |
||
| 34 | |||
| 35 | $this->assertSame( $payment->getId(), $retrievedPayment->getId() ); |
||
| 36 | $this->assertNull( $retrievedPayment->getConfirmedAt() ); |
||
| 37 | |||
| 38 | $payment->setConfirmedAt( new DateTime( '2017-07-14T22:00:01Z' ) ); |
||
| 39 | $entityManager->persist( $donation ); |
||
| 40 | $entityManager->flush(); |
||
| 41 | |||
| 42 | /** |
||
| 43 | * @var $retrievedPayment SofortPayment |
||
| 44 | */ |
||
| 45 | $retrievedPayment = $entityManager->getRepository( SofortPayment::class ) |
||
| 46 | ->findOneBy( [] ); |
||
| 47 | |||
| 48 | $this->assertSame( $payment->getId(), $retrievedPayment->getId() ); |
||
| 49 | $this->assertEquals( new DateTime( '2017-07-14T22:00:01Z' ), $retrievedPayment->getConfirmedAt() ); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |