Completed
Pull Request — master (#127)
by Jeroen De
03:37
created

SofortPaymentTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 6

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 6
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testPersistenceRoundTrip() 0 14 1
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Store\Tests;
6
7
use PHPUnit\Framework\TestCase;
8
use WMDE\Fundraising\Entities\DonationPayments\SofortPayment;
9
10
/**
11
 * @covers WMDE\Fundraising\Entities\DonationPayments\SofortPayment
12
 *
13
 * @licence GNU GPL v2+
14
 * @author Jeroen De Dauw < [email protected] >
15
 */
16
class SofortPaymentTest extends TestCase {
17
18
	private const BANK_TRANSFER_CODE = 'W-Q-ABCDEZ';
19
	private const DONATION_ID = 31337;
20
21
	public function testPersistenceRoundTrip() {
22
		$payment = new SofortPayment( self::BANK_TRANSFER_CODE, self::DONATION_ID );
23
		$entityManager = TestEnvironment::newDefault()->getFactory()->getEntityManager();
24
25
		$entityManager->persist( $payment );
26
		$entityManager->flush();
27
		/**
28
		 * @var $retrievedPayment SofortPayment
29
		 */
30
		$retrievedPayment = $entityManager->getRepository( SofortPayment::class )->find( self::BANK_TRANSFER_CODE );
31
32
		$this->assertSame( self::BANK_TRANSFER_CODE, $retrievedPayment->getBankTransferCode() );
33
		$this->assertSame( self::DONATION_ID, $retrievedPayment->getDonationId() );
34
	}
35
36
}
37