From f4d602e2e541905574df1956a68b9c106bb92aae Mon Sep 17 00:00:00 2001 From: Steffen Brand Date: Wed, 30 May 2018 19:14:49 +0200 Subject: [PATCH] updated to php > 7.1 --- test/CurrCurrIntegrationTest.php | 12 ++++++------ test/CurrCurrMockTest.php | 12 ++++++------ test/CurrCurrSimpleCacheIntegrationTest.php | 9 ++++----- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/test/CurrCurrIntegrationTest.php b/test/CurrCurrIntegrationTest.php index bdd192a..dcbefbb 100644 --- a/test/CurrCurrIntegrationTest.php +++ b/test/CurrCurrIntegrationTest.php @@ -15,12 +15,12 @@ */ class CurrCurrIntegrationTest extends TestCase { - public function testIsInstantiable() + public function testIsInstantiable(): void { $this->assertInstanceOf(CurrCurr::class, $this->getInstance()); } - public function testGetExchangeRates() + public function testGetExchangeRates(): void { $cc = $this->getInstance(); $exchangeRates = $cc->getExchangeRates(); @@ -31,7 +31,7 @@ public function testGetExchangeRates() $this->assertInstanceOf(\DateTime::class, $exchangeRates[Currency::USD]->getDate(), 'date must be instance of DateTime'); } - public function testGetExchangeRateByCurrency() + public function testGetExchangeRateByCurrency(): void { $cc = $this->getInstance(); $exchangeRate = $cc->getExchangeRateByCurrency(Currency::USD); @@ -47,7 +47,7 @@ public function testGetExchangeRateByCurrency() * @expectedException \SteffenBrand\CurrCurr\Exception\CurrencyNotSupportedException * @expectedExceptionMessage The currency you are requesting the exchange rates for is not supported. */ - public function testGetExchangeRateByCurrencyThrowsCurrencyNotSupportedException() + public function testGetExchangeRateByCurrencyThrowsCurrencyNotSupportedException(): void { $cc = $this->getInstance(); $cc->getExchangeRateByCurrency('SOMESTRING'); @@ -57,7 +57,7 @@ public function testGetExchangeRateByCurrencyThrowsCurrencyNotSupportedException * @expectedException \SteffenBrand\CurrCurr\Exception\ExchangeRatesRequestFailedException * @expectedExceptionMessage Request for ECBs exchange rates failed. */ - public function testGetExchangeRatesThrowsExchangeRatesRequestFailedException() + public function testGetExchangeRatesThrowsExchangeRatesRequestFailedException(): void { $cc = $this->getInstance('http://httpstat.us/404'); $cc->getExchangeRates(); @@ -67,7 +67,7 @@ public function testGetExchangeRatesThrowsExchangeRatesRequestFailedException() * @expectedException \SteffenBrand\CurrCurr\Exception\ExchangeRatesMappingFailedException * @expectedExceptionMessage Could not successfully parse and map exchange rates. */ - public function testGetExchangeRatesThrowsExchangeRatesMappingFailedException() + public function testGetExchangeRatesThrowsExchangeRatesMappingFailedException(): void { $cc = $this->getInstance('http://httpstat.us/200'); $cc->getExchangeRates(); diff --git a/test/CurrCurrMockTest.php b/test/CurrCurrMockTest.php index 90dcbfd..7f42f9f 100644 --- a/test/CurrCurrMockTest.php +++ b/test/CurrCurrMockTest.php @@ -15,12 +15,12 @@ */ class CurrCurrMockTest extends TestCase { - public function testIsInstantiable() + public function testIsInstantiable(): void { $this->assertInstanceOf(CurrCurr::class, $this->getInstance(EcbClientMock::VALID_RESPONSE)); } - public function testGetExchangeRates() + public function testGetExchangeRates(): void { $cc = $this->getInstance(EcbClientMock::VALID_RESPONSE); $exchangeRates = $cc->getExchangeRates(); @@ -34,7 +34,7 @@ public function testGetExchangeRates() $this->assertEquals(1.0994, $exchangeRates[Currency::USD]->getRate(), 'Rate must be 1.0994'); } - public function testGetExchangeRateByCurrency() + public function testGetExchangeRateByCurrency(): void { $cc = $this->getInstance(EcbClientMock::VALID_RESPONSE); $exchangeRate = $cc->getExchangeRateByCurrency(Currency::USD); @@ -53,7 +53,7 @@ public function testGetExchangeRateByCurrency() * @expectedException \SteffenBrand\CurrCurr\Exception\CurrencyNotSupportedException * @expectedExceptionMessage The currency you are requesting the exchange rates for is not supported. */ - public function testSomeStringThrowsCurrencyNotSupportedException() + public function testSomeStringThrowsCurrencyNotSupportedException(): void { $cc = $this->getInstance(EcbClientMock::VALID_RESPONSE); $cc->getExchangeRateByCurrency('SOMESTRING'); @@ -63,7 +63,7 @@ public function testSomeStringThrowsCurrencyNotSupportedException() * @expectedException \SteffenBrand\CurrCurr\Exception\CurrencyNotSupportedException * @expectedExceptionMessage The currency you are requesting the exchange rates for is not supported. */ - public function testMissingUsdThrowsCurrencyNotSupportedException() + public function testMissingUsdThrowsCurrencyNotSupportedException(): void { $cc = $this->getInstance(EcbClientMock::USD_MISSING_RESPONSE); $cc->getExchangeRateByCurrency(Currency::USD); @@ -73,7 +73,7 @@ public function testMissingUsdThrowsCurrencyNotSupportedException() * @expectedException \SteffenBrand\CurrCurr\Exception\ExchangeRatesMappingFailedException * @expectedExceptionMessage Could not successfully parse and map exchange rates. */ - public function testMissingDateThrowsExchangeRatesMappingFailedException() + public function testMissingDateThrowsExchangeRatesMappingFailedException(): void { $cc = $this->getInstance(EcbClientMock::DATE_MISSING_RESPONSE); $cc->getExchangeRates(); diff --git a/test/CurrCurrSimpleCacheIntegrationTest.php b/test/CurrCurrSimpleCacheIntegrationTest.php index c348dd6..1d607c1 100644 --- a/test/CurrCurrSimpleCacheIntegrationTest.php +++ b/test/CurrCurrSimpleCacheIntegrationTest.php @@ -16,12 +16,12 @@ */ class CurrCurrSimpleCacheIntegrationTest extends TestCase { - public function testIsInstantiable() + public function testIsInstantiable(): void { - $this->assertInstanceOf(CurrCurr::class, $this->getInstance(uniqid())); + $this->assertInstanceOf(CurrCurr::class, $this->getInstance(uniqid('test', false))); } - public function testGetExchangeRatesMidnightCache() + public function testGetExchangeRatesMidnightCache(): void { $cc = $this->getInstance(uniqid('test', false)); $this->getRates($cc); @@ -49,9 +49,8 @@ private function getInstance(string $cacheKey): CurrCurr /** * @param CurrCurr $cc */ - private function getRates(CurrCurr $cc) + private function getRates(CurrCurr $cc): void { - $exchangeRates = $cc->getExchangeRates(); $this->assertNotNull($exchangeRates, 'exchange rates must not be null');