for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare( strict_types = 1 );
namespace WMDE\Fundraising\Store\Tests;
use DateTime;
use PHPUnit\Framework\TestCase;
use WMDE\Fundraising\Entities\Donation;
use WMDE\Fundraising\Entities\DonationPayments\SofortPayment;
/**
* @covers \WMDE\Fundraising\Entities\DonationPayments\SofortPayment
*
* @licence GNU GPL v2+
* @author Jeroen De Dauw < [email protected] >
*/
class SofortPaymentTest extends TestCase {
public function testPersistenceRoundTrip(): void {
$donation = new Donation();
$payment = new SofortPayment();
$donation->setPayment( $payment );
$entityManager = TestEnvironment::newDefault()->getFactory()->getEntityManager();
$entityManager->persist( $donation );
$entityManager->flush();
* @var $retrievedPayment SofortPayment
$retrievedPayment = $entityManager->getRepository( SofortPayment::class )
->findOneBy( [] );
$this->assertSame( $payment->getId(), $retrievedPayment->getId() );
$this->assertNull( $retrievedPayment->getConfirmedAt() );
$payment->setConfirmedAt( new DateTime( '2017-07-14T22:00:01Z' ) );
$this->assertEquals( new DateTime( '2017-07-14T22:00:01Z' ), $retrievedPayment->getConfirmedAt() );
}