当前位置: 首页>>代码示例>>PHP>>正文


PHP InjectableFixture::getSku方法代码示例

本文整理汇总了PHP中Magento\Mtf\Fixture\InjectableFixture::getSku方法的典型用法代码示例。如果您正苦于以下问题:PHP InjectableFixture::getSku方法的具体用法?PHP InjectableFixture::getSku怎么用?PHP InjectableFixture::getSku使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Mtf\Fixture\InjectableFixture的用法示例。


在下文中一共展示了InjectableFixture::getSku方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPrice

 /**
  * Returns the item price for the specified product.
  *
  * @param InjectableFixture $product
  * @return array|string
  */
 public function getPrice(InjectableFixture $product)
 {
     $productName = $product->getName();
     if ($product instanceof ConfigurableProduct) {
         // Find the price for the specific configurable product that was purchased
         $attributesData = $product->getConfigurableAttributesData()['attributes_data'];
         $matrix = $product->getConfigurableAttributesData()['matrix'];
         $checkoutOptions = $product->getCheckoutData()['options']['configurable_options'];
         $optionsDetails = [];
         $matrixKey = [];
         $optionsPrice = 0;
         foreach ($checkoutOptions as $checkoutOption) {
             $titleKey = $checkoutOption['title'];
             $valueKey = $checkoutOption['value'];
             $attributeName = $attributesData[$titleKey]['frontend_label'];
             $optionLabel = $attributesData[$titleKey]['options'][$valueKey]['label'];
             $optionsDetails[] = "{$attributeName}{$optionLabel}";
             $matrixKey[] = "{$titleKey}:{$valueKey}";
             $optionsPrice += $attributesData[$titleKey]['options'][$valueKey]['pricing_value'];
         }
         $optionsDetails = implode(' ', $optionsDetails);
         $matrixKey = implode(' ', $matrixKey);
         $productDisplay = $productName . 'SKU: ' . $matrix[$matrixKey]['sku'] . $optionsDetails;
     } else {
         $productDisplay = $productName . 'SKU: ' . $product->getSku();
     }
     $selector = '//tr[normalize-space(td)="' . $productDisplay . '"]' . $this->priceSelector;
     return $this->escapeCurrency($this->_rootElement->find($selector, Locator::SELECTOR_XPATH)->getText());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:35,代码来源:Items.php

示例2: processAssert

 /**
  * Assert that video is not displayed in admin panel.
  *
  * @param CatalogProductIndex $productGrid
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CatalogProductIndex $productGrid, InjectableFixture $product)
 {
     $filter = ['sku' => $product->getSku()];
     $productGrid->open();
     $productGrid->getProductGrid()->search($filter);
     $src = $productGrid->getProductGrid()->getBaseImageSource();
     \PHPUnit_Framework_Assert::assertTrue(strpos($src, '/placeholder/') !== false, 'Product image is displayed in product grid when it should not');
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:15,代码来源:AssertProductNoImageInGrid.php

示例3: processAssert

 /**
  * Assert that video data received from external service is correct.
  *
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductEdit $editProductPage
  * @param InjectableFixture $product
  * @param array $video
  * @return void
  */
 public function processAssert(CatalogProductIndex $productGrid, CatalogProductEdit $editProductPage, InjectableFixture $product, array $video)
 {
     $productGrid->open();
     $productGrid->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     $editProductPage->getProductForm()->openSection('images-and-videos');
     $imagesTab = $editProductPage->getProductForm()->getSection('images-and-videos');
     $result = $imagesTab->clickFirstVideo()->getVideoDialog()->validate($video);
     \PHPUnit_Framework_Assert::assertTrue($result, 'Video data received from external service is not correct.');
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:18,代码来源:AssertGetVideoInfoDataIsCorrect.php

示例4: getAssociatedItems

 /**
  * Get associated items for grouped product.
  *
  * @param InjectableFixture $product
  * @return array
  */
 protected function getAssociatedItems(InjectableFixture $product)
 {
     $cartItems = [];
     /** @var GroupedProduct $product */
     $associatedProducts = $product->getDataFieldConfig('associated')['source']->getProducts();
     foreach ($associatedProducts as $product) {
         $cartItems[$product->getSku()] = parent::getCartItem($product);
     }
     return $cartItems;
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:16,代码来源:GroupedProductCart.php

示例5: processAssert

 /**
  * Check whether the attribute is mandatory.
  *
  * @param CatalogProductIndex $catalogProductIndex
  * @param CatalogProductEdit $catalogProductEdit
  * @param CatalogProductAttribute $attribute
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, InjectableFixture $product)
 {
     $catalogProductIndex->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     $productForm = $catalogProductEdit->getProductForm();
     $productForm->getAttributeElement($attribute)->setValue('');
     $catalogProductEdit->getFormPageActions()->save();
     $failedAttributes = $productForm->getRequireNoticeAttributes($product);
     $actualMessage = $failedAttributes['product-details'][$attribute->getFrontendLabel()];
     \PHPUnit_Framework_Assert::assertEquals(self::REQUIRE_MESSAGE, $actualMessage, 'JS error notice on product edit page is not equal to expected.');
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:19,代码来源:AssertProductAttributeIsRequired.php

示例6: processAssert

 /**
  * Assert that configurable options available on configurable product Edit form on backend.
  *
  * @param CatalogProduct $catalogProductIndex
  * @param CatalogProductEdit $catalogProductEdit
  * @param CatalogProductAttribute $attribute
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CatalogProduct $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, InjectableFixture $product)
 {
     $options = $attribute->getOptions();
     $attributeOptionsFromFixture = [];
     foreach ($options as $option) {
         $attributeOptionsFromFixture[] = $option['admin'];
     }
     $catalogProductIndex->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     $productForm = $catalogProductEdit->getProductForm();
     $attributeOptions = $productForm->getAttributeElement($attribute)->getValues();
     \PHPUnit_Framework_Assert::assertEquals($attributeOptionsFromFixture, $attributeOptions);
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:21,代码来源:AssertAttributeOptionsOnProductForm.php

示例7: processAssert

 /**
  * Assert form data equals fixture data.
  *
  * @param InjectableFixture $product
  * @param CatalogProduct $productGrid
  * @param CatalogProductEdit $productPage
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProduct $productGrid, CatalogProductEdit $productPage)
 {
     $this->catalogProductEdit = $productPage;
     $filter = ['sku' => $product->getSku()];
     $productGrid->open();
     $productGrid->getProductGrid()->searchAndOpen($filter);
     $productData = $product->getData();
     $fixtureData = $this->prepareFixtureData($productData, $this->sortFields);
     $formData = $this->prepareFormData($productPage->getProductForm()->getData($product), $this->sortFields);
     $error = $this->verifyData($fixtureData, $formData);
     \PHPUnit_Framework_Assert::assertTrue(empty($error), $error);
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:20,代码来源:AssertProductForm.php

示例8: processAssert

 /**
  * Check whether the attribute is mandatory.
  *
  * @param CatalogProductIndex $catalogProductIndex
  * @param CatalogProductEdit $catalogProductEdit
  * @param CatalogProductAttribute $attribute
  * @param InjectableFixture $product
  * @param string $sectionName
  * @return void
  */
 public function processAssert(CatalogProductIndex $catalogProductIndex, CatalogProductEdit $catalogProductEdit, CatalogProductAttribute $attribute, InjectableFixture $product, $sectionName)
 {
     $catalogProductIndex->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     $productForm = $catalogProductEdit->getProductForm();
     if (!$productForm->checkAttributeLabel($attribute)) {
         $productForm->openSection($sectionName);
     }
     $productForm->getAttributeElement($attribute)->setValue('');
     $catalogProductEdit->getFormPageActions()->save();
     $validationErrors = $productForm->getSection($sectionName)->getValidationErrors();
     $actualMessage = isset($validationErrors[$attribute->getFrontendLabel()]) ? $validationErrors[$attribute->getFrontendLabel()] : '';
     \PHPUnit_Framework_Assert::assertEquals(self::REQUIRE_MESSAGE, $actualMessage, 'JS error notice on product edit page is not equal to expected.');
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:23,代码来源:AssertProductAttributeIsRequired.php

示例9: processAssert

 /**
  * Assert all product attribute options on product creation form.
  *
  * @param InjectableFixture $product
  * @param CatalogProductIndex $productGrid
  * @param CatalogProductAttribute $attribute
  * @param CatalogProductEdit $productEdit
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProductIndex $productGrid, CatalogProductAttribute $attribute, CatalogProductEdit $productEdit)
 {
     $productGrid->open();
     $productGrid->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     $attributeOptions = $attribute->getOptions();
     $options[] = $attribute->getFrontendLabel();
     foreach ($attributeOptions as $option) {
         $options[] = $option['admin'];
     }
     $productAttributeOptions = $productEdit->getProductForm()->getAttributeElement($attribute)->getText();
     $productOptions = explode("\n", $productAttributeOptions);
     $diff = array_diff($options, $productOptions);
     \PHPUnit_Framework_Assert::assertTrue(empty($diff), "Products attribute options are absent on product form: " . implode(', ', $diff));
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:23,代码来源:AssertAttributeOptionsOnProductForm.php

示例10: getPrice

 /**
  * Returns the item price for the specified product.
  *
  * @param InjectableFixture $product
  * @return array|string
  */
 public function getPrice(InjectableFixture $product)
 {
     $productName = $product->getName();
     if ($product instanceof ConfigurableProduct) {
         // Find the price for the specific configurable product that was purchased
         $configurableAttributes = $product->getConfigurableAttributes();
         $productOptions = $product->getCheckoutData()['options']['configurable_options'];
         $checkoutOption = reset($productOptions);
         $attributeKey = $checkoutOption['title'];
         $optionKey = $checkoutOption['value'];
         $attributeValue = $configurableAttributes[$attributeKey]['label']['value'];
         $optionValue = $configurableAttributes[$attributeKey][$optionKey]['option_label']['value'];
         $productDisplay = $productName . ' SKU: ' . $product->getVariationSku($checkoutOption);
         $productDisplay .= ' ' . $attributeValue . ' ' . $optionValue;
     } else {
         $productDisplay = $productName . ' SKU: ' . $product->getSku();
     }
     $selector = '//tr[normalize-space(td)="' . $productDisplay . '"]' . $this->priceSelector;
     return $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)->getText();
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:26,代码来源:Items.php

示例11: isNotDisplayingOnFrontendAssert

 /**
  * Verify product displaying on frontend.
  *
  * @param InjectableFixture $product
  * @return array
  */
 protected function isNotDisplayingOnFrontendAssert(InjectableFixture $product)
 {
     $errors = [];
     //Check that product is not available by url
     $this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
     if ($this->catalogProductView->getViewBlock()->isVisible()) {
         $errors[] = '- product view block is visible in product page.';
     }
     //Check that product can't be found
     $this->cmsIndex->open()->getSearchBlock()->search($product->getSku());
     if ($this->catalogSearchResult->getListProductBlock()->isProductVisible($product)) {
         $errors[] = '- successful product search.';
     }
     //Check that product is not available in category page
     $categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $this->category->getName();
     $this->cmsIndex->open()->getTopmenu()->selectCategory($categoryName);
     $isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product);
     $bottomToolBar = $this->catalogCategoryView->getBottomToolbar();
     while (!$isProductVisible && $bottomToolBar->nextPage()) {
         $isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product);
     }
     if ($isProductVisible) {
         $errors[] = "- product with name '{$product->getName()}' is found in this category.";
     }
     return $errors;
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:32,代码来源:AssertProductIsNotDisplayingOnFrontend.php

示例12: processAssert

 /**
  * Assert that created attribute is displayed on product form.
  *
  * @param InjectableFixture $product
  * @param CatalogProduct $productGrid
  * @param CatalogProductEdit $productEdit
  * @param CatalogProductAttribute $attribute
  * @return void
  */
 public function processAssert(InjectableFixture $product, CatalogProduct $productGrid, CatalogProductEdit $productEdit, CatalogProductAttribute $attribute)
 {
     $productGrid->open();
     $productGrid->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
     \PHPUnit_Framework_Assert::assertTrue($productEdit->getProductForm()->checkAttributeLabel($attribute->getData()), "Product Attribute is absent on Product form.");
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:15,代码来源:AssertAddedProductAttributeOnProductForm.php

示例13: run

 /**
  * Open products on backend.
  *
  * @return void
  */
 public function run()
 {
     $this->catalogProductIndex->open();
     $this->catalogProductIndex->getProductGrid()->searchAndOpen(['sku' => $this->product->getSku()]);
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:10,代码来源:OpenProductOnBackendStep.php

示例14: processAssert

 /**
  * Assert that product cannot be found via Quick Search using searchable product attributes.
  *
  * @param CatalogsearchResult $catalogSearchResult
  * @param CmsIndex $cmsIndex
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, InjectableFixture $product)
 {
     $cmsIndex->open();
     $cmsIndex->getSearchBlock()->search($product->getSku());
     \PHPUnit_Framework_Assert::assertFalse($catalogSearchResult->getListProductBlock()->isProductVisible($product), 'Product was found by SKU.');
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:14,代码来源:AssertProductNotSearchableBySku.php

示例15: assert

 /**
  * Check product on product grid.
  *
  * @param InjectableFixture $product
  * @param CatalogProduct $productGrid
  * @return void
  */
 public function assert(InjectableFixture $product, CatalogProduct $productGrid)
 {
     $filter = ['sku' => $product->getSku(), 'name' => $product->getName()];
     \PHPUnit_Framework_Assert::assertFalse($productGrid->getProductGrid()->isRowVisible($filter), "Product with sku {$filter['sku']} and name {$filter['name']} is present in Products grid.");
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:12,代码来源:AssertProductNotInGrid.php


注:本文中的Magento\Mtf\Fixture\InjectableFixture::getSku方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。