Exemplo n.º 1
0
 function it_cant_missmatch_currencies(Money $money1, Money $money2)
 {
     $currency1 = new Currency('USD');
     $currency2 = new Currency('JPY');
     $money1->getAmount()->willReturn(1);
     $money1->__toString()->willReturn('1.00 USD');
     $money1->getCurrency()->willReturn($currency1);
     $money2->getAmount()->willReturn(2);
     $money2->__toString()->willReturn('2 JPY');
     $money2->getCurrency()->willReturn($currency2);
     $this->shouldThrow(new InvalidArgumentException('Cannot work with monies of differing currencies (1.00 USD, 2 JPY)'))->during('add', array($money1, $money2));
 }