本文整理汇总了PHP中Money\Money::EUR方法的典型用法代码示例。如果您正苦于以下问题:PHP Money::EUR方法的具体用法?PHP Money::EUR怎么用?PHP Money::EUR使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Money\Money
的用法示例。
在下文中一共展示了Money::EUR方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetData
public function testSetData()
{
\Locale::setDefault("fr_FR");
$form = $this->factory->create($this->moneyTypeClass, null, array("currency_type" => $this->currencyTypeClass));
$form->setData(Money::EUR(120));
$formView = $form->createView();
$this->assertEquals("1,20", $formView->children["tbbc_amount"]->vars["value"]);
}
示例2: testSetData
public function testSetData()
{
\Locale::setDefault("fr_FR");
$moneyType = new SimpleMoneyType($this->pairManager, 2);
$form = $this->factory->create($moneyType, null, array());
$form->setData(Money::EUR(120));
$formView = $form->createView();
$this->assertEquals("1,20", $formView->children["tbbc_amount"]->vars["value"]);
}
示例3: ConvertsEurToUsdAndBack
/** @test */
public function ConvertsEurToUsdAndBack()
{
$eur = Money::EUR(100);
$pair = new CurrencyPair(new Currency('EUR'), new Currency('USD'), 1.25);
$usd = $pair->convert($eur);
$this->assertEquals(Money::USD(125), $usd);
$pair = new CurrencyPair(new Currency('USD'), new Currency('EUR'), 0.8);
$eur = $pair->convert($usd);
$this->assertEquals(Money::EUR(100), $eur);
}
示例4: testMoneyTwigExtension
public function testMoneyTwigExtension()
{
\Locale::setDefault('en');
/** @var PairManagerInterface $pairManager */
$pairManager = $this->client->getContainer()->get("tbbc_money.pair_manager");
$pairManager->saveRatio("USD", 1.25);
/** @var MoneyExtension $moneyExtension */
$moneyExtension = $this->client->getContainer()->get("tbbc_money.twig.money");
$eur = Money::EUR(100);
$usd = $moneyExtension->convert($eur, "USD");
$this->assertEquals(Money::USD(125), $usd);
}
示例5: testRatio
public function testRatio()
{
$eur = Money::EUR(100);
$sameEur = $this->manager->convert($eur, "EUR");
$this->assertEquals(Money::EUR(100), $sameEur);
try {
$this->manager->convert($eur, "USD");
$this->assertTrue(false);
} catch (MoneyException $e) {
$this->assertTrue(true);
}
$this->manager->saveRatio("USD", 1.25);
$usd = $this->manager->convert($eur, "USD");
$this->assertEquals(Money::USD(125), $usd);
$this->manager->saveRatio("CAD", 1.5);
$cad = $this->manager->convert($usd, "CAD");
$this->assertEquals(Money::CAD(150), $cad);
}
示例6: testComparators
public function testComparators()
{
$this->assertTrue(Money::EUR(0)->isZero());
$this->assertTrue(Money::EUR(-1)->isNegative());
$this->assertTrue(Money::EUR(1)->isPositive());
$this->assertFalse(Money::EUR(1)->isZero());
$this->assertFalse(Money::EUR(1)->isNegative());
$this->assertFalse(Money::EUR(-1)->isPositive());
}
示例7: testConstructorWithMoney
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'));
}