本文整理汇总了PHP中Magento\Catalog\Test\Page\Category\CatalogCategoryView::getListProductBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogCategoryView::getListProductBlock方法的具体用法?PHP CatalogCategoryView::getListProductBlock怎么用?PHP CatalogCategoryView::getListProductBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Test\Page\Category\CatalogCategoryView
的用法示例。
在下文中一共展示了CatalogCategoryView::getListProductBlock方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that product is not visible in the assigned category
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @param Category|null $category
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, FixtureInterface $product, Category $category = null)
{
$categoryName = $category ? $category->getName() : $product->getCategoryIds()[0];
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
}
\PHPUnit_Framework_Assert::assertFalse($isProductVisible, 'Product is exist on category page.');
}
示例2: 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.");
}
示例3: 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;
}
示例4: 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.");
}
示例5: 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.');
}
示例6: processAssert
/**
* Assert that created entity was found on search page
*
* @param UrlRewrite $initialRewrite
* @param UrlRewrite $urlRewrite
* @param Browser $browser
* @param CatalogCategoryView $categoryView
* @return void
*/
public function processAssert(UrlRewrite $initialRewrite, UrlRewrite $urlRewrite, Browser $browser, CatalogCategoryView $categoryView)
{
$urlRequestPath = $urlRewrite->hasData('request_path') ? $urlRewrite->getRequestPath() : $initialRewrite->getRequestPath();
$browser->open($_ENV['app_frontend_url'] . $urlRequestPath);
$entity = $initialRewrite->getDataFieldConfig('id_path')['source']->getEntity()->getName();
\PHPUnit_Framework_Assert::assertTrue($categoryView->getListProductBlock()->isProductVisible($entity), "Created entity '{$entity}' isn't found.");
}
示例7: processAssert
/**
* Assert that product is visible in the assigned category
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @param Category|null $category
* @return void
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, FixtureInterface $product, Category $category = null)
{
$categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $category->getName();
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible();
while (!$isProductVisible && $catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $catalogCategoryView->getListProductBlock()->getProductItem($product)->isVisible();
}
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);
}
示例8: processAssert
/**
* Assert that product is visible in the assigned category
*
* @param CatalogCategoryView $catalogCategoryView
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @param CatalogCategory $category
* @return void
*/
public function processAssert(CatalogCategoryView $catalogCategoryView, CmsIndex $cmsIndex, FixtureInterface $product, CatalogCategory $category)
{
$cmsIndex->open();
$cmsIndex->getTopmenu()->selectCategoryByName($category->getName());
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
while (!$isProductVisible && $catalogCategoryView->getToolbar()->nextPage()) {
$isProductVisible = $catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
}
$isInStock = $product->getQuantityAndStockStatus();
if ($product->getVisibility() === 'Search' || isset($isInStock['is_in_stock']) && $isInStock['is_in_stock'] === '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);
}
示例9: 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.');
}
示例10: assertPrice
/**
* Verify product price on category view page.
*
* @param FixtureInterface $product
* @param CatalogCategoryView $catalogCategoryView
* @return void
*/
protected function assertPrice(FixtureInterface $product, CatalogCategoryView $catalogCategoryView)
{
$priceBlock = $catalogCategoryView->getListProductBlock()->getProductItem($product)->getPriceBlock();
\PHPUnit_Framework_Assert::assertEquals(number_format($product->getPrice(), 2, '.', ''), $priceBlock->isOldPriceVisible() ? $priceBlock->getOldPrice() : $priceBlock->getPrice(), 'Product regular price on category page is not correct.');
if ($product->hasData('special_price')) {
\PHPUnit_Framework_Assert::assertEquals(number_format($product->getSpecialPrice(), 2, '.', ''), $priceBlock->getSpecialPrice(), 'Product special price on category page is not correct.');
}
}
示例11: processAssert
/**
* Assert that displayed assigned products on category page equals passed from fixture
*
* @param CatalogCategory $category
* @param CatalogCategoryView $categoryView
* @param Browser $browser
* @return void
*/
public function processAssert(CatalogCategory $category, CatalogCategoryView $categoryView, Browser $browser)
{
$browser->open($_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html');
$products = $category->getDataFieldConfig('category_products')['source']->getProducts();
foreach ($products as $productFixture) {
\PHPUnit_Framework_Assert::assertTrue($categoryView->getListProductBlock()->isProductVisible($productFixture->getName()), "Products '{$productFixture->getName()}' not find.");
}
}
示例12: 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.');
}
示例13: processAssert
/**
* Assert that displayed assigned products on category page equals passed from fixture
*
* @param Category $category
* @param CatalogCategoryView $categoryView
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(Category $category, CatalogCategoryView $categoryView, BrowserInterface $browser)
{
$categoryUrlKey = $category->hasData('url_key') ? strtolower($category->getUrlKey()) : trim(strtolower(preg_replace('#[^0-9a-z%]+#i', '-', $category->getName())), '-');
$products = $category->getDataFieldConfig('category_products')['source']->getProducts();
$browser->open($_ENV['app_frontend_url'] . $categoryUrlKey . '.html');
foreach ($products as $productFixture) {
\PHPUnit_Framework_Assert::assertTrue($categoryView->getListProductBlock()->getProductItem($productFixture)->isVisible(), "Products '{$productFixture->getName()}' not find.");
}
}
示例14: assertPrice
/**
* Verify product price on category view page
*
* @param CatalogProductConfigurable $configurable
* @param CatalogCategoryView $catalogCategoryView
* @return void
*/
protected function assertPrice(CatalogProductConfigurable $configurable, CatalogCategoryView $catalogCategoryView)
{
/** @var \Magento\ConfigurableProduct\Test\Fixture\CatalogProductConfigurable\Price $priceFixture */
$priceFixture = $configurable->getDataFieldConfig('price')['source'];
$pricePresetData = $priceFixture->getPreset();
//Regular price verification
if (isset($pricePresetData['category_special_price'])) {
$regularPrice = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($configurable->getName())->getRegularPrice();
\PHPUnit_Framework_Assert::assertEquals($pricePresetData['category_price'], $regularPrice, 'Product regular price on category page is not correct.');
//Special price verification
$specialPrice = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($configurable->getName())->getSpecialPrice();
\PHPUnit_Framework_Assert::assertEquals($pricePresetData['category_special_price'], $specialPrice, 'Product special price on category page is not correct.');
} else {
//Price verification
$price = $catalogCategoryView->getListProductBlock()->getProductPriceBlock($configurable->getName())->getPrice();
\PHPUnit_Framework_Assert::assertEquals($price['price_regular_price'], $pricePresetData['category_price'], 'Product price on category page is not correct.');
}
}
示例15: 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.');
}