From 53dee00d356ac63387c5e182557fe7348fa88d30 Mon Sep 17 00:00:00 2001 From: Danny van Kooten <hi@dvk.co> Date: Wed, 29 May 2024 09:36:07 +0200 Subject: [PATCH] fix tests --- tests/RatesTest.php | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/tests/RatesTest.php b/tests/RatesTest.php index 2d2bd74..01ca556 100644 --- a/tests/RatesTest.php +++ b/tests/RatesTest.php @@ -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' ); @@ -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); } /**