-
Notifications
You must be signed in to change notification settings - Fork 443
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ad8605
commit 7979669
Showing
5 changed files
with
181 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Exchange; | ||
|
||
use Money\Currency; | ||
use Money\Exception\UnresolvableCurrencyPairException; | ||
use Money\Exchange\FixedExchange; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
/** @covers \Money\Exchange\FixedExchange */ | ||
final class FixedExchangeTest extends TestCase | ||
{ | ||
/** @test */ | ||
public function it_exchanges_currencies(): void | ||
{ | ||
$exchange = new FixedExchange(['EUR' => ['USD' => '1.2500']]); | ||
$currencyPair = $exchange->quote(new Currency('EUR'), new Currency('USD')); | ||
|
||
self::assertEquals('EUR', $currencyPair->getBaseCurrency()); | ||
self::assertEquals('USD', $currencyPair->getCounterCurrency()); | ||
self::assertEquals('1.2500', $currencyPair->getConversionRatio()); | ||
} | ||
|
||
/** @test */ | ||
public function it_throws_when_quoting_unknown_currency(): void | ||
{ | ||
$this->expectException(UnresolvableCurrencyPairException::class); | ||
$exchange = new FixedExchange(['EUR' => ['USD' => '1.2500']]); | ||
$exchange->quote(new Currency('EUR'), new Currency('SOME')); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters