本文整理匯總了PHP中Magento\Mtf\Fixture\FixtureInterface::getSku方法的典型用法代碼示例。如果您正苦於以下問題:PHP FixtureInterface::getSku方法的具體用法?PHP FixtureInterface::getSku怎麽用?PHP FixtureInterface::getSku使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Mtf\Fixture\FixtureInterface
的用法示例。
在下文中一共展示了FixtureInterface::getSku方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: prepareFilter
/**
* Prepare filter for product grid.
*
* @return array
*/
protected function prepareFilter()
{
$productStatus = $this->product->getStatus() === null || $this->product->getStatus() === 'Product online' ? 'Enabled' : 'Disabled';
$filter = ['type' => $this->getProductType(), 'sku' => $this->product->getSku(), 'status' => $productStatus];
if ($this->product->hasData('attribute_set_id')) {
$filter['set_name'] = $this->product->getAttributeSetId();
}
return $filter;
}
示例2: processAssert
/**
* Assert that duplicated product is found by sku and has correct product type, product template,
* product status disabled and out of stock
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid)
{
$config = $product->getDataConfig();
$filter = ['name' => $product->getName(), 'visibility' => $product->getVisibility(), 'status' => 'Disabled', 'sku' => $product->getSku() . '-1', 'type' => ucfirst($config['create_url_params']['type']) . ' Product', 'price_to' => number_format($product->getPrice(), 2)];
$productGrid->open()->getProductGrid()->search($filter);
$filter['price_to'] = '$' . $filter['price_to'];
\PHPUnit_Framework_Assert::assertTrue($productGrid->getProductGrid()->isRowVisible($filter, false), 'Product duplicate is absent in Products grid.');
}
示例3: processAssert
/**
* Assert form data equals fixture data.
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$filter = ['sku' => $product->getSku() . '-1'];
$productGrid->open()->getProductGrid()->searchAndOpen($filter);
$formData = $productPage->getProductForm()->getData($product);
$fixtureData = $this->prepareFixtureData($product->getData());
$errors = $this->verifyData($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
示例4: verifySku
/**
* Verify displayed product sku on product page(front-end) equals passed from fixture
*
* @return string|null
*/
protected function verifySku()
{
$fixtureProductSku = $this->product->getSku();
$formProductSku = $this->productView->getProductSku();
if ($fixtureProductSku === null || $fixtureProductSku == $formProductSku) {
return null;
}
return "Displayed product sku on product page(front-end) not equals passed from fixture. " . "Actual: {$formProductSku}, expected: {$fixtureProductSku}.";
}
示例5: processAssert
/**
* Assert form data equals fixture data
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$filter = ['sku' => $product->getSku()];
$productGrid->open()->getProductGrid()->searchAndOpen($filter);
$fieldsForm = $productPage->getProductForm()->getData($product);
$fieldsFixture = $this->prepareFixtureData($product->getData());
$fieldsFixture['associated'] = $this->prepareGroupedOptions($fieldsFixture['associated']);
$errors = $this->verifyData($fieldsFixture, $fieldsForm);
\PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
示例6: findCartItems
/**
* Find cart item blocks for associated products.
*
* @param FixtureInterface $product
* @return array
*/
protected function findCartItems(FixtureInterface $product)
{
$cartItems = [];
/** @var GroupedProduct $product */
$associatedProducts = $product->getAssociated()['products'];
foreach ($associatedProducts as $product) {
$cartItems[$product->getSku()] = parent::getCartItem($product);
}
return $cartItems;
}
示例7: processAssert
/**
* Assert form data equals fixture data
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$filter = ['sku' => $product->getSku()];
$productGrid->open();
$productGrid->getProductGrid()->searchAndOpen($filter);
$productData = $product->getData();
if ($product->hasData('custom_options')) {
$customOptionsSource = $product->getDataFieldConfig('custom_options')['source'];
$productData['custom_options'] = $customOptionsSource->getCustomOptions();
}
$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);
}
示例8: processAssert
/**
* Assert that product can be searched via Quick Search using searchable product attributes (Search by SKU)
*
* @param CatalogsearchResult $catalogSearchResult
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @return void
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
{
$cmsIndex->open();
$sku = $product->hasData('sku') !== false ? $product->getSku() : $product->getName();
$cmsIndex->getSearchBlock()->search($sku);
$quantityAndStockStatus = $product->getQuantityAndStockStatus();
$stockStatus = isset($quantityAndStockStatus['is_in_stock']) ? $quantityAndStockStatus['is_in_stock'] : null;
$isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible();
while (!$isVisible && $catalogSearchResult->getBottomToolbar()->nextPage()) {
$isVisible = $catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible();
}
if ($product->getVisibility() === 'Catalog' || $stockStatus === 'Out of Stock') {
$isVisible = !$isVisible;
list($this->errorMessage, $this->successfulMessage) = [$this->successfulMessage, $this->errorMessage];
}
\PHPUnit_Framework_Assert::assertTrue($isVisible, $this->errorMessage);
}
示例9: processAssert
/**
* Assert form data equals duplicate product configurable data.
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$duplicateProductSku = $product->getSku() . '-1';
$filter = ['sku' => $duplicateProductSku];
$productGrid->open();
$productGrid->getProductGrid()->searchAndOpen($filter);
$productData = $product->getData();
$productData['sku'] = $duplicateProductSku;
$productData['status'] = 'Product offline';
if (isset($compareData['quantity_and_stock_status']['qty'])) {
$compareData['quantity_and_stock_status']['qty'] = '';
$compareData['quantity_and_stock_status']['is_in_stock'] = 'Out of Stock';
}
$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);
}
示例10: __construct
/**
* @constructor
* @param FixtureInterface $product
*/
public function __construct(FixtureInterface $product)
{
/** @var GroupedProduct $product */
$checkoutData = $product->getCheckoutData();
$this->data = isset($checkoutData['cartItem']) ? $checkoutData['cartItem'] : [];
$products = $product->getDataFieldConfig('associated')['source']->getProducts();
$cartItem = [];
$associatedProducts = [];
foreach ($products as $key => $product) {
$key = 'product_key_' . $key;
$associatedProducts[$key] = $product;
}
// Replace key in checkout data
foreach ($this->data as $fieldName => $fieldValues) {
foreach ($fieldValues as $key => $value) {
$cartItem[$fieldName][$associatedProducts[$key]->getSku()] = $value;
}
}
// Add empty "options" field
foreach ($associatedProducts as $product) {
$cartItem['options'][] = ['title' => $product->getName(), 'value' => $cartItem['qty'][$product->getSku()]];
}
$this->data = $cartItem;
}
示例11: getItemProductBlock
/**
* Get item product block.
*
* @param FixtureInterface $product
* @return Product
*/
public function getItemProductBlock(FixtureInterface $product)
{
$selector = sprintf($this->productItems, $product->getSku());
return $this->blockFactory->create('Magento\\Sales\\Test\\Block\\Adminhtml\\Order\\Creditmemo\\Form\\Items\\Product', ['element' => $this->_rootElement->find($selector, Locator::SELECTOR_XPATH)]);
}
示例12: getFailedItemBlock
/**
* Get failed item block.
*
* @param FixtureInterface $product
* @return Description
*/
public function getFailedItemBlock($product)
{
$item = $this->_rootElement->find(sprintf($this->failedItem, $product->getSku()), Locator::SELECTOR_XPATH);
return $this->blockFactory->create('Enterprise\\Checkout\\Test\\Block\\Adminhtml\\Sales\\Sku\\Errors\\Grid\\Description', ['element' => $item]);
}
示例13: processAssert
/**
* Assert that product cannot be found via Quick Search using searchable product attributes.
*
* @param CatalogsearchResult $catalogSearchResult
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @return void
*/
public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
{
$cmsIndex->open();
$cmsIndex->getSearchBlock()->search($product->getSku());
\PHPUnit_Framework_Assert::assertFalse($catalogSearchResult->getListProductBlock()->getProductItem($product)->isVisible(), 'Product was found by SKU.');
}
示例14: isNotDisplayingOnFrontendAssert
/**
* Verify product displaying on frontend
*
* @param FixtureInterface $product
* @return array
*/
protected function isNotDisplayingOnFrontendAssert(FixtureInterface $product)
{
$errors = [];
// Check the product page is not available
// TODO fix initialization url for frontend page
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$titleBlock = $this->catalogProductView->getTitleBlock();
if ($titleBlock->getTitle() !== self::NOT_FOUND_MESSAGE) {
$errors[] = '- the headline on the page does not match, the text should be -> "' . self::NOT_FOUND_MESSAGE . '".';
}
$this->cmsIndex->open();
$this->cmsIndex->getSearchBlock()->search($product->getSku());
if ($this->catalogSearchResult->getListProductBlock()->isProductVisible($product->getName())) {
$errors[] = '- successful product search.';
}
$categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $this->category->getName();
$this->cmsIndex->open();
$this->cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
while (!$isProductVisible && $this->catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
}
if ($isProductVisible) {
$errors[] = "- product with name '{$product->getName()}' is found in this category.";
}
return $errors;
}
示例15: getFailedItemBlock
/**
* Get failed item block.
*
* @param FixtureInterface|string $product
* @return Info
*/
protected function getFailedItemBlock($product)
{
$item = $this->_rootElement->find(sprintf($this->failedItem, $product->getSku()), Locator::SELECTOR_XPATH);
return $this->blockFactory->create('Enterprise\\Checkout\\Test\\Block\\Sku\\Products\\Info', ['element' => $item]);
}