本文整理汇总了PHP中Sylius\Component\Core\Model\ProductInterface类的典型用法代码示例。如果您正苦于以下问题:PHP ProductInterface类的具体用法?PHP ProductInterface怎么用?PHP ProductInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ProductInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
function it_generates_correct_hierarchy_when_product_does_not_have_archetype(ProductInterface $product)
{
$product->getMetadataIdentifier()->shouldBeCalled()->willReturn('Product-42');
$product->getMetadataClassIdentifier()->shouldBeCalled()->willReturn('Product');
$product->getArchetype()->shouldBeCalled()->willReturn(null);
$this->getHierarchyByMetadataSubject($product)->shouldReturn(['Product-42', 'Product', 'DefaultPage']);
}
示例2: isThereProduct
/**
* {@inheritdoc}
*/
public function isThereProduct(ProductInterface $product)
{
if (!($table = $this->getDocument()->find('css', 'table'))) {
return false;
}
$row = $this->tableManipulator->getRowWithFields($table, ['id' => $product->getId()]);
return null === $row;
}
示例3:
function it_is_restricted_if_zone_matcher_match_customers_shipping_address(ProductInterface $product, $customerContext, $zoneMatcher, CustomerInterface $customer, AddressInterface $address, ProductInterface $product, ZoneInterface $zone)
{
$customerContext->getCustomer()->shouldBeCalled()->willReturn($customer);
$customer->getShippingAddress()->shouldBeCalled()->willReturn($address);
$product->getRestrictedZone()->shouldBeCalled()->willReturn($zone);
$zoneMatcher->matchAll($address)->shouldBeCalled()->willReturn(array($zone));
$this->isRestricted($product)->shouldReturn(true);
}
示例4:
function it_recognizes_a_subject_as_not_eligible_if_a_product_taxon_is_not_matched(OrderInterface $subject, OrderItemInterface $item, ProductInterface $reflexBow, TaxonInterface $bows)
{
$configuration = ['taxons' => ['swords', 'axes']];
$bows->getCode()->willReturn('bows');
$reflexBow->getTaxons()->willReturn([$bows]);
$item->getProduct()->willReturn($reflexBow);
$subject->getItems()->willReturn([$item]);
$this->isEligible($subject, $configuration)->shouldReturn(false);
}
示例5: provideVariantsPrices
/**
* {@inheritdoc}
*/
public function provideVariantsPrices(ProductInterface $product)
{
$variantsPrices = [];
/** @var ProductVariantInterface $variant */
foreach ($product->getVariants() as $variant) {
$variantsPrices[] = $this->constructOptionsMap($variant);
}
return $variantsPrices;
}
示例6: hasProductValidTaxon
/**
* @param ProductInterface $product
* @param array $taxons
*
* @return bool
*/
private function hasProductValidTaxon(ProductInterface $product, array $taxons)
{
foreach ($product->getTaxons() as $taxon) {
if (in_array($taxon->getCode(), $taxons)) {
return true;
}
}
return false;
}
示例7: iDeleteTheProduct
/**
* @When /^I delete the ("[^"]+" product)$/
* @When /^I try to delete the ("([^"]+)" product)$/
*/
public function iDeleteTheProduct(ProductInterface $product)
{
try {
$this->sharedStorage->set('product_id', $product->getId());
$this->productRepository->remove($product);
} catch (DBALException $exception) {
$this->sharedStorage->set('last_exception', $exception);
}
}
示例8:
function it_is_restricted_if_zone_matcher_match_users_shipping_address(ProductInterface $product, $securityContext, $zoneMatcher, TokenInterface $token, UserInterface $user, AddressInterface $address, ProductInterface $product, ZoneInterface $zone)
{
$securityContext->isGranted('IS_AUTHENTICATED_REMEMBERED')->shouldBeCalled()->willReturn(true);
$securityContext->getToken()->shouldBeCalled()->willReturn($token);
$token->getUser()->shouldBeCalled()->willReturn($user);
$user->getShippingAddress()->shouldBeCalled()->willReturn($address);
$product->getRestrictedZone()->shouldBeCalled()->willReturn($zone);
$zoneMatcher->matchAll($address)->shouldBeCalled()->willReturn(array($zone));
$this->isRestricted($product)->shouldReturn(true);
}
示例9:
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);
}
示例10:
function it_provides_array_containing_product_variant_options_map_with_corresponding_price(ProductInterface $tShirt, ProductOptionValueInterface $black, ProductOptionValueInterface $large, ProductOptionValueInterface $small, ProductOptionValueInterface $white, ProductVariantInterface $blackLargeTShirt, ProductVariantInterface $blackSmallTShirt, ProductVariantInterface $whiteLargeTShirt, ProductVariantInterface $whiteSmallTShirt)
{
$tShirt->getVariants()->willReturn([$blackSmallTShirt, $whiteSmallTShirt, $blackLargeTShirt, $whiteLargeTShirt]);
$blackSmallTShirt->getOptionValues()->willReturn([$black, $small]);
$whiteSmallTShirt->getOptionValues()->willReturn([$white, $small]);
$blackLargeTShirt->getOptionValues()->willReturn([$black, $large]);
$whiteLargeTShirt->getOptionValues()->willReturn([$white, $large]);
$blackSmallTShirt->getPrice()->willReturn(1000);
$whiteSmallTShirt->getPrice()->willReturn(1500);
$blackLargeTShirt->getPrice()->willReturn(2000);
$whiteLargeTShirt->getPrice()->willReturn(2500);
$black->getOptionCode()->willReturn('t_shirt_color');
$white->getOptionCode()->willReturn('t_shirt_color');
$small->getOptionCode()->willReturn('t_shirt_size');
$large->getOptionCode()->willReturn('t_shirt_size');
$black->getValue()->willReturn('Black');
$white->getValue()->willReturn('White');
$small->getValue()->willReturn('Small');
$large->getValue()->willReturn('Large');
$this->provideVariantsPrices($tShirt)->shouldReturn([['t_shirt_color' => 'Black', 't_shirt_size' => 'Small', 'value' => 1000], ['t_shirt_color' => 'White', 't_shirt_size' => 'Small', 'value' => 1500], ['t_shirt_color' => 'Black', 't_shirt_size' => 'Large', 'value' => 2000], ['t_shirt_color' => 'White', 't_shirt_size' => 'Large', 'value' => 2500]]);
}
示例11: configureProductPricingCalculator
/**
* @param ProductInterface $product
* @param array $data
*/
private function configureProductPricingCalculator(ProductInterface $product, array $data)
{
$product->getMasterVariant()->setPricingCalculator($data['pricing calculator']);
if (!isset($data['calculator configuration']) || '' === $data['calculator configuration']) {
throw new \InvalidArgumentException('You must set chosen calculator configuration');
}
$product->getMasterVariant()->setPricingConfiguration($this->getPricingCalculatorConfiguration($data));
}
示例12: thisProductAverageRatingShouldBe
/**
* @Then /^average rating of (product "[^"]+") should be (\d+)$/
*/
public function thisProductAverageRatingShouldBe(ProductInterface $product, $averageRating)
{
$this->showPage->tryToOpen(['slug' => $product->getSlug()]);
$this->iShouldSeeAsItsAverageRating($averageRating);
}
示例13: setProductsQuantity
/**
* @param ProductInterface $product
* @param int $quantity
*/
private function setProductsQuantity(ProductInterface $product, $quantity)
{
$product->getFirstVariant()->setOnHand($quantity);
$this->saveProduct($product);
}
示例14:
function it_adds_taxon_to_product(ProductInterface $product, TaxonInterface $taxon)
{
$product->addTaxon($taxon)->shouldBeCalled();
$this->itBelongsTo($product, $taxon);
}
示例15: addTranslatedFields
protected function addTranslatedFields(ProductInterface $product, $translatedNames)
{
foreach ($translatedNames as $locale => $name) {
$product->setCurrentLocale($locale);
$product->setFallbackLocale($locale);
$product->setName($name);
$product->setDescription($this->fakers[$locale]->paragraph);
$product->setShortDescription($this->fakers[$locale]->sentence);
$product->setMetaKeywords(str_replace(' ', ', ', $this->fakers[$locale]->sentence));
$product->setMetaDescription($this->fakers[$locale]->sentence);
}
$product->setCurrentLocale($this->defaultLocale);
}