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


PHP Money::GBP方法代码示例

本文整理汇总了PHP中Money\Money::GBP方法的典型用法代码示例。如果您正苦于以下问题:PHP Money::GBP方法的具体用法?PHP Money::GBP怎么用?PHP Money::GBP使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Money\Money的用法示例。


在下文中一共展示了Money::GBP方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: PaymentPlan

 function it_should_spread_the_bursary_when_the_plan_spans_multiple_years($baseCalculator, PaymentPlan $planBeforeBursary, PaymentPlan $finalPlan)
 {
     $baseCalculator->getPlan(Def::withName('Foo'), Money::GBP(250), Argument::any())->willReturn($planBeforeBursary);
     $planBeforeBursary->getPlannedPayments()->willReturn([PlannedPayment::immediate(Money::GBP(50)), PlannedPayment::withDueDate(Money::GBP(50), DueDate::fromString('2014-01-01')), PlannedPayment::withDueDate(Money::GBP(50), DueDate::fromString('2014-06-01')), PlannedPayment::withDueDate(Money::GBP(50), DueDate::fromString('2015-01-01')), PlannedPayment::withDueDate(Money::GBP(50), DueDate::fromString('2015-06-01'))]);
     $planBeforeBursary->getShortDescription()->willReturn('foo');
     $planBeforeBursary->getLongDescription()->willReturn('foofoo');
     $finalPlan = new PaymentPlan([PlannedPayment::immediate(Money::GBP(50)), PlannedPayment::withDueDate(Money::GBP(50), DueDate::fromString('2014-01-01')), PlannedPayment::withDueDate(Money::GBP(40), DueDate::fromString('2014-06-01')), PlannedPayment::withDueDate(Money::GBP(50), DueDate::fromString('2015-01-01')), PlannedPayment::withDueDate(Money::GBP(40), DueDate::fromString('2015-06-01'))], 'foo', 'foofoo');
     $this->getPlan(Def::withName('Foo'), Money::GBP(230), Params::fromArray(['bursary_total_deduction' => 20]))->shouldBeLike($finalPlan);
 }
开发者ID:cambridgeuniversity,项目名称:ice-paymentplan,代码行数:9,代码来源:BursaryOffFinalPaymentModifierSpec.php

示例2:

 function it_should_use_a_registered_modifier_when_it_is_part_of_the_plan_definition($basePlan, PlanModifierInterface $modifier, PaymentPlan $planProvidedByModifier, PaymentPlan $unmodifiedPlan)
 {
     $definition = PlanDefinition::withNameAndAttributesAsArray('Foo', ['modifiers' => ['mymodifier']]);
     $this->registerModifier('mymodifier', $modifier);
     $modifier->setBaseCalculator($basePlan)->shouldBeCalled();
     $modifier->getPlan($definition, Money::GBP(100), PlanParameters::none())->shouldBeCalled()->willReturn($planProvidedByModifier);
     $basePlan->getPlan(PlanDefinition::withName('Foo'), Money::GBP(100), PlanParameters::none())->willReturn($unmodifiedPlan);
     $this->getPlan($definition, Money::GBP(100), PlanParameters::none())->shouldReturn($planProvidedByModifier);
     $this->getPlan(PlanDefinition::withName('Foo'), Money::GBP(100), PlanParameters::none())->shouldReturn($unmodifiedPlan);
 }
开发者ID:cambridgeuniversity,项目名称:ice-paymentplan,代码行数:10,代码来源:ModifierAwareCalculatorSpec.php

示例3: calculateTotal

 /**
  * @return float
  */
 public function calculateTotal()
 {
     /** @var Money $total */
     $total = Money::GBP(0);
     foreach ($this->products as $product) {
         $unitPrice = $product->getUnitPrice() ?: Money::GBP(0);
         $total = $total->add($unitPrice);
     }
     return round($total->getAmount() / 100, 2);
 }
开发者ID:cirpo,项目名称:sainsburys-scraper,代码行数:13,代码来源:Products.php

示例4: getPlan

 /**
  * @param PlanDefinition $definition
  * @param Money $amountToPay
  * @param PlanParameters $parameters
  * @internal param string $planCode
  * @return \Ice\PaymentPlan\PaymentPlan
  */
 public function getPlan(PlanDefinition $definition, Money $amountToPay, PlanParameters $parameters)
 {
     if ($parameters->hasParameter('bursary_total_deduction') && ($bursaryTotalDeduction = intval($parameters->get('bursary_total_deduction'))) > 0) {
         $absoluteBursaryTotal = Money::GBP($bursaryTotalDeduction);
         $amountBeforeBursary = $amountToPay->add($absoluteBursaryTotal);
         $planWithoutBursary = $this->childCalculator->getPlan($definition, $amountBeforeBursary, $parameters);
         return $this->subtractBursaryFromPlan($planWithoutBursary, $absoluteBursaryTotal);
     }
     return $this->childCalculator->getPlan($definition, $amountToPay, $parameters);
 }
开发者ID:cambridgeuniversity,项目名称:ice-paymentplan,代码行数:17,代码来源:BursaryOffFinalPaymentModifier.php

示例5: productsProvider

 protected function productsProvider()
 {
     $products = new Products();
     $productA = new Product('Avocado', 'Best Avocado in town!', '32.23kb', Money::GBP(180));
     $productB = new Product('Apricot', 'Best Avocado in town!', '32.23kb', Money::GBP(150));
     $productC = new Product('Avocado x4', 'Great Avocado x4 deal', '32.23kb', Money::GBP(280));
     $products->add($productA);
     $products->add($productB);
     $products->add($productC);
     return $products;
 }
