本文整理汇总了PHP中Magento\Mtf\Fixture\InjectableFixture::getCategoryIds方法的典型用法代码示例。如果您正苦于以下问题:PHP InjectableFixture::getCategoryIds方法的具体用法?PHP InjectableFixture::getCategoryIds怎么用?PHP InjectableFixture::getCategoryIds使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Mtf\Fixture\InjectableFixture
的用法示例。
在下文中一共展示了InjectableFixture::getCategoryIds方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Check whether the attribute filter is displayed on the frontend in Layered navigation.
*
* @param CatalogCategoryView $catalogCategoryView
* @param InjectableFixture $product
* @param CatalogProductAttribute $attribute
* @param CmsIndex $cmsIndex
* @param FixtureFactory $fixtureFactory
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, InjectableFixture $product, CatalogProductAttribute $attribute, CmsIndex $cmsIndex, FixtureFactory $fixtureFactory)
{
$fixtureFactory->createByCode('catalogProductSimple', ['dataSet' => 'product_with_category_with_anchor', 'data' => ['category_ids' => ['presets' => null, 'category' => $product->getDataFieldConfig('category_ids')['source']->getCategories()[0]]]])->persist();
$cmsIndex->open()->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
$label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
\PHPUnit_Framework_Assert::assertTrue(in_array($label, $catalogCategoryView->getLayeredNavigationBlock()->getFilters()), 'Attribute is absent in layered navigation on category page.');
}
示例2: processAssert
/**
* Assert that video is displayed on category page on Store front.
*
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param InjectableFixture $initialProduct
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, InjectableFixture $initialProduct)
{
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($initialProduct->getCategoryIds()[0]);
$src = $catalogCategoryView->getListProductBlock()->getProductItem($initialProduct)->getBaseImageSource();
\PHPUnit_Framework_Assert::assertFalse(strpos($src, '/placeholder/') !== false, 'Video preview image is not displayed on category view when it should.');
}
示例3: processAssert
/**
* Assert that Catalog Price Rule is applied for product(s) in Catalog
* according to Priority(Priority/Stop Further Rules Processing).
*
* @param InjectableFixture $product
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param array $prices
* @return void
*/
public function processAssert(InjectableFixture $product, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, array $prices)
{
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
$formPrices = $this->getFormPrices($product, $catalogCategoryView);
$fixturePrices = $this->prepareFixturePrices($prices);
$diff = $this->verifyData($fixturePrices, $formPrices);
\PHPUnit_Framework_Assert::assertEmpty($diff, $diff . "\n On: " . date('l jS \\of F Y h:i:s A'));
}
示例4: processAssert
/**
* Assert that Catalog Price Rule is applied for product(s) in Shopping Cart
* according to Priority(Priority/Stop Further Rules Processing).
*
* @param InjectableFixture $product
* @param CatalogProductView $pageCatalogProductView
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CheckoutCart $pageCheckoutCart
* @param array $prices
* @return void
*/
public function processAssert(InjectableFixture $product, CatalogProductView $pageCatalogProductView, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CheckoutCart $pageCheckoutCart, array $prices)
{
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
$pageCatalogProductView->getViewBlock()->addToCart($product);
$actualGrandTotal = $pageCheckoutCart->getCartBlock()->getCartItem($product)->getCartItemTypePrice('price');
\PHPUnit_Framework_Assert::assertEquals($prices['grand_total'], $actualGrandTotal);
}
示例5: getCategoryPrice
/**
* Get prices on category page.
*
* @return array
*/
protected function getCategoryPrice()
{
$prices = [];
$this->cmsIndex->open();
$this->cmsIndex->getTopmenu()->selectCategory($this->product->getCategoryIds()[0]);
$priceBlock = $this->catalogCategoryView->getWeeeListProductBlock()->getProductItem($this->product)->getPriceBlock();
foreach ($this->expectedPrices['category'] as $key => $type) {
$prices[$key] = $this->getPrice($priceBlock, $key);
}
return $prices;
}
示例6: processAssert
/**
* Assert that out of stock product is visible in the assigned category.
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param InjectableFixture $product
* @param CatalogCategory|null $category
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category = null)
{
$categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $category->getName();
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($categoryName);
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
}
\PHPUnit_Framework_Assert::assertTrue($isProductVisible, "Product is absent on category page.");
}
示例7: processAssert
/**
* Assert that Catalog Price Rule is applied & it impacts on product's discount price on Product page.
*
* @param InjectableFixture $product
* @param CatalogProductView $pageCatalogProductView
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param array $prices
* @return void
*/
public function processAssert(InjectableFixture $product, CatalogProductView $pageCatalogProductView, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, array $prices)
{
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
$catalogCategoryView->getListProductBlock()->openProductViewPage($product->getName());
$productPriceBlock = $pageCatalogProductView->getViewBlock()->getPriceBlock();
$actualPrices['regular'] = $productPriceBlock->getRegularPrice();
$actualPrices['special'] = $productPriceBlock->getSpecialPrice();
$actualPrices['discount_amount'] = number_format($actualPrices['regular'] - $actualPrices['special'], 2);
$diff = $this->verifyData($actualPrices, $prices);
\PHPUnit_Framework_Assert::assertEmpty($diff, $diff);
}
示例8: processAssert
/**
* Assert that "Add to cart" button is not display on page.
*
* @param InjectableFixture $product
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @param Category $category [optional]
*
* @return void
*/
public function processAssert(InjectableFixture $product, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, Category $category = null)
{
$cmsIndex->open();
$categoryName = $category === null ? $product->getCategoryIds()[0] : $category->getName();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible();
while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible();
}
\PHPUnit_Framework_Assert::assertTrue($isProductVisible, 'Product is absent on category page.');
\PHPUnit_Framework_Assert::assertFalse($catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisibleAddToCardButton(), "Button 'Add to Card' is present on Category page.");
$catalogCategoryView->getListProductBlock()->getProductItem($product)->open();
\PHPUnit_Framework_Assert::assertFalse($catalogProductView->getViewBlock()->isVisibleAddToCardButton(), "Button 'Add to Card' is present on Product page.");
}
示例9: processAssert
/**
* Assert product MAP related data on category page.
*
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param InjectableFixture $product
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, InjectableFixture $product)
{
/** @var CatalogProductSimple $product */
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
$productBlock = $catalogCategoryView->getMsrpListProductBlock()->getProductItem($product);
\PHPUnit_Framework_Assert::assertTrue($productBlock->isVisible(), 'Product is invisible on Category page.');
$priceBlock = $productBlock->getPriceBlock();
\PHPUnit_Framework_Assert::assertEquals($product->getMsrp(), $priceBlock->getOldPrice(), 'Displayed on Category page MAP is incorrect.');
\PHPUnit_Framework_Assert::assertFalse($priceBlock->isRegularPriceVisible(), 'Regular price on Category page is visible and not expected.');
$productBlock->openMapBlock();
$mapBlock = $productBlock->getMapBlock();
\PHPUnit_Framework_Assert::assertEquals($product->getMsrp(), $mapBlock->getOldPrice(), 'Displayed on Category page MAP is incorrect.');
\PHPUnit_Framework_Assert::assertEquals($product->getPrice(), $mapBlock->getActualPrice(), 'Displayed on Category page price is incorrect.');
}
示例10: processAssert
/**
* Assert that product is visible in the assigned category.
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param InjectableFixture $product
* @param CatalogCategory|null $category
* @return void
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category = null)
{
$categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $category->getName();
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($categoryName);
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
}
if ($product->getVisibility() === 'Search' || $this->getStockStatus($product) === 'Out of Stock') {
$isProductVisible = !$isProductVisible;
$this->errorMessage = 'Product found in this category.';
$this->successfulMessage = 'Asserts that the product could not be found in this category.';
}
\PHPUnit_Framework_Assert::assertTrue($isProductVisible, $this->errorMessage);
}
示例11: processAssert
/**
* Assert product MAP related data on product view page.
*
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @param InjectableFixture $product
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, InjectableFixture $product)
{
/** @var CatalogProductSimple $product */
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
$catalogCategoryView->getListProductBlock()->getProductItem($product)->open();
$viewBlock = $catalogProductView->getMsrpViewBlock();
$priceBlock = $viewBlock->getPriceBlock();
\PHPUnit_Framework_Assert::assertEquals($product->getMsrp(), $priceBlock->getOldPrice(), 'Displayed on Product view page MAP is incorrect');
\PHPUnit_Framework_Assert::assertFalse($priceBlock->isRegularPriceVisible(), 'Regular price on Product view page is visible and not expected.');
$viewBlock->openMapBlock();
$mapBlock = $viewBlock->getMapBlock();
\PHPUnit_Framework_Assert::assertContains($product->getMsrp(), $mapBlock->getOldPrice(), 'Displayed on Product view page MAP is incorrect.');
$priceData = $product->getDataFieldConfig('price')['source']->getPriceData();
$price = isset($priceData['category_price']) ? $priceData['category_price'] : $product->getPrice();
\PHPUnit_Framework_Assert::assertEquals($price, $mapBlock->getActualPrice(), 'Displayed on Product view page price is incorrect.');
}
示例12: processAssert
/**
* Checking the product in the page of its price.
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param InjectableFixture $product
* @param CatalogCategory $category
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, InjectableFixture $product, CatalogCategory $category)
{
// Open category view page and check visible product
$categoryName = $category->getName();
if ($product->hasData('category_ids')) {
$categoryIds = $product->getCategoryIds();
$categoryName = is_array($categoryIds) ? reset($categoryIds) : $categoryName;
}
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategory($categoryName);
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product);
}
\PHPUnit_Framework_Assert::assertTrue($isProductVisible, 'Product is absent on category page.');
//Process price asserts
$this->assertPrice($product, $catalogCategoryView);
}
示例13: processAssert
/**
* Assert product MAP related data in Shopping Cart.
*
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param InjectableFixture $product
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, InjectableFixture $product)
{
/** @var CatalogProductSimple $product */
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
$catalogCategoryView->getListProductBlock()->getProductItem($product)->open();
if ($product->hasData('checkout_data')) {
$catalogProductView->getViewBlock()->addToCart($product);
} else {
$catalogProductView->getMsrpViewBlock()->openMapBlock();
$catalogProductView->getMsrpViewBlock()->getMapBlock()->addToCart();
}
$catalogProductView->getMessagesBlock()->waitSuccessMessage();
$checkoutCart->open();
$productPrice = $product->hasData('checkout_data') ? $product->getCheckoutData()['cartItem']['price'] : $product->getPrice();
$unitPrice = $checkoutCart->getCartBlock()->getCartItem($product)->getPrice();
\PHPUnit_Framework_Assert::assertEquals($productPrice, $unitPrice, 'Incorrect unit price is displayed in Cart');
}
示例14: processAssert
/**
* Assert that specified prices are actual on category, product and cart pages.
*
* @param InjectableFixture $product
* @param array $prices
* @param int $qty
* @param CmsIndex $cmsIndex
* @param CatalogCategoryView $catalogCategoryView
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param FixtureFactory $fixtureFactory
* @return void
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function processAssert(InjectableFixture $product, array $prices, $qty, CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, FixtureFactory $fixtureFactory)
{
$this->cmsIndex = $cmsIndex;
$this->catalogCategoryView = $catalogCategoryView;
$this->catalogProductView = $catalogProductView;
$this->checkoutCart = $checkoutCart;
$actualPrices = [];
//Assertion steps
$productCategory = $product->getCategoryIds()[0];
$this->openCategory($productCategory);
$actualPrices = $this->getCategoryPrices($product, $actualPrices);
$catalogCategoryView->getListProductBlock()->getProductItem($product)->open();
$catalogProductView->getViewBlock()->fillOptions($product);
$actualPrices = $this->getProductPagePrices($actualPrices);
$catalogProductView->getViewBlock()->clickAddToCart();
$catalogProductView->getMessagesBlock()->waitSuccessMessage();
$actualPrices = $this->getCartPrices($product, $actualPrices);
$actualPrices = $this->getTotals($actualPrices);
//Prices verification
$message = 'Prices from dataset should be equal to prices on frontend';
\PHPUnit_Framework_Assert::assertEquals($prices, $actualPrices, $message);
}
示例15: processAssert
/**
* Check whether the attribute filter is displayed on the frontend in Layered navigation.
*
* @param CatalogCategoryView $catalogCategoryView
* @param InjectableFixture $product
* @param CatalogProductAttribute $attribute
* @param CmsIndex $cmsIndex
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, InjectableFixture $product, CatalogProductAttribute $attribute, CmsIndex $cmsIndex)
{
$cmsIndex->open()->getTopmenu()->selectCategory($product->getCategoryIds()[0]);
$label = $attribute->hasData('manage_frontend_label') ? $attribute->getManageFrontendLabel() : $attribute->getFrontendLabel();
\PHPUnit_Framework_Assert::assertTrue(in_array(strtoupper($label), $catalogCategoryView->getLayeredNavigationBlock()->getFilters()), 'Attribute is absent in layered navigation on category page.');
}