本文整理汇总了PHP中Magento\Catalog\Test\Fixture\CatalogProductSimple::getCategoryIds方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductSimple::getCategoryIds方法的具体用法?PHP CatalogProductSimple::getCategoryIds怎么用?PHP CatalogProductSimple::getCategoryIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Test\Fixture\CatalogProductSimple
的用法示例。
在下文中一共展示了CatalogProductSimple::getCategoryIds方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addToCardPresentOnProduct
/**
* "Add to cart" button is display on Product page
*
* @return void
*/
protected function addToCardPresentOnProduct()
{
$this->cmsIndex->open();
$this->cmsIndex->getTopmenu()->selectCategoryByName($this->product->getCategoryIds()[0]);
$this->catalogCategoryView->getListProductBlock()->openProductViewPage($this->product->getName());
\PHPUnit_Framework_Assert::assertTrue($this->catalogProductView->getViewBlock()->checkAddToCardButton(), "Button 'Add to Card' is absent on Product page.");
}
示例2: processAssert
/**
* Assert that product is displayed in related products section
*
* @param CatalogProductSimple $product1
* @param CatalogProductSimple $product2
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(CatalogProductSimple $product1, CatalogProductSimple $product2, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView)
{
$categoryName = $product1->getCategoryIds()[0];
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product1->getName());
\PHPUnit_Framework_Assert::assertTrue($catalogProductView->getRelatedProductBlock()->isRelatedProductVisible($product2->getName()), 'Product \'' . $product2->getName() . '\' is absent in related products.');
}
示例3: processAssert
/**
* Assert that product is not displayed in up-sell section
*
* @param CatalogProductSimple $product1
* @param CatalogProductSimple $product2
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(CatalogProductSimple $product1, CatalogProductSimple $product2, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView)
{
$categoryName = $product1->getCategoryIds()[0]['name'];
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product1->getName());
\PHPUnit_Framework_Assert::assertFalse($catalogProductView->getUpsellBlock()->isUpsellProductVisible($product2->getName()), 'Product \'' . $product2->getName() . '\' is exist in up-sells products.');
}
示例4: processAssert
/**
* Assert that product is displayed in cross-sell section
*
* @param CatalogProductSimple $product1
* @param CatalogProductSimple $product2
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @return void
*/
public function processAssert(CatalogProductSimple $product1, CatalogProductSimple $product2, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart)
{
$categoryName = $product1->getCategoryIds()[0];
$checkoutCart->open();
$checkoutCart->getCartBlock()->clearShoppingCart();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product1->getName());
$catalogProductView->getViewBlock()->addToCart($product1);
\PHPUnit_Framework_Assert::assertTrue($checkoutCart->getCrosssellBlock()->verifyProductCrosssell($product2), 'Product \'' . $product2->getName() . '\' is absent in cross-sell section.');
}
示例5: processAssert
/**
* Assert that after applying changes, currency symbol changed on Catalog page
*
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductSimple $product
* @param CurrencySymbolEntity $currencySymbol
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductSimple $product, CurrencySymbolEntity $currencySymbol)
{
$categoryName = $product->getCategoryIds()[0];
$cmsIndex->open();
$cmsIndex->getCurrencyBlock()->switchCurrency($currencySymbol);
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$price = $catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock()->getPrice('');
preg_match('`(.*?)\\d`', $price, $matches);
$symbolOnPage = isset($matches[1]) ? $matches[1] : null;
\PHPUnit_Framework_Assert::assertEquals($currencySymbol->getCustomCurrencySymbol(), $symbolOnPage, 'Wrong Currency Symbol is displayed on Category page.');
}
示例6: processAssert
/**
* Assert that product url in url rewrite grid.
*
* @param CatalogProductSimple $product
* @param CatalogProductSimple $initialProduct
* @param UrlRewriteIndex $urlRewriteIndex
* @return void
*/
public function processAssert(CatalogProductSimple $product, CatalogProductSimple $initialProduct, UrlRewriteIndex $urlRewriteIndex)
{
$urlRewriteIndex->open();
$category = $product->getDataFieldConfig('category_ids')['source']->getCategories()[0];
$targetPath = "catalog/product/view/id/{$initialProduct->getId()}/category/{$category->getId()}";
$url = strtolower($product->getCategoryIds()[0] . '/' . $product->getUrlKey());
$filter = ['request_path' => $url, 'target_path' => $targetPath];
\PHPUnit_Framework_Assert::assertTrue($urlRewriteIndex->getUrlRedirectGrid()->isRowVisible($filter, true, false), "URL Rewrite with request path '{$url}' is absent in grid.");
$categoryInitial = $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0];
$targetPath = "catalog/product/view/id/{$initialProduct->getId()}/category/{$categoryInitial->getId()}";
\PHPUnit_Framework_Assert::assertFalse($urlRewriteIndex->getUrlRedirectGrid()->isRowVisible(['target_path' => $targetPath], true, false), "URL Rewrite with target path '{$targetPath}' is present in grid.");
}
示例7: processAssert
/**
* Assert currency rate applied on catalog page.
*
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductSimple $product
* @param CurrencySymbolEntity $currencySymbol
* @param string $basePrice
* @param string $convertedPrice
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductSimple $product, CurrencySymbolEntity $currencySymbol, $basePrice, $convertedPrice)
{
$categoryName = $product->getCategoryIds()[0];
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$priceBlock = $catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock();
$actualPrice = $priceBlock->getPrice('');
\PHPUnit_Framework_Assert::assertEquals($basePrice, $actualPrice, 'Wrong price is displayed on Category page.');
$cmsIndex->getCurrencyBlock()->switchCurrency($currencySymbol);
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$actualPrice = $priceBlock->getPrice('');
\PHPUnit_Framework_Assert::assertEquals($convertedPrice, $actualPrice, 'Wrong price is displayed on Category page.');
}
示例8: test
/**
* Run update product simple entity test
*
* @param CatalogProductSimple $initialProduct
* @param CatalogProductSimple $product
* @return array
*/
public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product)
{
// Preconditions
$initialProduct->persist();
$initialCategory = $initialProduct->hasData('category_ids') ? $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0] : null;
$category = $product->hasData('category_ids') && $product->getCategoryIds()[0] ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : $initialCategory;
// Steps
$filter = ['sku' => $initialProduct->getSku()];
$this->productGrid->open();
$this->productGrid->getProductGrid()->searchAndOpen($filter);
$this->editProductPage->getProductForm()->fill($product);
$this->editProductPage->getFormPageActions()->save();
return ['category' => $category];
}
示例9: test
/**
* Run update product simple entity test.
*
* @param CatalogProductSimple $initialProduct
* @param CatalogProductSimple $product
* @param string $configData
* @return array
*/
public function test(CatalogProductSimple $initialProduct, CatalogProductSimple $product, $configData = '')
{
$this->configData = $configData;
// Preconditions
$initialProduct->persist();
$initialCategory = $initialProduct->hasData('category_ids') ? $initialProduct->getDataFieldConfig('category_ids')['source']->getCategories()[0] : null;
$category = $product->hasData('category_ids') && $product->getCategoryIds()[0] ? $product->getDataFieldConfig('category_ids')['source']->getCategories()[0] : $initialCategory;
$this->objectManager->create('Magento\\Config\\Test\\TestStep\\SetupConfigurationStep', ['configData' => $configData])->run();
// Steps
$filter = ['sku' => $initialProduct->getSku()];
$this->productGrid->open();
$this->productGrid->getProductGrid()->searchAndOpen($filter);
$this->editProductPage->getProductForm()->fill($product);
$this->editProductPage->getFormPageActions()->save();
return ['category' => $category];
}
示例10: getPrices
/**
* Get prices with fpt on category, product and cart pages
*
* @param CatalogProductSimple $product
* @return array
*/
protected function getPrices(CatalogProductSimple $product)
{
$actualPrices = [];
// Get prices with fpt on category page
$this->cmsIndex->open();
$this->cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
$actualPrices = $this->getCategoryPrice($product, $actualPrices);
// Get prices with fpt on product page
$this->catalogCategoryView->getListProductBlock()->getProductItem($product)->open();
$actualPrices = $this->addToCart($product, $actualPrices);
// Get prices with fpt on cart page
$actualPrices = $this->getCartPrice($product, $actualPrices);
return array_filter($actualPrices);
}
示例11: openCategory
/**
* Open product category
*
* @param CatalogProductSimple $product
* @return void
*/
protected function openCategory(CatalogProductSimple $product)
{
$this->cmsIndex->open();
$this->cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
}