Completed
Push — master ( 00092a...39103d )
by wiese
86:17 queued 21:06
created

testGivenSameIbanWithDifferentCapitalization_objectsAreEqual()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
1
<?php
2
3
declare( strict_types = 1 );
4
5
namespace WMDE\Fundraising\Frontend\PaymentContext\Tests\Unit\Domain\Model;
6
7
use WMDE\Fundraising\Frontend\PaymentContext\Domain\Model\Iban;
8
9
/**
10
 * @covers \WMDE\Fundraising\Frontend\PaymentContext\Domain\Model\Iban
11
 *
12
 * @licence GNU GPL v2+
13
 * @author Gabriel Birke < [email protected] >
14
 */
15
class IbanTest extends \PHPUnit\Framework\TestCase {
16
17
	const TEST_IBAN_WITH_WHITESPACE = 'DE12 5001 0517 0648 4898 90 ';
18
	const TEST_IBAN = 'DE12500105170648489890';
19
	const TEST_LOWERCASE_IBAN = 'de12500105170648489890';
20
21
	public function testGivenIbanWithWhitespace_WhitespaceIsRemoved(): void {
22
		$iban = new Iban( self::TEST_IBAN_WITH_WHITESPACE );
23
		$this->assertSame( self::TEST_IBAN, $iban->toString() );
24
	}
25
26
	public function testCountryCodeIsReturnedCorrectly(): void {
27
		$iban = new Iban( self::TEST_IBAN );
28
		$this->assertSame( 'DE', $iban->getCountryCode() );
29
	}
30
31
	public function testCountryCodeIsReturnedCorrectlyForLowercase(): void {
32
		$iban = new Iban( self::TEST_LOWERCASE_IBAN );
33
		$this->assertSame( 'DE', $iban->getCountryCode() );
34
	}
35
36
	public function testGivenSameIbanWithDifferentCapitalization_objectsAreEqual(): void {
37
		$this->assertEquals(
38
			new Iban( self::TEST_IBAN ),
39
			new Iban( self::TEST_LOWERCASE_IBAN )
40
		);
41
	}
42
43
}
44