public function testIndirectConversion() { $converter = new Map(new Mint(new Simple())); $converter->addMapping('USD', 'GBP', '0.5000'); $converter->addMapping('GBP', 'EUR', '0.5000'); $money = new Money('10', new Currency('USD'), 4); $converted = $converter->convert($money, new Currency('EUR')); $this->assertSame('EUR', $converted->getCurrency()->getCode()); $this->assertSame('2.5000', $converted->getValue()); }
public function __construct() { $converter = new Map(new Mint(new Simple())); $converter->addMapping('GBP', 'USD', '2.0000'); $converter->addMapping('USD', 'GBP', '0.5000'); $this->comparator = new Comparator($converter); $usd = new Currency('USD'); $this->first = new Money('3.0000', $usd, 4); $this->second = new Money('3', $usd, 0); $this->third = new Money('3', new Currency('GBP'), 0); }
public function __construct() { $converter = new Map(new Mint(new Simple())); $converter->addMapping('GBP', 'USD', '2.0000'); $converter->addMapping('USD', 'GBP', '0.5000'); $this->broker = new Broker($converter, new Mint(new Simple(), 4)); $this->usd = new Currency('USD'); $this->pound = new Currency('GBP'); $this->first = new Money('3.0000', $this->usd, 4); $this->second = new Money('3', $this->usd, 0); $this->third = new Money('3', $this->pound, 0); }