php Sylius-Component-Core-Test-Services-SharedStorageInterface类(方法)实例源码

下面列出了php Sylius-Component-Core-Test-Services-SharedStorageInterface 类(方法)源码代码实例,从而了解它的用法。

作者:ahmadrabi    项目:Syliu   
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]);
 }

作者:ahmadrabi    项目:Syliu   
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');
 }

作者:stevedie    项目:Syliu   
function it_sets_default_channel_in_the_shared_storage(SharedStorageInterface $sharedStorage, DefaultStoreDataInterface $defaultFranceChannelFactory, ChannelInterface $channel, ZoneInterface $zone)
 {
     $defaultData = ['channel' => $channel, 'zone' => $zone];
     $defaultFranceChannelFactory->create()->willReturn($defaultData);
     $sharedStorage->setClipboard($defaultData)->shouldBeCalled();
     $this->thatStoreIsOperatingOnASingleChannel();
 }

作者:ahmadrabi    项目:Syliu   
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();
 }

作者:ahmadrabi    项目:Syliu   
function it_creates_a_tax_category_with_name_and_code(SharedStorageInterface $sharedStorage, TaxCategoryInterface $taxCategory, TaxCategoryRepositoryInterface $taxCategoryRepository, FactoryInterface $taxCategoryFactory)
 {
     $taxCategoryFactory->createNew()->willReturn($taxCategory);
     $taxCategory->setName('Alcohol')->shouldBeCalled();
     $taxCategory->setCode('alcohol')->shouldBeCalled();
     $taxCategoryRepository->add($taxCategory)->shouldBeCalled();
     $sharedStorage->set('tax_category', $taxCategory)->shouldBeCalled();
     $this->theStoreHasTaxCategoryWithCode('Alcohol', 'alcohol');
 }

作者:vikey8    项目:Syliu   
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();
 }

作者:ahmadrabi    项目:Syliu   
function it_throws_invalid_argument_exception_if_cannot_convert_locale_name_to_code(FactoryInterface $localeFactory, LocaleInterface $locale, LocaleNameConverterInterface $localeNameConverter, RepositoryInterface $localeRepository, SharedStorageInterface $sharedStorage)
 {
     $localeFactory->createNew()->willReturn($locale);
     $localeNameConverter->convertToCode('xyz')->willThrow(\InvalidArgumentException::class);
     $locale->setCode('no')->shouldNotBeCalled();
     $sharedStorage->set('locale', $locale)->shouldNotBeCalled();
     $localeRepository->add($locale)->shouldNotBeCalled();
     $this->shouldThrow(\InvalidArgumentException::class)->during('theStoreHasLocale', ['xyz']);
     $this->shouldThrow(\InvalidArgumentException::class)->during('theStoreHasDisabledLocale', ['xyz']);
 }

作者:ahmadrabi    项目:Syliu   
function it_configures_that_store_operates_in_given_country_disabled_by_default(CountryInterface $country, CountryNameConverterInterface $nameToCodeConverter, FactoryInterface $countryFactory, RepositoryInterface $countryRepository, SharedStorageInterface $sharedStorage)
 {
     $countryFactory->createNew()->willReturn($country);
     $nameToCodeConverter->convertToCode('France')->willReturn('FR');
     $country->setCode('FR')->shouldBeCalled();
     $country->disable()->shouldBeCalled();
     $sharedStorage->set('country', $country)->shouldBeCalled();
     $countryRepository->add($country)->shouldBeCalled();
     $this->theStoreHasDisabledCountry('France');
 }

作者:Moza    项目:Syliu   
function it_creates_fixed_discount_promotion_for_cart_with_specified_quantity(ActionFactoryInterface $actionFactory, ActionInterface $action, ObjectManager $objectManager, PromotionInterface $promotion, RuleFactoryInterface $ruleFactory, RuleInterface $rule, SharedStorageInterface $sharedStorage)
 {
     $sharedStorage->get('promotion')->willReturn($promotion);
     $actionFactory->createFixedDiscount(1000)->willReturn($action);
     $promotion->addAction($action)->shouldBeCalled();
     $ruleFactory->createCartQuantity(5)->willReturn($rule);
     $promotion->addRule($rule)->shouldBeCalled();
     $objectManager->flush()->shouldBeCalled();
     $this->itGivesFixedDiscountToEveryOrderWithQuantityAtLeast($promotion, 1000, '5');
 }

