diff --git a/.idea/hub-currencies.iml b/.idea/hub-currencies.iml index 4c05f50..fb96b0c 100644 --- a/.idea/hub-currencies.iml +++ b/.idea/hub-currencies.iml @@ -2,7 +2,6 @@ - @@ -40,6 +39,7 @@ + diff --git a/.idea/php-docker-settings.xml b/.idea/php-docker-settings.xml index fcc3696..86bb5dc 100644 --- a/.idea/php-docker-settings.xml +++ b/.idea/php-docker-settings.xml @@ -18,6 +18,21 @@ + + + + + + + diff --git a/.idea/php.xml b/.idea/php.xml index ee7c392..5d795a9 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -54,8 +54,8 @@ - - + + @@ -125,7 +125,7 @@ - + diff --git a/composer.json b/composer.json index 62e5d8a..5601ac7 100644 --- a/composer.json +++ b/composer.json @@ -49,10 +49,10 @@ "ext-curl": "*" }, "require-dev": { - "phpunit/phpunit": "^10.5", - "phpunit/php-invoker": "^4.0", - "phpstan/phpstan": "^1.5", - "squizlabs/php_codesniffer": "^3.6" + "phpunit/phpunit": "^11.1", + "phpunit/php-invoker": "^5.0", + "phpstan/phpstan": "^1.10", + "squizlabs/php_codesniffer": "^3.9" }, "config": { "platform-check": true, diff --git a/tests/Core/ArrayListLoaderTest.php b/tests/Core/ArrayListLoaderTest.php index a50efb9..1b9a365 100644 --- a/tests/Core/ArrayListLoaderTest.php +++ b/tests/Core/ArrayListLoaderTest.php @@ -6,6 +6,8 @@ use MiBo\Currencies\ISO\ISOArrayListLoader; use MiBo\Currencies\ISO\ISOListLoader; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Small; use PHPUnit\Framework\TestCase; /** @@ -18,44 +20,31 @@ * @since 1.2 * * @no-named-arguments Parameter names are not covered by the backward compatibility promise. - * - * @coversDefaultClass \MiBo\Currencies\ISO\ISOArrayListLoader */ +#[CoversClass(ISOArrayListLoader::class)] +#[Small] class ArrayListLoaderTest extends TestCase { - /** - * @small - * - * @covers ::loop - * - * @return void - */ public function test(): void { $loader = new ISOArrayListLoader(); foreach ($loader->loop() as $currency) { - $this->assertIsObject($currency); - $this->assertSame("AFGHANISTAN", $currency->CtryNm); - $this->assertSame("Afghani", $currency->CcyNm); - $this->assertSame("AFN", $currency->Ccy); - $this->assertSame("971", $currency->CcyNbr); - $this->assertSame("2", $currency->CcyMnrUnts); + self::assertIsObject($currency); + self::assertSame("AFGHANISTAN", $currency->CtryNm); + self::assertSame("Afghani", $currency->CcyNm); + self::assertSame("AFN", $currency->Ccy); + self::assertSame("971", $currency->CcyNbr); + self::assertSame("2", $currency->CcyMnrUnts); break; } } - /** - * @large - * - * @coversNothing - * @doesNotPerformAssertions - * - * @return void - */ public function create(): void { + self::expectNotToPerformAssertions(); + return; if (file_exists(__DIR__ . "/tmp.php")) { diff --git a/tests/Core/CachedFileTest.php b/tests/Core/CachedFileTest.php index 9dedf21..eb8dba2 100644 --- a/tests/Core/CachedFileTest.php +++ b/tests/Core/CachedFileTest.php @@ -5,6 +5,8 @@ use MiBo\Currencies\ISO\Exceptions\InvalidCacheDirException; use MiBo\Currencies\ISO\Exceptions\UnavailableCurrencyListException; use MiBo\Currencies\ISO\ISOLocalListLoader; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Small; use PHPUnit\Framework\TestCase; /** @@ -13,9 +15,9 @@ * @package MiBo\Currencies\Tests * * @author Michal Boris - * - * @coversDefaultClass \MiBo\Currencies\ISO\ISOLocalListLoader */ +#[CoversClass(ISOLocalListLoader::class)] +#[Small] class CachedFileTest extends TestCase { protected const DIR_TMP = __DIR__ . "/../../storage/tmp/"; @@ -34,146 +36,83 @@ public static function setUpBeforeClass(): void self::$loader = new ISOLocalListLoader(static::DIR_TMP); } - /** - * @medium - * - * @covers ::updateFile - * @covers ::getCacheDir - * - * @return void - */ public function testDownload(): void { - $this->assertTrue($this->getLoader()->updateFile()); + self::assertTrue($this->getLoader()->updateFile()); - $this->assertFileExists(static::DIR_TMP . ISOLocalListLoader::FILE_NAME); + self::assertFileExists(static::DIR_TMP . ISOLocalListLoader::FILE_NAME); } - /** - * @small - * - * @covers ::getCacheDir - * @covers ::setCacheDir - * - * @return void - */ public function testCacheDir(): void { - $this->assertSame(self::DIR_TMP, $this->getLoader()->getCacheDir()); + self::assertSame(self::DIR_TMP, $this->getLoader()->getCacheDir()); $this->getLoader()->setCacheDir(__DIR__ . "/../../storage/"); - $this->assertSame(__DIR__ . "/../../storage/", $this->getLoader()->getCacheDir()); + self::assertSame(__DIR__ . "/../../storage/", $this->getLoader()->getCacheDir()); $this->getLoader()->setCacheDir(self::DIR_TMP); } - /** - * @small - * - * @covers ::setResources - * - * @return void - */ public function testSetResources(): void { - $this->expectException(UnavailableCurrencyListException::class); - $this->expectExceptionMessage("Cannot use custom list of ISO currencies!"); + self::expectException(UnavailableCurrencyListException::class); + self::expectExceptionMessage("Cannot use custom list of ISO currencies!"); $this->getLoader()->setResources(""); } - /** - * @small - * - * @covers ::addResource - * - * @return void - */ public function testAddResource(): void { - $this->expectException(UnavailableCurrencyListException::class); - $this->expectExceptionMessage("Cannot use custom list of ISO currencies!"); + self::expectException(UnavailableCurrencyListException::class); + self::expectExceptionMessage("Cannot use custom list of ISO currencies!"); $this->getLoader()->addResource(""); } - /** - * @small - * - * @covers ::loop - * @covers ::contractLoop - * - * @return void - * @throws \MiBo\Currencies\ISO\Exceptions\UnavailableCurrencyListException - */ public function testLoop(): void { foreach ($this->getLoader()->loop() as $object) { - $this->assertIsObject($object); + self::assertIsObject($object); - $this->assertNotNull($object->CtryNm); + self::assertNotNull($object->CtryNm); - $this->assertNotNull($object->CcyNm); + self::assertNotNull($object->CcyNm); return; } - $this->fail("Failed to loop the list."); + self::fail("Failed to loop the list."); } - /** - * @small - * - * @covers ::updateFile - * @covers ::isFileCached - * @covers ::__construct - * - * @return void - */ public function testCache(): void { static::tearDownAfterClass(); $loader = new ISOLocalListLoader(static::DIR_TMP); - $this->assertEmpty($loader->getResources()); + self::assertEmpty($loader->getResources()); $loader->updateFile(); - $this->assertNotEmpty($loader->getResources()); + self::assertNotEmpty($loader->getResources()); $loader = new ISOLocalListLoader(static::DIR_TMP); - $this->assertNotEmpty($loader->getResources()); + self::assertNotEmpty($loader->getResources()); } - /** - * @small - * - * @covers ::__construct - * - * @return void - */ public function testInvalidDirectory(): void { $cacheDir = static::DIR_TMP . "test"; - $this->expectException(InvalidCacheDirException::class); - $this->expectExceptionMessage("Directory '$cacheDir' does not exist!"); + self::expectException(InvalidCacheDirException::class); + self::expectExceptionMessage("Directory '$cacheDir' does not exist!"); new ISOLocalListLoader($cacheDir); } - /** - * @medium - * - * @covers ::loop - * @covers ::contractLoop - * - * @doesNotPerformAssertions - * - * @return void - */ public function testLoopingCachedFile(): void { + self::expectNotToPerformAssertions(); + $this->getLoader()->updateFile(); $this->getLoader()->loop(); diff --git a/tests/Core/CurrencyTest.php b/tests/Core/CurrencyTest.php index c289c4b..5513188 100644 --- a/tests/Core/CurrencyTest.php +++ b/tests/Core/CurrencyTest.php @@ -5,6 +5,8 @@ use MiBo\Currencies\CurrencyInterface; use MiBo\Currencies\ISO\Exceptions\InvalidCurrencyException; use MiBo\Currencies\ISO\ISOCurrency; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Small; use PHPUnit\Framework\TestCase; /** @@ -13,23 +15,11 @@ * @package MiBo\Currencies\Tests * * @author Michal Boris - * - * @coversDefaultClass \MiBo\Currencies\ISO\ISOCurrency */ +#[CoversClass(ISOCurrency::class)] +#[Small] class CurrencyTest extends TestCase { - /** - * @small - * - * @covers ::validateISO - * @covers ::__toString - * @covers ::getName - * @covers ::getAlphabeticalCode - * @covers ::getNumericalCode - * @covers ::getMinorUnitRate - * - * @return void - */ public function testCreateValidCurrency(): void { $currency = new ISOCurrency( @@ -39,21 +29,14 @@ public function testCreateValidCurrency(): void null ); - $this->assertSame("ABC", (string) $currency); + self::assertSame("ABC", (string) $currency); - $this->assertSame("Test", $currency->getName()); - $this->assertSame("ABC", $currency->getAlphabeticalCode()); - $this->assertSame("012", $currency->getNumericalCode()); - $this->assertSame(null, $currency->getMinorUnitRate()); + self::assertSame("Test", $currency->getName()); + self::assertSame("ABC", $currency->getAlphabeticalCode()); + self::assertSame("012", $currency->getNumericalCode()); + self::assertSame(null, $currency->getMinorUnitRate()); } - /** - * @small - * - * @covers ::validateISO - * - * @return void - */ public function testCreateInvalidCurrency(): void { $this->expectException(InvalidCurrencyException::class); @@ -69,33 +52,18 @@ public function testCreateInvalidCurrency(): void // @phpcs:enable } - /** - * @small - * - * @covers ::is - * - * @return void - */ public function testIsSame(): void { $first = new ISOCurrency("TEST", "ABC", "012", null); $second = new ISOCurrency("TEST", "ABC", "012", null); $third = new ISOCurrency("TEST", "ABC", "123", null); - $this->assertTrue($first->is($first)); - $this->assertTrue($first->is($second)); + self::assertTrue($first->is($first)); + self::assertTrue($first->is($second)); - $this->assertFalse($first->is($third)); + self::assertFalse($first->is($third)); } - /** - * @small - * - * @covers \MiBo\Currencies\ISO\ISOCurrency::__construct - * @covers \MiBo\Currencies\ISO\ISOCurrency::validateISO - * - * @return void - */ public function testISOValidation(): void { $currency = new class implements CurrencyInterface { @@ -114,7 +82,7 @@ public function __toString(): string { return $this->getName(); } $this->fail("Failed to throw the mismatching exception because the currency is not an ISO currency!"); } catch (InvalidCurrencyException $exception) { - $this->assertSame( + self::assertSame( "Provided currency is not type of '$expectedClassName'. '$currencyClassName' provided.", $exception->getMessage() ); diff --git a/tests/Core/ISOManagerTest.php b/tests/Core/ISOManagerTest.php index 38a2115..b606c30 100644 --- a/tests/Core/ISOManagerTest.php +++ b/tests/Core/ISOManagerTest.php @@ -7,6 +7,8 @@ use MiBo\Currencies\ISO\ISOCurrencyProvider; use MiBo\Currencies\ISO\ISOListLoader; use MiBo\Currencies\ISO\ISOCurrencyManager; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Small; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; @@ -16,9 +18,9 @@ * @package MiBo\Currencies\Tests * * @author Michal Boris - * - * @coversDefaultClass \MiBo\Currencies\ISO\ISOCurrencyManager */ +#[CoversClass(ISOCurrencyManager::class)] +#[Small] class ISOManagerTest extends TestCase { private static ISOCurrencyManager $manager; @@ -54,14 +56,6 @@ public static function setUpBeforeClass(): void ); } - /** - * @small - * - * @covers ::__construct - * @covers ::getProvider - * - * @return void - */ public function testManager(): void { $manager = new ISOCurrencyManager( @@ -69,31 +63,22 @@ public function testManager(): void new NullLogger() ); - $this->assertSame([ISOListLoader::SOURCE_LOCAL], $manager->getProvider()->getLoader()->getResources()); + self::assertSame([ISOListLoader::SOURCE_LOCAL], $manager->getProvider()->getLoader()->getResources()); } - /** - * @small - * - * @covers ::isCurrencyValid - * @covers ::isCurrencyISO - * @covers ::getLogger - * - * @return void - */ public function testValidCurrencies(): void { - $this->assertTrue($this->getManager()->isCurrencyValid($this->getValidCurrency())); - $this->assertTrue($this->getManager()->isCurrencyISO($this->getValidCurrency())); + self::assertTrue($this->getManager()->isCurrencyValid($this->getValidCurrency())); + self::assertTrue($this->getManager()->isCurrencyISO($this->getValidCurrency())); - $this->assertTrue($this->getManager()->isCurrencyValid($this->getInvalidCurrency())); - $this->assertFalse($this->getManager()->isCurrencyISO($this->getInvalidCurrency())); + self::assertTrue($this->getManager()->isCurrencyValid($this->getInvalidCurrency())); + self::assertFalse($this->getManager()->isCurrencyISO($this->getInvalidCurrency())); - $this->assertFalse($this->getManager()->isCurrencyISO( + self::assertFalse($this->getManager()->isCurrencyISO( new ISOCurrency("TEST", "TTT", "012", 0) )); - $this->assertFalse($this->getManager()->isCurrencyISO( + self::assertFalse($this->getManager()->isCurrencyISO( new class implements CurrencyInterface { public function getName(): string { return ""; } public function getCode(): string { return ""; } diff --git a/tests/Core/ListLoaderTest.php b/tests/Core/ListLoaderTest.php index 71e97da..9a9e38b 100644 --- a/tests/Core/ListLoaderTest.php +++ b/tests/Core/ListLoaderTest.php @@ -4,6 +4,8 @@ use MiBo\Currencies\ISO\ISOListLoader; use MiBo\Currencies\ListLoader; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Small; use PHPUnit\Framework\TestCase; /** @@ -12,9 +14,10 @@ * @package MiBo\Currencies\Tests * * @author Michal Boris - * - * @coversDefaultClass \MiBo\Currencies\ListLoader */ +#[CoversClass(ListLoader::class)] +#[CoversClass(ISOListLoader::class)] +#[Small] class ListLoaderTest extends TestCase { private static ISOListLoader $loader; @@ -35,59 +38,32 @@ protected function setUp(): void $this->getLoader()->setResources(ISOListLoader::SOURCE_LOCAL); } - /** - * @small - * - * @covers ::setResources - * @covers \MiBo\Currencies\ISO\ISOListLoader::setResources - * - * @return void - * @throws \MiBo\Currencies\ISO\Exceptions\UnavailableCurrencyListException - */ public function testChangeResourceToLocal(): void { $this->getLoader()->setResources(ISOListLoader::SOURCE_LOCAL); - $this->assertSame(1, count($this->getLoader()->getResources())); - $this->assertSame(ISOListLoader::SOURCE_LOCAL, $this->getLoader()->getResources()[0]); + self::assertSame(1, count($this->getLoader()->getResources())); + self::assertSame(ISOListLoader::SOURCE_LOCAL, $this->getLoader()->getResources()[0]); $this->getLoader()->addResource(ISOListLoader::SOURCE_LOCAL); - $this->assertSame(1, count($this->getLoader()->getResources())); - $this->assertSame(ISOListLoader::SOURCE_LOCAL, $this->getLoader()->getResources()[0]); + self::assertSame(1, count($this->getLoader()->getResources())); + self::assertSame(ISOListLoader::SOURCE_LOCAL, $this->getLoader()->getResources()[0]); } - /** - * @small - * - * @covers ::setResources - * @covers \MiBo\Currencies\ISO\ISOListLoader::setResources - * - * @return void - * @throws \MiBo\Currencies\ISO\Exceptions\UnavailableCurrencyListException - */ public function testChangeResourceToOnline(): void { $this->getLoader()->setResources(ISOListLoader::SOURCE_WEB); - $this->assertSame(1, count($this->getLoader()->getResources())); - $this->assertSame(ISOListLoader::SOURCE_WEB, $this->getLoader()->getResources()[0]); + self::assertSame(1, count($this->getLoader()->getResources())); + self::assertSame(ISOListLoader::SOURCE_WEB, $this->getLoader()->getResources()[0]); $this->getLoader()->addResource(ISOListLoader::SOURCE_WEB); - $this->assertSame(1, count($this->getLoader()->getResources())); - $this->assertSame(ISOListLoader::SOURCE_WEB, $this->getLoader()->getResources()[0]); + self::assertSame(1, count($this->getLoader()->getResources())); + self::assertSame(ISOListLoader::SOURCE_WEB, $this->getLoader()->getResources()[0]); } - /** - * @small - * - * @covers ::addResource - * @covers \MiBo\Currencies\ISO\ISOListLoader::addResource - * - * @return void - * @throws \MiBo\Currencies\ISO\Exceptions\UnavailableCurrencyListException - */ public function testChangeResourceToInvalid(): void { $this->expectExceptionMessage("Cannot use custom list of ISO currencies!"); @@ -95,15 +71,6 @@ public function testChangeResourceToInvalid(): void $this->getLoader()->addResource("aRandomResource"); } - /** - * @small - * - * @covers ::setResources - * @covers \MiBo\Currencies\ISO\ISOListLoader::setResources - * - * @return void - * @throws \MiBo\Currencies\ISO\Exceptions\UnavailableCurrencyListException - */ public function testChangeResourcesToInvalid(): void { $this->expectExceptionMessage("Cannot use custom list of ISO currencies!"); @@ -111,26 +78,16 @@ public function testChangeResourcesToInvalid(): void $this->getLoader()->setResources("aRandomResource"); } - /** - * @small - * - * @covers ::loop - * @covers \MiBo\Currencies\ISO\ISOListLoader::loop - * @covers \MiBo\Currencies\ISO\ISOListLoader::contractLoop - * - * @return void - * @throws \MiBo\Currencies\ISO\Exceptions\UnavailableCurrencyListException - */ public function testLoop(): void { - $this->assertTrue(is_file(ISOListLoader::SOURCE_LOCAL)); + self::assertTrue(is_file(ISOListLoader::SOURCE_LOCAL)); foreach ($this->getLoader()->loop() as $object) { - $this->assertIsObject($object); + self::assertIsObject($object); - $this->assertNotNull($object->CtryNm); + self::assertNotNull($object->CtryNm); - $this->assertNotNull($object->CcyNm); + self::assertNotNull($object->CcyNm); return; } @@ -138,44 +95,20 @@ public function testLoop(): void $this->fail("Failed to loop the list."); } - /** - * @small - * - * @covers ::getResources - * @covers \MiBo\Currencies\ISO\ISOListLoader::getResources - * - * @return void - */ public function testResource(): void { - $this->assertIsArray($this->getLoader()->getResources()); + self::assertIsArray($this->getLoader()->getResources()); - $this->assertSame(1, count($this->getLoader()->getResources())); + self::assertSame(1, count($this->getLoader()->getResources())); } - /** - * @small - * - * @covers \MiBo\Currencies\ISO\ISOListLoader::__construct - * - * @return void - */ public function testConstruct(): void { self::$loader = new ISOListLoader(ISOListLoader::SOURCE_LOCAL); - $this->assertSame([ISOListLoader::SOURCE_LOCAL], $this->getLoader()->getResources()); + self::assertSame([ISOListLoader::SOURCE_LOCAL], $this->getLoader()->getResources()); } - /** - * @small - * - * @covers ::getResources - * @covers ::setResources - * @covers ::addResource - * - * @return void - */ public function testResources(): void { $loader = new class extends ListLoader { @@ -185,18 +118,17 @@ public function loop(): array } }; - $this->assertEmpty($loader->getResources()); + self::assertEmpty($loader->getResources()); $loader->setResources("myResource", "anotherResource"); - $this->assertSame(["myResource", "anotherResource"], $loader->getResources()); + self::assertSame(["myResource", "anotherResource"], $loader->getResources()); $loader->addResource("newResource"); - $this->assertSame(["myResource", "anotherResource", "newResource"], $loader->getResources()); + self::assertSame(["myResource", "anotherResource", "newResource"], $loader->getResources()); } - /** * @return \MiBo\Currencies\ISO\ISOListLoader */ diff --git a/tests/Core/OnlineProviderTest.php b/tests/Core/OnlineProviderTest.php index 2991f0e..248f5d0 100644 --- a/tests/Core/OnlineProviderTest.php +++ b/tests/Core/OnlineProviderTest.php @@ -3,6 +3,7 @@ namespace MiBo\Currencies\Tests; use MiBo\Currencies\ISO\ISOListLoader; +use PHPUnit\Framework\Attributes\CoversClass; /** * Class OnlineProviderTest @@ -11,6 +12,7 @@ * * @author Michal Boris */ +#[CoversClass(ISOListLoader::class)] class OnlineProviderTest extends ProviderTest { public static function setUpBeforeClass(): void diff --git a/tests/Core/ProviderTest.php b/tests/Core/ProviderTest.php index 1291628..cbf64ad 100644 --- a/tests/Core/ProviderTest.php +++ b/tests/Core/ProviderTest.php @@ -3,11 +3,13 @@ namespace MiBo\Currencies\Tests; use MiBo\Currencies\CurrencyInterface; -use MiBo\Currencies\ISO\Exceptions\InvalidCurrencyException; +use MiBo\Currencies\CurrencyProvider; use MiBo\Currencies\ISO\Exceptions\NoUniversalCurrencyException; use MiBo\Currencies\ISO\ISOCurrency; use MiBo\Currencies\ISO\ISOCurrencyProvider; use MiBo\Currencies\ISO\ISOListLoader; +use PHPUnit\Framework\Attributes\CoversClass; +use PHPUnit\Framework\Attributes\Medium; use PHPUnit\Framework\TestCase; use Psr\Log\NullLogger; @@ -17,9 +19,10 @@ * @package MiBo\Currencies\Tests * * @author Michal Boris - * - * @coversDefaultClass \MiBo\Currencies\CurrencyProvider */ +#[CoversClass(CurrencyProvider::class)] +#[CoversClass(ISOCurrencyProvider::class)] +#[Medium] class ProviderTest extends TestCase { protected static ISOCurrencyProvider $provider; @@ -43,40 +46,14 @@ public static function setUpBeforeClass(): void ); } - /** - * @medium - * - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findByName - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findBy - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findFirstBy - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::transformToCurrency - * - * @return void - * @throws NoUniversalCurrencyException - * @throws InvalidCurrencyException - */ public function testFindByName(): void { $foundCurrency = $this->getProvider() ->findByName($this->getCurrency()->getName()); - $this->assertTrue($this->getCurrency()->is($foundCurrency)); + self::assertTrue($this->getCurrency()->is($foundCurrency)); } - /** - * @medium - * - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::__construct - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findByAlphabeticalCode - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findBy - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findFirstBy - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::transformToCurrency - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::getLogger - * - * @return void - * @throws InvalidCurrencyException - * @throws NoUniversalCurrencyException - */ public function testFindByAlphabeticalCode(): void { $provider = new ISOCurrencyProvider($this->getProvider()->getLoader(), new NullLogger()); @@ -84,63 +61,31 @@ public function testFindByAlphabeticalCode(): void $foundCurrency = $provider ->findByAlphabeticalCode($this->getCurrency()->getAlphabeticalCode()); - $this->assertTrue($this->getCurrency()->is($foundCurrency)); + self::assertTrue($this->getCurrency()->is($foundCurrency)); } - /** - * @medium - * - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findByNumericalCode - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findBy - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findFirstBy - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::transformToCurrency - * - * @return void - * @throws InvalidCurrencyException - * @throws NoUniversalCurrencyException - */ public function testFindByNumericalCode(): void { $foundCurrency = $this->getProvider() ->findByNumericalCode($this->getCurrency()->getNumericalCode()); - $this->assertTrue($this->getCurrency()->is($foundCurrency)); + self::assertTrue($this->getCurrency()->is($foundCurrency)); } - /** - * @medium - * - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findByCountry - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findBy - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::transformToCurrency - * - * @return void - * @throws InvalidCurrencyException - * @throws NoUniversalCurrencyException - */ public function testFindByCountry(): void { $foundCurrencies = $this->getProvider() ->findByCountry("SLOVAKIA"); - $this->assertNotEmpty($foundCurrencies); + self::assertNotEmpty($foundCurrencies); - $this->assertSame(1, count($foundCurrencies)); + self::assertSame(1, count($foundCurrencies)); $foundCurrency = $foundCurrencies[0]; - $this->assertTrue($this->getCurrency()->is($foundCurrency)); + self::assertTrue($this->getCurrency()->is($foundCurrency)); } - /** - * @medium - * - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findBy - * - * @return void - * @throws InvalidCurrencyException - * @throws NoUniversalCurrencyException - */ public function testMissingCurrency(): void { $this->expectExceptionMessage("The ISO currency could not be found!"); @@ -148,16 +93,6 @@ public function testMissingCurrency(): void $this->getProvider()->findByNumericalCode("000"); } - /** - * @medium - * - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::findBy - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::transformToCurrency - * - * @return void - * @throws InvalidCurrencyException - * @throws NoUniversalCurrencyException - */ public function testNoUniversalCurrency(): void { $this->expectException(NoUniversalCurrencyException::class); @@ -165,24 +100,16 @@ public function testNoUniversalCurrency(): void $this->getProvider()->findByCountry("ANTARCTICA"); } - /** - * @medium - * - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::getLoader - * @covers \MiBo\Currencies\ISO\ISOCurrencyProvider::setLoader - * - * @return void - */ public function testLoader(): void { - $this->assertInstanceOf(ISOListLoader::class, $this->getProvider()->getLoader()); + self::assertInstanceOf(ISOListLoader::class, $this->getProvider()->getLoader()); $loader = $this->getProvider()->getLoader(); $this->getProvider()->setLoader(new ISOListLoader(ISOListLoader::SOURCE_LOCAL)); - $this->assertSame([ISOListLoader::SOURCE_LOCAL], $this->getProvider()->getLoader()->getResources()); + self::assertSame([ISOListLoader::SOURCE_LOCAL], $this->getProvider()->getLoader()->getResources()); $this->getProvider()->setLoader(new ISOListLoader(ISOListLoader::SOURCE_WEB)); - $this->assertSame([ISOListLoader::SOURCE_WEB], $this->getProvider()->getLoader()->getResources()); + self::assertSame([ISOListLoader::SOURCE_WEB], $this->getProvider()->getLoader()->getResources()); $this->getProvider()->setLoader($loader); }