Example #1
0
 function it_matches_all_zones_by_scope_when_one_zone_for_address_is_defined(RepositoryInterface $repository, AddressInterface $address, ZoneMemberInterface $memberCountry, ZoneInterface $zoneCountry)
 {
     $repository->findBy(['scope' => 'shipping'])->willReturn([$zoneCountry]);
     $address->getCountryCode()->willReturn('US');
     $memberCountry->getCode()->willReturn('US');
     $zoneCountry->getType()->willReturn(ZoneInterface::TYPE_COUNTRY);
     $zoneCountry->getMembers()->willReturn([$memberCountry]);
     $memberCountry->getBelongsTo()->willReturn($zoneCountry);
     $this->matchAll($address, 'shipping')->shouldReturn([$zoneCountry]);
 }
Example #2
0
 function it_should_match_all_zones_by_scope_when_one_zone_for_address_is_defined($repository, CountryInterface $country, AddressInterface $address, ZoneMemberCountry $memberCountry, ZoneInterface $zoneCountry)
 {
     $repository->findBy(array('scope' => 'shipping'))->shouldBeCalled()->willReturn(array($zoneCountry));
     $address->getCountry()->shouldBeCalled()->willReturn($country);
     $memberCountry->getCountry()->shouldBeCalled()->willReturn($country);
     $zoneCountry->getType()->shouldBeCalled()->willReturn(ZoneInterface::TYPE_COUNTRY);
     $zoneCountry->getMembers()->shouldBeCalled()->willReturn(array($memberCountry));
     $memberCountry->getBelongsTo()->willReturn($zoneCountry);
     $this->matchAll($address, 'shipping')->shouldReturn(array($zoneCountry));
 }