开发者ID:cirpo,项目名称:sainsburys-scraper,代码行数:11,代码来源:ProductsTest.php

示例6: testIntegration

 function testIntegration()
 {
     $definition = PlanDefinition::withNameAndAttributesAsArray('PercentOnDate', ['short_description' => '20/40/40 split', 'long_description' => '20% immediately, 40% on 2014/01/01, 40% on 2014/03/01, except that bursaries are always taken from the final instalment', 'payments' => ['immediate' => 0.2, '2014-01-01' => 0.4, '2014-03-01' => 0.4], 'modifiers' => ['bursary_off_final_payment']]);
     $params = PlanParameters::fromArray(['bursary_total_deduction' => 10]);
     $this->assertTrue($this->factory->isAvailable($definition, Money::GBP(90), $params));
     $plan = $this->factory->getPlan($definition, Money::GBP(90), $params);
     /**
      * The net booking cost is 90, which includes a 10 deduction for a bursary. Without the bursary, we'd expect
      * the 100 to be split as 20/40/40. With the bursary_off_final_payment modifier, this becomes 20/40/30
      */
     $this->assertEquals(new PaymentPlan([PlannedPayment::immediate(Money::GBP(20)), PlannedPayment::withDueDate(Money::GBP(40), DueDate::fromString('2014-01-01')), PlannedPayment::withDueDate(Money::GBP(30), DueDate::fromString('2014-03-01'))], '20/40/40 split', '20% immediately, 40% on 2014/01/01, 40% on 2014/03/01, except that bursaries are always taken from the final instalment'), $plan);
 }
开发者ID:cambridgeuniversity,项目名称:ice-paymentplan,代码行数:12,代码来源:IntegrationTest.php

示例7: testScrapeProducts

 public function testScrapeProducts()
 {
     $productListUrl = new Url('http://sainsbury.com/products');
     $productsDetailurls = [new Url('http://sainsbury.com/products/avocado'), new Url('http://sainsbury.com/products/apricot'), new Url('http://sainsbury.com/products/avocado-x4')];
     $productListScraper = $this->prophesize('Sainsburys\\Scraper\\ProductListScraper');
     $productDetailScraper = $this->prophesize('Sainsburys\\Scraper\\ProductDetailScraper');
     $productListScraper->extractProductLinks($productListUrl)->shouldBeCalled()->willReturn($productsDetailurls);
     $productDetailScraper->extractDetail($productsDetailurls[0])->shouldBeCalled()->willReturn(new Product('Avocado', 'Best Avocado in town!', '32.23kb', Money::GBP(180)));
     $productDetailScraper->extractDetail($productsDetailurls[1])->shouldBeCalled()->willReturn(new Product('Apricot', 'Best Avocado in town!', '32.23kb', Money::GBP(150)));
     $productDetailScraper->extractDetail($productsDetailurls[2])->shouldBeCalled()->willReturn(new Product('Avocado x4', 'Great Avocado x4 deal', '32.23kb', Money::GBP(280)));
     $productsInfoScraper = new ProductsInfoScraper($productListScraper->reveal(), $productDetailScraper->reveal());
     $products = $productsInfoScraper->extract($productListUrl);
     $this->assertInstanceOf('Sainsburys\\Model\\Products', $products);
 }
开发者ID:cirpo,项目名称:sainsburys-scraper,代码行数:14,代码来源:ProductsInfoScraperTest.php

示例8: 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

示例9: testFunction

 public function testFunction()
 {
     $calculator = $this->getContainer()->get('ice.payment_plan.calculator');
     $plan = $calculator->getPlan(PlanDefinition::withNameAndAttributesAsArray('PercentOnDate', ['short_description' => 'Test', 'long_description' => 'My test plan', 'payments' => ['immediate' => 0.4, '2016-01-01' => 0.6], 'modifiers' => ['bursary_off_final_payment']]), Money::GBP(1000), PlanParameters::none());
     $this->assertInstanceOf('Ice\\PaymentPlan\\PaymentPlan', $plan);
 }
开发者ID:cambridgeuniversity,项目名称:ice-paymentplan-bundle,代码行数:6,代码来源:BundleTest.php

示例10: PaymentPlan

 function it_should_return_a_plan_based_on_definition_attributes()
 {
     $expected = new PaymentPlan([PlannedPayment::immediate(Money::GBP(10)), PlannedPayment::withDueDate(Money::GBP(70), DueDate::fromString('2014-01-01')), PlannedPayment::withDueDate(Money::GBP(20), DueDate::fromString('2015-01-01'))], 'Foo', 'FooFoo');
     $this->getPlan(PlanDefinition::withNameAndAttributesAsArray('PercentOnDate', ['short_description' => 'Foo', 'long_description' => 'FooFoo', 'payments' => ['immediate' => 0.1, '2014-01-01' => 0.7, '2015-01-01' => 0.2]]), Money::GBP(100), PlanParameters::none())->shouldBeLike($expected);
 }
开发者ID:cambridgeuniversity,项目名称:ice-paymentplan,代码行数:5,代码来源:PercentOnDateCalculatorSpec.php

示例11:

 function it_should_use_a_calculator_to_return_a_plan(PaymentPlan $fooPlan, $delegatedFooCalculator)
 {
     $delegatedFooCalculator->getPlan(PlanDefinition::withName('Foo'), Money::GBP(100), PlanParameters::none())->willReturn($fooPlan);
     $this->getPlan(PlanDefinition::withName('Foo'), Money::GBP(100), PlanParameters::none())->shouldReturn($fooPlan);
 }
开发者ID:cambridgeuniversity,项目名称:ice-paymentplan,代码行数:5,代码来源:CompositePlanCalculatorSpec.php


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