function it_is_restricted_if_zone_matcher_match_customers_shipping_address(ProductInterface $product, $customerContext, $zoneMatcher, CustomerInterface $customer, AddressInterface $address, ProductInterface $product, ZoneInterface $zone) { $customerContext->getCustomer()->shouldBeCalled()->willReturn($customer); $customer->getShippingAddress()->shouldBeCalled()->willReturn($address); $product->getRestrictedZone()->shouldBeCalled()->willReturn($zone); $zoneMatcher->matchAll($address)->shouldBeCalled()->willReturn(array($zone)); $this->isRestricted($product)->shouldReturn(true); }
function it_is_restricted_if_zone_matcher_match_users_shipping_address(ProductInterface $product, $securityContext, $zoneMatcher, TokenInterface $token, UserInterface $user, AddressInterface $address, ProductInterface $product, ZoneInterface $zone) { $securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')->shouldBeCalled()->willReturn(true); $securityContext->getToken()->shouldBeCalled()->willReturn($token); $token->getUser()->shouldBeCalled()->willReturn($user); $user->getShippingAddress()->shouldBeCalled()->willReturn($address); $product->getRestrictedZone()->shouldBeCalled()->willReturn($zone); $zoneMatcher->matchAll($address)->shouldBeCalled()->willReturn(array($zone)); $this->isRestricted($product)->shouldReturn(true); }