setMethod(RequestMethod::GET); Rest::request($request)->getBody(); self::$reachable = true; } catch (\Throwable $_) { self::$reachable = false; } } if (!self::$reachable) { $this->markTestSkipped( 'External currency conversion not available.' ); } } #[\PHPUnit\Framework\Attributes\Group('framework')] #[\PHPUnit\Framework\Attributes\TestDox('A currency can be converted from euro to another currency')] public function testCurrencyFromEur() : void { self::assertGreaterThan(0, Currency::fromEurTo(1, ISO4217CharEnum::_USD)); } #[\PHPUnit\Framework\Attributes\Group('framework')] #[\PHPUnit\Framework\Attributes\TestDox('A currency can be converted to euro from another currency')] public function testCurrencyToEur() : void { self::assertGreaterThan(0, Currency::fromToEur(1, ISO4217CharEnum::_USD)); } #[\PHPUnit\Framework\Attributes\Group('framework')] #[\PHPUnit\Framework\Attributes\TestDox('A currency can be converted from one currency to another currency')] public function testCurrency() : void { Currency::resetCurrencies(); self::assertGreaterThan(0, Currency::convertCurrency(1, ISO4217CharEnum::_USD, ISO4217CharEnum::_GBP)); } #[\PHPUnit\Framework\Attributes\Group('framework')] #[\PHPUnit\Framework\Attributes\TestDox('A currency conversion from eur to a invalid currency throws a InvalidArgumentException')] public function testInvalidFromEur() : void { self::assertLessThan(0, Currency::fromEurTo(1, 'ERROR')); } #[\PHPUnit\Framework\Attributes\Group('framework')] #[\PHPUnit\Framework\Attributes\TestDox('A currency conversion from a invalid currency to eur throws a InvalidArgumentException')] public function testInvalidToEur() : void { self::assertLessThan(0, Currency::fromToEur(1, 'ERROR')); } #[\PHPUnit\Framework\Attributes\Group('framework')] #[\PHPUnit\Framework\Attributes\TestDox('A currency conversion from a invalid currency to a invalid currency throws a InvalidArgumentException')] public function testInvalidConvert() : void { self::assertLessThan(0, Currency::convertCurrency(1, 'ERROR', 'TEST')); } }