本文整理汇总了PHP中Sylius\Component\Core\Test\Services\SharedStorageInterface类的典型用法代码示例。如果您正苦于以下问题:PHP SharedStorageInterface类的具体用法?PHP SharedStorageInterface怎么用?PHP SharedStorageInterface使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SharedStorageInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
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]);
}
示例2:
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');
}
示例3:
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();
}
示例4:
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();
}
示例5:
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');
}
示例6:
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();
}
示例7:
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']);
}
示例8:
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');
}
示例9:
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');
}
示例10: iAmLoggedInAsAnAdministrator
/**
* @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);
}
示例11: theStoreHasDisabledCountry
/**
* @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);
}
示例12: theStoreOperatesOnAChannelNamed
/**
* @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);
}
示例13: iShouldSeeTheThankYouPage
/**
* @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()));
}
示例14: theStoreHasAProductOptionWithACode
/**
* @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);
}
示例15: iSetChannelThemeTo
/**
* @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);
}