作者:ahmadrabi    项目:Syliu   
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);
 }

作者:starspir    项目:eventmanage   
function it_adds_single_item_by_customer(FactoryInterface $orderItemFactory, OrderInterface $order, OrderItemInterface $item, OrderItemQuantityModifierInterface $itemQuantityModifier, ProductInterface $product, SharedStorageInterface $sharedStorage, ProductVariantInterface $variant, ObjectManager $objectManager)
 {
     $sharedStorage->get('order')->willReturn($order);
     $orderItemFactory->createNew()->willReturn($item);
     $product->getMasterVariant()->willReturn($variant);
     $product->getPrice()->willReturn(1234);
     $itemQuantityModifier->modify($item, 1)->shouldBeCalled();
     $item->setVariant($variant)->shouldBeCalled();
     $item->setUnitPrice(1234)->shouldBeCalled();
     $order->addItem($item)->shouldBeCalled();
     $objectManager->flush()->shouldBeCalled();
     $this->theCustomerBoughtSingle($product);
 }

作者:okwinz    项目:Syliu   
/**
  * @Given I am logged in as an administrator
  */
 public function iAmLoggedInAsAnAdministrator()
 {
     $admin = $this->testUserFactory->createDefaultAdmin();
     $this->userRepository->add($admin);
     $this->securityService->logIn($admin->getEmail());
     $this->sharedStorage->set('admin', $admin);
 }

作者:ahmadrabi    项目:Syliu   
/**
  * @Given /^the store has disabled country "([^"]*)"$/
  */
 public function theStoreHasDisabledCountry($countryName)
 {
     $country = $this->createCountryNamed(trim($countryName));
     $country->disable();
     $this->sharedStorage->set('country', $country);
     $this->countryRepository->add($country);
 }

作者:ahmadrabi    项目:Syliu   
/**
  * @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->set('channel', $channel);
 }

作者:Spomk    项目:Syliu   
/**
  * @Then I should see the thank you page
  */
 public function iShouldSeeTheThankYouPage()
 {
     $user = $this->sharedStorage->getCurrentResource('user');
     $customer = $user->getCustomer();
     $thankYouPage = $this->getPage('Checkout\\CheckoutThankYouPage');
     $thankYouPage->assertRoute();
     $this->assertSession()->elementTextContains('css', '#thanks', sprintf('Thank you %s', $customer->getFullName()));
 }

作者:okwinz    项目:Syliu   
/**
  * @Given the store has a product option :productOptionName with a code :productOptionCode
  */
 public function theStoreHasAProductOptionWithACode($productOptionName, $productOptionCode)
 {
     $productOption = $this->productOptionFactory->createNew();
     $productOption->setCode($productOptionCode);
     $productOption->setName($productOptionName);
     $this->sharedStorage->set('product_option', $productOption);
     $this->productOptionRepository->add($productOption);
 }

作者:okwinz    项目:Syliu   
/**
  * @When I set :channel channel theme to :theme
  */
 public function iSetChannelThemeTo(ChannelInterface $channel, ThemeInterface $theme)
 {
     $this->channelUpdatePage->open(['id' => $channel->getId()]);
     $this->channelUpdatePage->setTheme($theme);
     $this->channelUpdatePage->saveChanges();
     $this->sharedStorage->set('channel', $channel);
     $this->sharedStorage->set('theme', $theme);
 }

作者:ahmadrabi    项目:Syliu   
/**
  * @Given the store has disabled locale :localeName
  */
 public function theStoreHasDisabledLocale($localeName)
 {
     $locale = $this->localeFactory->createNew();
     $locale->setCode($this->localeNameConverter->convertToCode($localeName));
     $locale->disable();
     $this->sharedStorage->set('locale', $locale);
     $this->localeRepository->add($locale);
 }

作者:andrew-pit    项目:Syliu   
/**
  * @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);
 }

作者:Spomk    项目:Syliu   
/**
  * @Given default currency is :currencyCode
  */
 public function defaultCurrencyIs($currencyCode)
 {
     $currency = $this->currencyFactory->createNew();
     $currency->setCode($currencyCode);
     $currency->setExchangeRate(1.0);
     $channel = $this->sharedStorage->getCurrentResource('channel');
     $channel->setDefaultCurrency($currency);
     $this->currencyRepository->add($currency);
 }


问题


面经


文章

微信
公众号

扫码关注公众号