示例#1
0
 /**
  * @covers \SebastianBergmann\Money\Money::allocateByRatios
  * @covers \SebastianBergmann\Money\Money::newMoney
  * @covers \SebastianBergmann\Money\Money::castToInt
  * @uses   \SebastianBergmann\Money\Money::__construct
  * @uses   \SebastianBergmann\Money\Money::handleCurrencyArgument
  * @uses   \SebastianBergmann\Money\Money::getAmount
  * @uses   \SebastianBergmann\Money\Money::assertInsideIntegerBounds
  * @uses   \SebastianBergmann\Money\Currency
  */
 public function testCanBeAllocatedByRatios()
 {
     $a = new Money(5, new Currency('EUR'));
     $r = $a->allocateByRatios(array(3, 7));
     $this->assertEquals(array(new Money(2, new Currency('EUR')), new Money(3, new Currency('EUR'))), $r);
 }
示例#2
0
 /**
  * @covers \SebastianBergmann\Money\Money::allocateByRatios
  * @covers \SebastianBergmann\Money\Money::newMoney
  * @covers \SebastianBergmann\Money\Money::castToInt
  * @uses   \SebastianBergmann\Money\Money::__construct
  * @uses   \SebastianBergmann\Money\Money::handleCurrencyArgument
  * @uses   \SebastianBergmann\Money\Money::getAmount
  * @uses   \SebastianBergmann\Money\Money::assertInsideIntegerBounds
  * @uses   \SebastianBergmann\Money\Money::multiply
  * @uses   \SebastianBergmann\Money\Currency
  */
 public function testNegativeAmountCanBeAllocatedByRatios()
 {
     $a = new Money(-5, new Currency('EUR'));
     $r = $a->allocateByRatios([3, 7]);
     $this->assertEquals([new Money(-2, new Currency('EUR')), new Money(-3, new Currency('EUR'))], $r);
 }