本文整理汇总了PHP中Sylius\Component\Core\Test\Services\SharedStorageInterface::get方法的典型用法代码示例。如果您正苦于以下问题:PHP SharedStorageInterface::get方法的具体用法?PHP SharedStorageInterface::get怎么用?PHP SharedStorageInterface::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sylius\Component\Core\Test\Services\SharedStorageInterface
的用法示例。
在下文中一共展示了SharedStorageInterface::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defaultCurrencyIs
/**
* @Given default currency is :currencyCode
*/
public function defaultCurrencyIs($currencyCode)
{
$currency = $this->createCurrency($currencyCode);
$currency->setEnabled(true);
$channel = $this->sharedStorage->get('channel');
$channel->setDefaultCurrency($currency);
$this->saveCurrency($currency);
}
示例2: defaultCurrencyIs
/**
* @Given default currency is :currencyCode
*/
public function defaultCurrencyIs($currencyCode)
{
$currency = $this->currencyFactory->createNew();
$currency->setCode($currencyCode);
$currency->setExchangeRate(1.0);
$channel = $this->sharedStorage->get('channel');
$channel->setDefaultCurrency($currency);
$this->currencyRepository->add($currency);
}
示例3: storeHasAProductPricedAt
/**
* @Given /^the store has a product "([^"]+)"$/
* @Given /^the store has a product "([^"]+)" priced at ("[^"]+")$/
*/
public function storeHasAProductPricedAt($productName, $price = 0)
{
$product = $this->productFactory->createNew();
$product->setName($productName);
$product->setPrice($price);
$product->setDescription('Awesome ' . $productName);
$channel = $this->sharedStorage->get('channel');
$product->addChannel($channel);
$this->productRepository->add($product);
$this->sharedStorage->set('product', $product);
}
示例4: storeAllowsPaying
/**
* @Given the store allows paying :paymentMethodName
* @Given the store allows paying with :paymentMethodName
*/
public function storeAllowsPaying($paymentMethodName)
{
$paymentMethod = $this->paymentMethodFactory->createNew();
$paymentMethod->setCode('PM_' . $paymentMethodName);
$paymentMethod->setName(ucfirst($paymentMethodName));
$paymentMethod->setGateway($this->paymentMethodNameToGatewayConverter->convert($paymentMethodName));
$paymentMethod->setDescription('Payment method');
$channel = $this->sharedStorage->get('channel');
$channel->addPaymentMethod($paymentMethod);
$this->paymentMethodRepository->add($paymentMethod);
}
示例5:
function it_throws_runtime_exception_if_cannot_find_last_order_for_given_customer(SharedStorageInterface $sharedStorage, OrderRepositoryInterface $orderRepository, UserInterface $user, CustomerInterface $customer)
{
$sharedStorage->get('user')->willReturn($user);
$user->getCustomer()->willReturn($customer);
$orderRepository->findByCustomer($customer)->willReturn([]);
$this->shouldThrow(\RuntimeException::class)->during('iTryToPayAgain');
}
示例6:
function it_throws_exception_when_a_coupon_is_found_but_it_should_not_exist(SharedStorageInterface $sharedStorage, RepositoryInterface $couponRepository, CouponInterface $coupon)
{
$coupon->getId()->willReturn(5);
$sharedStorage->get('coupon_id')->willReturn(5);
$couponRepository->find(5)->willReturn($coupon);
$this->shouldThrow(NotEqualException::class)->during('couponShouldNotExistInTheRegistry', [5]);
}
示例7: myDefaultShippingAddressIs
/**
* @Given my default shipping address is :country
*/
public function myDefaultShippingAddressIs($country)
{
$user = $this->sharedStorage->get('user');
$customer = $user->getCustomer();
$customer->setShippingAddress($this->createAddress($customer->getFirstName(), $customer->getLastName(), $country));
$this->userManager->flush();
}
示例8:
function it_throws_an_exception_if_a_product_exists_when_it_should_not(SharedStorageInterface $sharedStorage, IndexPageInterface $adminProductIndexPage, ProductInterface $product)
{
$sharedStorage->get('product')->willReturn($product);
$adminProductIndexPage->open()->shouldBeCalled();
$adminProductIndexPage->isThereProduct($product)->willReturn(true);
$this->shouldThrow(NotEqualException::class)->during('productShouldNotExist', [$product]);
}
示例9: iShouldSeeTheThankYouPage
/**
* @Then I should see the thank you page
*/
public function iShouldSeeTheThankYouPage()
{
/** @var UserInterface $user */
$user = $this->sharedStorage->get('user');
$customer = $user->getCustomer();
expect($this->checkoutThankYouPage->hasThankYouMessageFor($customer->getFullName()))->toBe(true);
}
示例10: createOrder
/**
* @param CustomerInterface $customer
* @param string $number
* @param ChannelInterface|null $channel
* @param CurrencyInterface|null $currency
*
* @return OrderInterface
*/
private function createOrder(CustomerInterface $customer, $number, ChannelInterface $channel = null, CurrencyInterface $currency = null)
{
$order = $this->orderFactory->createNew();
$order->setCustomer($customer);
$order->setNumber($number);
$order->setChannel(null !== $channel ? $channel : $this->sharedStorage->get('channel'));
$order->setCurrency(null !== $currency ? $currency : $this->sharedStorage->get('currency'));
return $order;
}
示例11:
function it_checks_if_account_was_deleted(SharedStorageInterface $sharedStorage, UserInterface $user, CustomerInterface $customer, CustomerShowPage $customerShowPage)
{
$sharedStorage->get('deleted_user')->willReturn($user);
$user->getCustomer()->willReturn($customer);
$customer->getId()->willReturn(1);
$customerShowPage->open(['id' => 1])->shouldBeCalled();
$customerShowPage->isRegistered()->willReturn(false);
$this->accountShouldBeDeleted();
}
示例12:
function it_checks_if_customer_still_exists(ShowPageInterface $customerShowPage, SharedStorageInterface $sharedStorage, CustomerInterface $customer, UserInterface $user)
{
$sharedStorage->get('deleted_user')->shouldBeCalled()->willReturn($user);
$user->getCustomer()->willReturn($customer);
$customer->getId()->willReturn(1);
$customerShowPage->open(['id' => 1])->shouldBeCalled();
$customerShowPage->isRegistered()->willReturn(false);
$this->customerShouldStillExist();
}
示例13: getLastOrder
/**
* @return OrderInterface
*
* @throws \RuntimeException
*/
private function getLastOrder()
{
$customer = $this->sharedStorage->get('user')->getCustomer();
$orders = $this->orderRepository->findByCustomer($customer);
$lastOrder = end($orders);
if (false === $lastOrder) {
throw new \RuntimeException(sprintf('There is no last order for %s', $customer->getFullName()));
}
return $lastOrder;
}
示例14: thisProductIsAvailableInSize
/**
* @Given /^(this product) is available in "([^"]+)" size priced at ("[^"]+")$/
*/
public function thisProductIsAvailableInSize(ProductInterface $product, $optionValueName, $price)
{
/** @var ProductVariantInterface $variant */
$variant = $this->productVariantFactory->createNew();
$optionValue = $this->sharedStorage->get(sprintf('%s_option_value', $optionValueName));
$variant->addOption($optionValue);
$variant->setPrice($price);
$variant->setCode(sprintf("%s_%s", $product->getCode(), $optionValueName));
$product->addVariant($variant);
$this->objectManager->flush();
}
示例15:
function it_creates_a_review_for_a_given_product(SharedStorageInterface $sharedStorage, FactoryInterface $reviewFactory, RepositoryInterface $productReviewRepository, ProductInterface $product, ReviewInterface $review)
{
$sharedStorage->get('product')->willReturn($product);
$reviewFactory->createNew()->willReturn($review);
$review->setTitle('title')->shouldBeCalled();
$review->setRating(5)->shouldBeCalled();
$review->setReviewSubject($product)->shouldBeCalled();
$product->addReview($review)->shouldBeCalled();
$productReviewRepository->add($review);
$this->productHasAReview($product);
}