Example #1
0
 /**
  * @expectedException InvalidArgumentException
  * @expectedExceptionMessage Can't create currency pair from ISO string '1.2500', format of string is invalid
  */
 public function ParsesIsoWithException()
 {
     CurrencyPair::createFromIso('1.2500');
 }
Example #2
0
 public function testConstructorWithMoney()
 {
     $price = new Price([Money::EUR(5), Money::USD(10), Money::GBP(10), 'TRY' => 120], [CurrencyPair::createFromIso('USD/CHF 1.5'), CurrencyPair::createFromIso('USD/AWG 1.0')]);
     $this->assertInstanceOf('Leaphly\\Price\\Price', $price);
     $this->assertEquals(15, $price->getAmount('CHF'));
 }
 /** @test */
 public function ParsesIso()
 {
     $pair = CurrencyPair::createFromIso('EUR/USD 1.2500');
     $expected = new CurrencyPair(new Currency('EUR'), new Currency('USD'), 1.25);
     $this->assertEquals($expected, $pair);
 }