当前位置: 首页>>代码示例>>PHP>>正文


PHP Money::EUR方法代码示例

本文整理汇总了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"]);
 }
开发者ID:BboyKeen,项目名称:TbbcMoneyBundle,代码行数:8,代码来源:MoneyTypeTest.php

示例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"]);
 }
开发者ID:lakhman,项目名称:TbbcMoneyBundle,代码行数:9,代码来源:SimpleMoneyTypeTest.php

示例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);
 }
开发者ID:SerdarSanri,项目名称:laravel-money,代码行数:11,代码来源:CurrencyPairTest.php

示例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);
 }
开发者ID:stalxed,项目名称:TbbcMoneyBundle,代码行数:12,代码来源:ConfigTest.php

示例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);
 }
开发者ID:stalxed,项目名称:TbbcMoneyBundle,代码行数:18,代码来源:PairManagerTest.php

示例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());
 }
开发者ID:hemeragestao,项目名称:money,代码行数:9,代码来源:MoneyTest.php

示例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'));
 }
开发者ID:leaphly,项目名称:price,代码行数:6,代码来源:ConversionPriceTest.php


注:本文中的Money\Money::EUR方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。