Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyvankooten committed May 29, 2024
1 parent 32d03f4 commit 53dee00
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions tests/RatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,18 @@ public function testCountry() {
$rates = new Rates($mock, null);

// Return correct VAT rates
self::assertEquals( $rates->country('NL'), 21 );
self::assertEquals( $rates->country('NL', 'reduced'), 6 );
self::assertEquals( $rates->country('NL'), 22.0 );
self::assertEquals( $rates->country('NL', 'reduced'), 7.0 );

// Return correct VAT rates for an older period
self::assertEquals($rates->country('NL', 'standard', new \DateTimeImmutable('2015-01-01')), 21.0);
self::assertEquals($rates->country('NL', 'reduced', new \DateTimeImmutable('2015-01-01')), 6.0);

// Return correct VAT rates for an even older period
self::assertEquals($rates->country('NL', 'standard', new \DateTimeImmutable('2010-01-01')), 19.0);
self::assertEquals($rates->country('NL', 'reduced', new \DateTimeImmutable('2010-01-01')), 5.0);

// Return correct VAT rates on an older period
self::assertEquals($rates->country('NL', 'standard', new \DateTimeImmutable('2010-01-01')), 19);
self::assertEquals($rates->country('NL', 'reduced', new \DateTimeImmutable('2010-01-01')), 5);

// Return correct VAT rates on an future period
self::assertEquals($rates->country('NL', 'standard', new \DateTimeImmutable('2022-01-01')), 22);
self::assertEquals($rates->country('NL', 'reduced', new \DateTimeImmutable('2022-01-01')), 7);

// Exception when supplying country code for which we have no rate
self::expectException( 'Exception' );
Expand Down Expand Up @@ -201,16 +203,18 @@ public function testRatesAreLoadedFromCache() {
self::assertEquals($rates->all(), $data);

// Return correct VAT rates
self::assertEquals($rates->country('NL'), 21);
self::assertEquals($rates->country('NL', 'reduced'), 6);
self::assertEquals($rates->country('NL'), 22.0);
self::assertEquals($rates->country('NL', 'reduced'), 7.0);

// Return correct VAT rates for an older period
self::assertEquals($rates->country('NL', 'standard', new \DateTimeImmutable('2015-01-01')), 21.0);
self::assertEquals($rates->country('NL', 'reduced', new \DateTimeImmutable('2015-01-01')), 6.0);

// Return correct VAT rates for an even older period
self::assertEquals($rates->country('NL', 'standard', new \DateTimeImmutable('2010-01-01')), 19.0);
self::assertEquals($rates->country('NL', 'reduced', new \DateTimeImmutable('2010-01-01')), 5.0);

// Return correct VAT rates on an older period
self::assertEquals($rates->country('NL', 'standard', new \DateTimeImmutable('2010-01-01')), 19);
self::assertEquals($rates->country('NL', 'reduced', new \DateTimeImmutable('2010-01-01')), 5);

// Return correct VAT rates on an future period
self::assertEquals($rates->country('NL', 'standard', new \DateTimeImmutable('2022-01-01')), 22);
self::assertEquals($rates->country('NL', 'reduced', new \DateTimeImmutable('2022-01-01')), 7);
}

/**
Expand Down

0 comments on commit 53dee00

Please sign in to comment.