@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace WMDE\Euro; |
| 6 | 6 | |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | * @param int $cents |
| 22 | 22 | * @throws InvalidArgumentException |
| 23 | 23 | */ |
| 24 | - private function __construct( int $cents ) { |
|
| 25 | - if ( $cents < 0 ) { |
|
| 26 | - throw new InvalidArgumentException( 'Amount needs to be positive' ); |
|
| 24 | + private function __construct(int $cents) { |
|
| 25 | + if ($cents < 0) { |
|
| 26 | + throw new InvalidArgumentException('Amount needs to be positive'); |
|
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | $this->cents = $cents; |
@@ -34,8 +34,8 @@ discard block |
||
| 34 | 34 | * @return self |
| 35 | 35 | * @throws InvalidArgumentException |
| 36 | 36 | */ |
| 37 | - public static function newFromCents( int $cents ): self { |
|
| 38 | - return new self( $cents ); |
|
| 37 | + public static function newFromCents(int $cents): self { |
|
| 38 | + return new self($cents); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | /** |
@@ -49,14 +49,14 @@ discard block |
||
| 49 | 49 | * @return self |
| 50 | 50 | * @throws InvalidArgumentException |
| 51 | 51 | */ |
| 52 | - public static function newFromString( string $euroAmount ): self { |
|
| 53 | - if ( !is_numeric( $euroAmount ) ) { |
|
| 54 | - throw new InvalidArgumentException( 'Not a number' ); |
|
| 52 | + public static function newFromString(string $euroAmount): self { |
|
| 53 | + if (!is_numeric($euroAmount)) { |
|
| 54 | + throw new InvalidArgumentException('Not a number'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - return new self( intval( |
|
| 58 | - round( $euroAmount, self::$DECIMAL_COUNT ) * self::$CENTS_PER_EURO |
|
| 59 | - ) ); |
|
| 57 | + return new self(intval( |
|
| 58 | + round($euroAmount, self::$DECIMAL_COUNT) * self::$CENTS_PER_EURO |
|
| 59 | + )); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | * @return self |
| 69 | 69 | * @throws InvalidArgumentException |
| 70 | 70 | */ |
| 71 | - public static function newFromFloat( float $euroAmount ) { |
|
| 72 | - return new self( intval( |
|
| 73 | - round( $euroAmount, self::$DECIMAL_COUNT ) * self::$CENTS_PER_EURO |
|
| 74 | - ) ); |
|
| 71 | + public static function newFromFloat(float $euroAmount) { |
|
| 72 | + return new self(intval( |
|
| 73 | + round($euroAmount, self::$DECIMAL_COUNT) * self::$CENTS_PER_EURO |
|
| 74 | + )); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | /** |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | * @return self |
| 80 | 80 | * @throws InvalidArgumentException |
| 81 | 81 | */ |
| 82 | - public static function newFromInt( int $euroAmount ) { |
|
| 83 | - return new self( $euroAmount * self::$CENTS_PER_EURO ); |
|
| 82 | + public static function newFromInt(int $euroAmount) { |
|
| 83 | + return new self($euroAmount * self::$CENTS_PER_EURO); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | public function getEuroCents(): int { |
@@ -95,10 +95,10 @@ discard block |
||
| 95 | 95 | * Returns the euro amount as string with two decimals always present in format "42.00". |
| 96 | 96 | */ |
| 97 | 97 | public function getEuroString(): string { |
| 98 | - return number_format( $this->getEuroFloat(), self::$DECIMAL_COUNT, '.', '' ); |
|
| 98 | + return number_format($this->getEuroFloat(), self::$DECIMAL_COUNT, '.', ''); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | - public function equals( Euro $euro ): bool { |
|
| 101 | + public function equals(Euro $euro): bool { |
|
| 102 | 102 | return $this->cents === $euro->cents; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace WMDE\Euro\Tests\Unit; |
| 6 | 6 | |
@@ -17,188 +17,188 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * @dataProvider unsignedIntegerProvider |
| 19 | 19 | */ |
| 20 | - public function testGetCentsReturnsConstructorArgument( int $unsignedInteger ) { |
|
| 21 | - $amount = Euro::newFromCents( $unsignedInteger ); |
|
| 22 | - $this->assertSame( $unsignedInteger, $amount->getEuroCents() ); |
|
| 20 | + public function testGetCentsReturnsConstructorArgument(int $unsignedInteger) { |
|
| 21 | + $amount = Euro::newFromCents($unsignedInteger); |
|
| 22 | + $this->assertSame($unsignedInteger, $amount->getEuroCents()); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public function unsignedIntegerProvider() { |
| 26 | 26 | return [ |
| 27 | - [ 0 ], [ 1 ], [ 2 ], [ 9 ], [ 10 ], [ 11 ], |
|
| 28 | - [ 99 ], [ 100 ], [ 101 ], [ 999 ], [ 1000 ], [ 1001 ], |
|
| 27 | + [0], [1], [2], [9], [10], [11], |
|
| 28 | + [99], [100], [101], [999], [1000], [1001], |
|
| 29 | 29 | ]; |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | public function testGivenZero_getEuroFloatReturnsZeroFloat() { |
| 33 | - $amount = Euro::newFromCents( 0 ); |
|
| 34 | - $this->assertExactFloat( 0.0, $amount->getEuroFloat() ); |
|
| 35 | - $this->assertNotSame( 0, $amount->getEuroFloat() ); |
|
| 33 | + $amount = Euro::newFromCents(0); |
|
| 34 | + $this->assertExactFloat(0.0, $amount->getEuroFloat()); |
|
| 35 | + $this->assertNotSame(0, $amount->getEuroFloat()); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - private function assertExactFloat( float $expected, $actual ) { |
|
| 39 | - $this->assertInternalType( 'float', $actual ); |
|
| 40 | - $this->assertEquals( $expected, $actual, '', 0 ); |
|
| 38 | + private function assertExactFloat(float $expected, $actual) { |
|
| 39 | + $this->assertInternalType('float', $actual); |
|
| 40 | + $this->assertEquals($expected, $actual, '', 0); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | public function testGivenOneEuro_getEuroFloatReturnsOne() { |
| 44 | - $amount = Euro::newFromCents( 100 ); |
|
| 45 | - $this->assertExactFloat( 1.0, $amount->getEuroFloat() ); |
|
| 44 | + $amount = Euro::newFromCents(100); |
|
| 45 | + $this->assertExactFloat(1.0, $amount->getEuroFloat()); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | public function testGivenOneCent_getEuroFloatReturnsPointZeroOne() { |
| 49 | - $amount = Euro::newFromCents( 1 ); |
|
| 50 | - $this->assertExactFloat( 0.01, $amount->getEuroFloat() ); |
|
| 49 | + $amount = Euro::newFromCents(1); |
|
| 50 | + $this->assertExactFloat(0.01, $amount->getEuroFloat()); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public function testGiven33cents_getEuroFloatReturnsPointThreeThree() { |
| 54 | - $amount = Euro::newFromCents( 33 ); |
|
| 55 | - $this->assertExactFloat( 0.33, $amount->getEuroFloat() ); |
|
| 54 | + $amount = Euro::newFromCents(33); |
|
| 55 | + $this->assertExactFloat(0.33, $amount->getEuroFloat()); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | public function testGivenNegativeAmount_constructorThrowsException() { |
| 59 | - $this->expectException( \InvalidArgumentException::class ); |
|
| 59 | + $this->expectException(\InvalidArgumentException::class); |
|
| 60 | 60 | Euro::newFromCents( -1 ); |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | public function testGivenZero_getEuroStringReturnsZeroString() { |
| 64 | - $amount = Euro::newFromCents( 0 ); |
|
| 65 | - $this->assertSame( '0.00', $amount->getEuroString() ); |
|
| 64 | + $amount = Euro::newFromCents(0); |
|
| 65 | + $this->assertSame('0.00', $amount->getEuroString()); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | public function testGivenOneEuro_getEuroStringReturnsOnePointZeroZero() { |
| 69 | - $amount = Euro::newFromCents( 100 ); |
|
| 70 | - $this->assertSame( '1.00', $amount->getEuroString() ); |
|
| 69 | + $amount = Euro::newFromCents(100); |
|
| 70 | + $this->assertSame('1.00', $amount->getEuroString()); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | public function testGivenTwoEuros_getEuroStringReturnsTwoPointZeroZero() { |
| 74 | - $amount = Euro::newFromCents( 200 ); |
|
| 75 | - $this->assertSame( '2.00', $amount->getEuroString() ); |
|
| 74 | + $amount = Euro::newFromCents(200); |
|
| 75 | + $this->assertSame('2.00', $amount->getEuroString()); |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | public function testGivenOneCent_getEuroStringReturnsZeroPointZeroOne() { |
| 79 | - $amount = Euro::newFromCents( 1 ); |
|
| 80 | - $this->assertSame( '0.01', $amount->getEuroString() ); |
|
| 79 | + $amount = Euro::newFromCents(1); |
|
| 80 | + $this->assertSame('0.01', $amount->getEuroString()); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | public function testGivenTenCents_getEuroStringReturnsZeroPointOneZero() { |
| 84 | - $amount = Euro::newFromCents( 10 ); |
|
| 85 | - $this->assertSame( '0.10', $amount->getEuroString() ); |
|
| 84 | + $amount = Euro::newFromCents(10); |
|
| 85 | + $this->assertSame('0.10', $amount->getEuroString()); |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public function testGiven1234Cents_getEuroStringReturns12euro34() { |
| 89 | - $amount = Euro::newFromCents( 1234 ); |
|
| 90 | - $this->assertSame( '12.34', $amount->getEuroString() ); |
|
| 89 | + $amount = Euro::newFromCents(1234); |
|
| 90 | + $this->assertSame('12.34', $amount->getEuroString()); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | public function testOneEuroString_getsTurnedInto100cents() { |
| 94 | - $this->assertSame( 100, Euro::newFromString( '1.00' )->getEuroCents() ); |
|
| 94 | + $this->assertSame(100, Euro::newFromString('1.00')->getEuroCents()); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | public function testOneCentString_getsTurnedInto1cents() { |
| 98 | - $this->assertSame( 1, Euro::newFromString( '0.01' )->getEuroCents() ); |
|
| 98 | + $this->assertSame(1, Euro::newFromString('0.01')->getEuroCents()); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | public function testTenCentString_getsTurnedInto10cents() { |
| 102 | - $this->assertSame( 10, Euro::newFromString( '0.10' )->getEuroCents() ); |
|
| 102 | + $this->assertSame(10, Euro::newFromString('0.10')->getEuroCents()); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | public function testShortTenCentString_getsTurnedInto10cents() { |
| 106 | - $this->assertSame( 10, Euro::newFromString( '0.1' )->getEuroCents() ); |
|
| 106 | + $this->assertSame(10, Euro::newFromString('0.1')->getEuroCents()); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | public function testShortOneEuroString_getsTurnedInto100cents() { |
| 110 | - $this->assertSame( 100, Euro::newFromString( '1' )->getEuroCents() ); |
|
| 110 | + $this->assertSame(100, Euro::newFromString('1')->getEuroCents()); |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | public function testOneDecimalOneEuroString_getsTurnedInto100cents() { |
| 114 | - $this->assertSame( 100, Euro::newFromString( '1.0' )->getEuroCents() ); |
|
| 114 | + $this->assertSame(100, Euro::newFromString('1.0')->getEuroCents()); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | public function testMultiDecimalOneEuroString_getsTurnedInto100cents() { |
| 118 | - $this->assertSame( 100, Euro::newFromString( '1.00000' )->getEuroCents() ); |
|
| 118 | + $this->assertSame(100, Euro::newFromString('1.00000')->getEuroCents()); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | public function testHandlingOfLargeEuroString() { |
| 122 | - $this->assertSame( 3133742, Euro::newFromString( '31337.42' )->getEuroCents() ); |
|
| 122 | + $this->assertSame(3133742, Euro::newFromString('31337.42')->getEuroCents()); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | public function testEuroStringWithRoundingError_getsRoundedAppropriately() { |
| 126 | - $this->assertSame( 101, Euro::newFromString( '1.0100000001' )->getEuroCents() ); |
|
| 127 | - $this->assertSame( 101, Euro::newFromString( '1.010000009999' )->getEuroCents() ); |
|
| 128 | - $this->assertSame( 101, Euro::newFromString( '1.011' )->getEuroCents() ); |
|
| 129 | - $this->assertSame( 101, Euro::newFromString( '1.014' )->getEuroCents() ); |
|
| 130 | - $this->assertSame( 101, Euro::newFromString( '1.0149' )->getEuroCents() ); |
|
| 131 | - $this->assertSame( 102, Euro::newFromString( '1.015' )->getEuroCents() ); |
|
| 132 | - $this->assertSame( 102, Euro::newFromString( '1.019' )->getEuroCents() ); |
|
| 133 | - $this->assertSame( 102, Euro::newFromString( '1.0199999' )->getEuroCents() ); |
|
| 126 | + $this->assertSame(101, Euro::newFromString('1.0100000001')->getEuroCents()); |
|
| 127 | + $this->assertSame(101, Euro::newFromString('1.010000009999')->getEuroCents()); |
|
| 128 | + $this->assertSame(101, Euro::newFromString('1.011')->getEuroCents()); |
|
| 129 | + $this->assertSame(101, Euro::newFromString('1.014')->getEuroCents()); |
|
| 130 | + $this->assertSame(101, Euro::newFromString('1.0149')->getEuroCents()); |
|
| 131 | + $this->assertSame(102, Euro::newFromString('1.015')->getEuroCents()); |
|
| 132 | + $this->assertSame(102, Euro::newFromString('1.019')->getEuroCents()); |
|
| 133 | + $this->assertSame(102, Euro::newFromString('1.0199999')->getEuroCents()); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | public function testGivenNegativeAmountString_exceptionIsThrown() { |
| 137 | - $this->expectException( \InvalidArgumentException::class ); |
|
| 138 | - Euro::newFromString( '-1.00' ); |
|
| 137 | + $this->expectException(\InvalidArgumentException::class); |
|
| 138 | + Euro::newFromString('-1.00'); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | public function testGivenStringWithComma_exceptionIsThrown() { |
| 142 | - $this->expectException( \InvalidArgumentException::class ); |
|
| 143 | - Euro::newFromString( '1,00' ); |
|
| 142 | + $this->expectException(\InvalidArgumentException::class); |
|
| 143 | + Euro::newFromString('1,00'); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | public function testGivenStringWithMultipleDots_ExceptionIsThrown() { |
| 147 | - $this->expectException( \InvalidArgumentException::class ); |
|
| 148 | - Euro::newFromString( '1.0.0' ); |
|
| 147 | + $this->expectException(\InvalidArgumentException::class); |
|
| 148 | + Euro::newFromString('1.0.0'); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | public function testGivenNonNumber_exceptionIsThrown() { |
| 152 | - $this->expectException( \InvalidArgumentException::class ); |
|
| 153 | - Euro::newFromString( '1.00abc' ); |
|
| 152 | + $this->expectException(\InvalidArgumentException::class); |
|
| 153 | + Euro::newFromString('1.00abc'); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | public function testGivenNegativeFloatAmount_exceptionIsThrown() { |
| 157 | - $this->expectException( \InvalidArgumentException::class ); |
|
| 157 | + $this->expectException(\InvalidArgumentException::class); |
|
| 158 | 158 | Euro::newFromFloat( -1.00 ); |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | public function testOneEuroFloat_getsTurnedInto100cents() { |
| 162 | - $this->assertSame( 100, Euro::newFromFloat( 1.0 )->getEuroCents() ); |
|
| 162 | + $this->assertSame(100, Euro::newFromFloat(1.0)->getEuroCents()); |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | public function testOneCentFloat_getsTurnedInto1cent() { |
| 166 | - $this->assertSame( 1, Euro::newFromFloat( 0.01 )->getEuroCents() ); |
|
| 166 | + $this->assertSame(1, Euro::newFromFloat(0.01)->getEuroCents()); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | public function testTenCentFloat_getsTurnedInto10cents() { |
| 170 | - $this->assertSame( 10, Euro::newFromFloat( 0.1 )->getEuroCents() ); |
|
| 170 | + $this->assertSame(10, Euro::newFromFloat(0.1)->getEuroCents()); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | public function testHandlingOfLargeEuroFloat() { |
| 174 | - $this->assertSame( 3133742, Euro::newFromFloat( 31337.42 )->getEuroCents() ); |
|
| 174 | + $this->assertSame(3133742, Euro::newFromFloat(31337.42)->getEuroCents()); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | public function testFloatWithRoundingError_getsRoundedAppropriately() { |
| 178 | - $this->assertSame( 101, Euro::newFromFloat( 1.0100000001 )->getEuroCents() ); |
|
| 179 | - $this->assertSame( 101, Euro::newFromFloat( 1.010000009999 )->getEuroCents() ); |
|
| 180 | - $this->assertSame( 101, Euro::newFromFloat( 1.011 )->getEuroCents() ); |
|
| 181 | - $this->assertSame( 101, Euro::newFromFloat( 1.014 )->getEuroCents() ); |
|
| 182 | - $this->assertSame( 101, Euro::newFromFloat( 1.0149 )->getEuroCents() ); |
|
| 183 | - $this->assertSame( 102, Euro::newFromFloat( 1.015 )->getEuroCents() ); |
|
| 184 | - $this->assertSame( 102, Euro::newFromFloat( 1.019 )->getEuroCents() ); |
|
| 185 | - $this->assertSame( 102, Euro::newFromFloat( 1.0199999 )->getEuroCents() ); |
|
| 178 | + $this->assertSame(101, Euro::newFromFloat(1.0100000001)->getEuroCents()); |
|
| 179 | + $this->assertSame(101, Euro::newFromFloat(1.010000009999)->getEuroCents()); |
|
| 180 | + $this->assertSame(101, Euro::newFromFloat(1.011)->getEuroCents()); |
|
| 181 | + $this->assertSame(101, Euro::newFromFloat(1.014)->getEuroCents()); |
|
| 182 | + $this->assertSame(101, Euro::newFromFloat(1.0149)->getEuroCents()); |
|
| 183 | + $this->assertSame(102, Euro::newFromFloat(1.015)->getEuroCents()); |
|
| 184 | + $this->assertSame(102, Euro::newFromFloat(1.019)->getEuroCents()); |
|
| 185 | + $this->assertSame(102, Euro::newFromFloat(1.0199999)->getEuroCents()); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | public function testZeroEuroIntegers_isZeroCents() { |
| 189 | - $this->assertSame( 0, Euro::newFromInt( 0 )->getEuroCents() ); |
|
| 189 | + $this->assertSame(0, Euro::newFromInt(0)->getEuroCents()); |
|
| 190 | 190 | } |
| 191 | 191 | |
| 192 | 192 | public function testOneEuroIntegers_is100cents() { |
| 193 | - $this->assertSame( 100, Euro::newFromInt( 1 )->getEuroCents() ); |
|
| 193 | + $this->assertSame(100, Euro::newFromInt(1)->getEuroCents()); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | public function test1337EuroIntegers_is133700cents() { |
| 197 | - $this->assertSame( 133700, Euro::newFromInt( 1337 )->getEuroCents() ); |
|
| 197 | + $this->assertSame(133700, Euro::newFromInt(1337)->getEuroCents()); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | 200 | public function testGivenNegativeIntegerAmount_exceptionIsThrown() { |
| 201 | - $this->expectException( \InvalidArgumentException::class ); |
|
| 201 | + $this->expectException(\InvalidArgumentException::class); |
|
| 202 | 202 | Euro::newFromInt( -1 ); |
| 203 | 203 | } |
| 204 | 204 | |
@@ -206,34 +206,34 @@ discard block |
||
| 206 | 206 | * @dataProvider euroProvider |
| 207 | 207 | * @param Euro $euro |
| 208 | 208 | */ |
| 209 | - public function testEuroEqualsItself( Euro $euro ) { |
|
| 210 | - $this->assertTrue( $euro->equals( clone $euro ) ); |
|
| 209 | + public function testEuroEqualsItself(Euro $euro) { |
|
| 210 | + $this->assertTrue($euro->equals(clone $euro)); |
|
| 211 | 211 | } |
| 212 | 212 | |
| 213 | 213 | public function euroProvider() { |
| 214 | 214 | return [ |
| 215 | - [ Euro::newFromCents( 0 ) ], |
|
| 216 | - [ Euro::newFromCents( 1 ) ], |
|
| 217 | - [ Euro::newFromCents( 99 ) ], |
|
| 218 | - [ Euro::newFromCents( 100 ) ], |
|
| 219 | - [ Euro::newFromCents( 9999 ) ], |
|
| 215 | + [Euro::newFromCents(0)], |
|
| 216 | + [Euro::newFromCents(1)], |
|
| 217 | + [Euro::newFromCents(99)], |
|
| 218 | + [Euro::newFromCents(100)], |
|
| 219 | + [Euro::newFromCents(9999)], |
|
| 220 | 220 | ]; |
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | public function testOneCentDoesNotEqualOneEuro() { |
| 224 | - $this->assertFalse( Euro::newFromCents( 1 )->equals( Euro::newFromInt( 1 ) ) ); |
|
| 224 | + $this->assertFalse(Euro::newFromCents(1)->equals(Euro::newFromInt(1))); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | public function testOneCentDoesNotEqualTwoCents() { |
| 228 | - $this->assertFalse( Euro::newFromCents( 1 )->equals( Euro::newFromCents( 2 ) ) ); |
|
| 228 | + $this->assertFalse(Euro::newFromCents(1)->equals(Euro::newFromCents(2))); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | public function testOneCentDoesNotEqualOneEuroAndOneCent() { |
| 232 | - $this->assertFalse( Euro::newFromCents( 1 )->equals( Euro::newFromCents( 101 ) ) ); |
|
| 232 | + $this->assertFalse(Euro::newFromCents(1)->equals(Euro::newFromCents(101))); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | public function test9001centsDoesNotEqual9000cents() { |
| 236 | - $this->assertFalse( Euro::newFromCents( 9001 )->equals( Euro::newFromCents( 9000 ) ) ); |
|
| 236 | + $this->assertFalse(Euro::newFromCents(9001)->equals(Euro::newFromCents(9000))); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | } |
@@ -1,16 +1,16 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare( strict_types = 1 ); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | -if ( PHP_SAPI !== 'cli' ) { |
|
| 6 | - die( 'Not an entry point' ); |
|
| 5 | +if (PHP_SAPI !== 'cli') { |
|
| 6 | + die('Not an entry point'); |
|
| 7 | 7 | } |
| 8 | 8 | |
| 9 | 9 | error_reporting( -1 ); |
| 10 | -ini_set( 'display_errors', '1' ); |
|
| 10 | +ini_set('display_errors', '1'); |
|
| 11 | 11 | |
| 12 | -if ( !is_readable( __DIR__ . '/../vendor/autoload.php' ) ) { |
|
| 13 | - die( 'You need to install this package with Composer before you can run the tests' ); |
|
| 12 | +if (!is_readable(__DIR__.'/../vendor/autoload.php')) { |
|
| 13 | + die('You need to install this package with Composer before you can run the tests'); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | -require __DIR__ . '/../vendor/autoload.php'; |
|
| 16 | +require __DIR__.'/../vendor/autoload.php'; |
|