コード例 #1
0
ファイル: UserContext.php プロジェクト: andrew-pits/Sylius
 /**
  * @Given there is user :email identified by :password, with :country as shipping country
  */
 public function thereIsUserWithShippingCountry($email, $password, $country)
 {
     $customer = $this->createCustomer();
     $user = $this->createUser($customer, $email, $password);
     $customer->setShippingAddress($this->createAddress($customer->getFirstName(), $customer->getLastName(), $country));
     $this->sharedStorage->setCurrentResource('user', $user);
     $this->userRepository->add($user);
 }
コード例 #2
0
ファイル: UserContext.php プロジェクト: Mangetsu/Sylius
 /**
  * @Given there is user :email identified by :password
  */
 public function thereIsUserIdentifiedBy($email, $password)
 {
     /** @var UserInterface $user */
     $user = $this->userFactory->createNew();
     $customer = $this->customerFactory->createNew();
     $customer->setFirstName('John');
     $customer->setLastName('Doe');
     $user->setCustomer($customer);
     $user->setUsername('John Doe');
     $user->setEmail($email);
     $user->setPlainPassword($password);
     $user->addRole('ROLE_USER');
     $this->sharedStorage->setCurrentResource('user', $user);
     $this->userRepository->add($user);
 }
コード例 #3
0
ファイル: ChannelContext.php プロジェクト: Andretti23/Sylius
 /**
  * @Given /^the store operates on (?:a|another) channel named "([^"]+)"$/
  */
 public function theStoreOperatesOnAChannelNamed($channelName)
 {
     $channel = $this->channelFactory->createNamed($channelName);
     $channel->setCode($channelName);
     $this->channelRepository->add($channel);
     $this->sharedStorage->setCurrentResource('channel', $channel);
 }
コード例 #4
0
ファイル: ProductContext.php プロジェクト: Andretti23/Sylius
 /**
  * @Given /^the store has a product "([^"]+)"$/
  * @Given /^the store has a product "([^"]+)" priced at "(?:€|£|\$)([^"]+)"$/
  */
 public function storeHasAProductPricedAt($productName, $price = '0.00')
 {
     $product = $this->productFactory->createNew();
     $product->setName($productName);
     $product->setPrice($this->getPriceFromString($price));
     $product->setDescription('Awesome ' . $productName);
     $channel = $this->sharedStorage->getCurrentResource('channel');
     $product->addChannel($channel);
     $this->productRepository->add($product);
     $this->sharedStorage->setCurrentResource('product', $product);
 }