Example #1
0
 /**
  * @Transform /^rest of the world$/
  * @Transform /^the rest of the world$/
  */
 public function getRestOfTheWorldZone()
 {
     $zone = $this->zoneRepository->findOneBy(['code' => 'RoW']);
     if (null === $zone) {
         throw new \Exception('Rest of the world zone does not exist.');
     }
     return $zone;
 }
Example #2
0
 /**
  * @Given /^there is rest of the world zone containing all other countries$/
  */
 public function thereIsRestOfTheWorldZoneContainingAllOtherCountries()
 {
     $restOfWorldCountries = array_diff(array_keys(Intl::getRegionBundle()->getCountryNames('en')), array_merge($this->euMembers, ['US']));
     $zone = $this->zoneFactory->createWithMembers($restOfWorldCountries);
     $zone->setType(ZoneInterface::TYPE_COUNTRY);
     $zone->setCode('RoW');
     $zone->setName('Rest of the World');
     $this->zoneRepository->add($zone);
 }
Example #3
0
 /**
  * @Given the store does not have any zones defined
  */
 public function theStoreDoesNotHaveAnyZonesDefined()
 {
     $zones = $this->zoneRepository->findAll();
     foreach ($zones as $zone) {
         $this->zoneRepository->remove($zone);
     }
 }
Example #4
0
 /**
  * @Given the store has a zone :zoneName with code :code
  * @Given the store also has a zone :zoneName with code :code
  */
 public function theStoreHasAZoneWithCode($zoneName, $code)
 {
     $zone = $this->zoneFactory->createTyped(ZoneInterface::TYPE_ZONE);
     $zone->setCode($code);
     $zone->setName($zoneName);
     $this->sharedStorage->set('zone', $zone);
     $this->zoneRepository->add($zone);
 }
Example #5
0
 /**
  * @Given /^the store ships everywhere for free$/
  */
 public function theStoreShipsEverywhereForFree()
 {
     foreach ($this->zoneRepository->findAll() as $zone) {
         $this->createShippingMethod('Free', null, $zone);
     }
 }
Example #6
0
 /**
  * @param array $parameters
  *
  * @return ZoneInterface
  */
 private function getZoneBy(array $parameters)
 {
     $existingZone = $this->zoneRepository->findOneBy($parameters);
     Assert::notNull($existingZone, 'Zone does not exist.');
     return $existingZone;
 }