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


PHP OrderInterface::getCustomer方法代码示例

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


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

示例1:

 function it_does_not_save_addresses_for_guest_order(CustomerAddressAdderInterface $addressAdder, OrderInterface $order, CustomerInterface $customer)
 {
     $order->getCustomer()->willReturn($customer);
     $customer->getUser()->willReturn(null);
     $addressAdder->add($customer, Argument::any())->shouldNotBeCalled();
     $addressAdder->add($customer, Argument::any())->shouldNotBeCalled();
     $this->saveAddresses($order);
 }
开发者ID:sylius,项目名称:core,代码行数:8,代码来源:CustomerOrderAddressesSaverSpec.php

示例2: saveAddresses

 /**
  * @param OrderInterface $order
  */
 public function saveAddresses(OrderInterface $order)
 {
     /** @var CustomerInterface $customer */
     $customer = $order->getCustomer();
     $shippingAddress = $order->getShippingAddress();
     $billingAddress = $order->getBillingAddress();
     $this->addressAdder->add($customer, clone $billingAddress);
     $this->addressAdder->add($customer, clone $shippingAddress);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:12,代码来源:CustomerOrderAddressesSaver.php

示例3:

 function it_saves_addresses_from_given_order(CustomerAddressAdderInterface $addressAdder, OrderInterface $order, CustomerInterface $customer, AddressInterface $shippingAddress, AddressInterface $billingAddress)
 {
     $order->getCustomer()->willReturn($customer);
     $order->getShippingAddress()->willReturn($shippingAddress);
     $order->getBillingAddress()->willReturn($billingAddress);
     $addressAdder->add($customer, clone $shippingAddress)->shouldBeCalled();
     $addressAdder->add($customer, clone $billingAddress)->shouldBeCalled();
     $this->saveAddresses($order);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:9,代码来源:CustomerOrderAddressesSaverSpec.php

示例4:

 function it_returns_false_if_subject_coupon_is_eligible_to_promotion_and_number_of_usages_is_bigger_than_coupon_usage_limit(OrderRepositoryInterface $orderRepository, OrderInterface $subject, PromotionInterface $promotion, CouponInterface $coupon, CustomerInterface $customer)
 {
     $subject->getPromotionCoupon()->willReturn($coupon);
     $promotion->isCouponBased()->willReturn(true);
     $subject->getCustomer()->willReturn($customer);
     $coupon->getPromotion()->willReturn($promotion);
     $coupon->getPerCustomerUsageLimit()->willReturn(5);
     $orderRepository->countByCustomerAndCoupon($customer, $coupon)->willReturn(6);
     $this->isEligible($subject, $promotion)->shouldReturn(false);
 }
开发者ID:ReissClothing,项目名称:Sylius,代码行数:10,代码来源:CouponsEligibilityCheckerSpec.php

示例5:

 function it_dispatches_event_and_returns_false_if_subject_coupon_is_eligible_to_promotion_and_number_of_usages_is_bigger_than_coupon_usage_limit(CouponInterface $coupon, CustomerInterface $customer, EventDispatcherInterface $eventDispatcher, OrderInterface $subject, OrderRepositoryInterface $orderRepository, PromotionInterface $promotion)
 {
     $subject->getPromotionCoupon()->willReturn($coupon);
     $coupon->getPromotion()->willReturn($promotion);
     $subject->getCustomer()->willReturn($customer);
     $coupon->getPerCustomerUsageLimit()->willReturn(5);
     $orderRepository->countByCustomerAndCoupon($customer, $coupon)->willReturn(6);
     $eventDispatcher->dispatch(SyliusPromotionEvents::COUPON_NOT_ELIGIBLE, Argument::type(GenericEvent::class))->shouldBeCalled();
     $this->isEligible($subject, $promotion)->shouldReturn(false);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:10,代码来源:CouponsEligibilityCheckerSpec.php

示例6:

 function it_recalculates_prices_without_adding_anything_to_the_context_if_its_not_needed(DelegatingCalculatorInterface $priceCalculator, OrderInterface $order, OrderItemInterface $item, PriceableInterface $variant)
 {
     $order->getCustomer()->willReturn(null);
     $order->getChannel()->willReturn(null);
     $order->getItems()->willReturn([$item]);
     $item->isImmutable()->willReturn(false);
     $item->getQuantity()->willReturn(5);
     $item->getVariant()->willReturn($variant);
     $priceCalculator->calculate($variant, ['quantity' => 5])->willReturn(10);
     $item->setUnitPrice(10)->shouldBeCalled();
     $this->recalculate($order);
 }
开发者ID:TeamNovatek,项目名称:Sylius,代码行数:12,代码来源:PricesRecalculatorSpec.php

示例7:

 function it_recalculates_prices_adding_customer_to_the_context(ChannelInterface $channel, CustomerGroupInterface $group, CustomerInterface $customer, OrderInterface $order, OrderItemInterface $item, ProductVariantInterface $variant, ProductVariantPriceCalculatorInterface $productVariantPriceCalculator)
 {
     $order->getCustomer()->willReturn($customer);
     $order->getChannel()->willReturn(null);
     $order->getItems()->willReturn([$item]);
     $order->getCurrencyCode()->willReturn(null);
     $customer->getGroup()->willReturn($group);
     $item->isImmutable()->willReturn(false);
     $item->getQuantity()->willReturn(5);
     $item->getVariant()->willReturn($variant);
     $order->getChannel()->willReturn($channel);
     $productVariantPriceCalculator->calculate($variant, ['channel' => $channel])->willReturn(10);
     $item->setUnitPrice(10)->shouldBeCalled();
     $this->process($order);
 }
开发者ID:sylius,项目名称:core,代码行数:15,代码来源:OrderPricesRecalculatorSpec.php

示例8: recalculate

 /**
  * {@inheritdoc}
  */
 public function recalculate(OrderInterface $order)
 {
     $context = [];
     if (null !== ($customer = $order->getCustomer())) {
         $context['customer'] = $customer;
         $context['groups'] = $customer->getGroups()->toArray();
     }
     if (null !== $order->getChannel()) {
         $context['channel'] = [$order->getChannel()];
     }
     foreach ($order->getItems() as $item) {
         if ($item->isImmutable()) {
             continue;
         }
         $context['quantity'] = $item->getQuantity();
         $item->setUnitPrice($this->priceCalculator->calculate($item->getVariant(), $context));
     }
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:21,代码来源:PricesRecalculator.php

示例9:

 function it_returns_true_if_promotion_subject_has_no_customer(OrderInterface $promotionSubject, CorePromotionCouponInterface $promotionCoupon)
 {
     $promotionSubject->getCustomer()->willReturn(null);
     $promotionCoupon->getPerCustomerUsageLimit()->willReturn(42);
     $this->isEligible($promotionSubject, $promotionCoupon)->shouldReturn(true);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:6,代码来源:PromotionCouponPerCustomerUsageLimitEligibilityCheckerSpec.php

示例10: sendConfirmationEmail

 /**
  * @param OrderInterface $order
  */
 public function sendConfirmationEmail(OrderInterface $order)
 {
     $this->emailSender->send(Emails::ORDER_CONFIRMATION, [$order->getCustomer()->getEmail()], ['order' => $order]);
 }
开发者ID:loic425,项目名称:Sylius,代码行数:7,代码来源:OrderEmailManager.php

示例11:

 function it_recognizes_subject_as_eligible_if_nth_order_is_equal_with_configured(CustomerInterface $customer, OrderInterface $subject, OrderRepositoryInterface $ordersRepository)
 {
     $subject->getCustomer()->willReturn($customer);
     $ordersRepository->countByCustomerAndPaymentState($customer, PaymentInterface::STATE_COMPLETED)->willReturn(9);
     $this->isEligible($subject, ['nth' => 10])->shouldReturn(true);
 }
开发者ID:okwinza,项目名称:Sylius,代码行数:6,代码来源:NthOrderRuleCheckerSpec.php

示例12:

 public function it_recognizes_subject_as_eligible_if_customer_not_linked_to_order_and_coupon_not_restricted_by_customer(OrderInterface $subject, PromotionInterface $promotion, CouponInterface $coupon)
 {
     $subject->getCustomer()->willReturn(null);
     $coupon->getCode()->willReturn('D0003');
     $coupon->getPerCustomerUsageLimit()->willReturn(0);
     $coupon->getPromotion()->willReturn($promotion);
     $subject->getPromotionCoupons()->willReturn(array($coupon));
     $promotion->hasRules()->willReturn(false);
     $promotion->getStartsAt()->willReturn(null);
     $promotion->getEndsAt()->willReturn(null);
     $promotion->isCouponBased()->willReturn(true);
     $promotion->hasCoupons()->willReturn(true);
     $promotion->hasCoupon($coupon)->willReturn(true);
     $promotion->getUsageLimit()->willReturn(null);
     $promotion->getCoupons()->willReturn(array($coupon));
     $this->isEligible($subject, $promotion)->shouldReturn(true);
 }
开发者ID:aleherse,项目名称:Sylius,代码行数:17,代码来源:PromotionEligibilityCheckerSpec.php

示例13:

 function it_should_recognize_subject_as_not_eligible_if_customer_is_created_before_configured(OrderInterface $subject, TimestampableInterface $customer)
 {
     $subject->getCustomer()->willReturn($customer);
     $customer->getCreatedAt()->willReturn(new \DateTime());
     $this->isEligible($subject, ['time' => 30, 'unit' => 'days', 'after' => true])->shouldReturn(true);
 }
开发者ID:gabiudrescu,项目名称:Sylius,代码行数:6,代码来源:CustomerLoyaltyRuleCheckerSpec.php

示例14: anEmailWithOrderConfirmationShouldBeSentTo

 /**
  * @Then /^an email with the summary of (order placed by "([^"]+)") should be sent to him$/
  */
 public function anEmailWithOrderConfirmationShouldBeSentTo(OrderInterface $order)
 {
     $this->assertEmailContainsMessageTo(sprintf('Your order no. %s has been successfully placed.', $order->getNumber()), $order->getCustomer()->getEmailCanonical());
 }
开发者ID:sylius,项目名称:sylius,代码行数:7,代码来源:EmailContext.php

示例15:

 function it_recognizes_a_subject_as_not_eligible_if_it_is_first_order_of_new_customer_and_promotion_is_for_more_than_one_order(CustomerInterface $customer, OrderInterface $subject)
 {
     $subject->getCustomer()->willReturn($customer);
     $customer->getId()->willReturn(null);
     $this->isEligible($subject, ['nth' => 10])->shouldReturn(false);
 }
开发者ID:TheMadeleine,项目名称:Sylius,代码行数:6,代码来源:NthOrderRuleCheckerSpec.php


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