本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
}
示例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]);
}
示例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);
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}