本文整理汇总了PHP中Magento\Checkout\Test\Page\CheckoutCart::getCrosssellBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CheckoutCart::getCrosssellBlock方法的具体用法?PHP CheckoutCart::getCrosssellBlock怎么用?PHP CheckoutCart::getCrosssellBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Checkout\Test\Page\CheckoutCart
的用法示例。
在下文中一共展示了CheckoutCart::getCrosssellBlock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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.');
}
示例2: processAssert
/**
* Assert that product is not displayed in cross-sell section.
*
* @param BrowserInterface $browser
* @param CatalogProductSimple $product
* @param CatalogProductView $catalogProductView
* @param CheckoutCart $checkoutCart
* @param InjectableFixture[]|null $promotedProducts
* @return void
*/
public function processAssert(BrowserInterface $browser, CatalogProductSimple $product, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, array $promotedProducts = null)
{
if (!$promotedProducts) {
$promotedProducts = $product->hasData('cross_sell_products') ? $product->getDataFieldConfig('cross_sell_products')['source']->getProducts() : [];
}
$checkoutCart->open();
$checkoutCart->getCartBlock()->clearShoppingCart();
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getViewBlock()->addToCart($product);
$catalogProductView->getMessagesBlock()->waitSuccessMessage();
$checkoutCart->open();
foreach ($promotedProducts as $promotedProduct) {
\PHPUnit_Framework_Assert::assertFalse($checkoutCart->getCrosssellBlock()->getProductItem($promotedProduct)->isVisible(), 'Product \'' . $promotedProduct->getName() . '\' is exist in cross-sell section.');
}
}
示例3: assertCrossSellSection
/**
* Assert that cross-sell products section is displayed correctly.
*
* @param array $promotedProductNames
* @return void
*/
protected function assertCrossSellSection(array $promotedProductNames)
{
$productNames = [];
$pageProductNames = [];
foreach ($promotedProductNames as $promotedProductName) {
$productNames[] = $this->products[$promotedProductName]->getName();
}
$this->checkoutCart->open();
foreach ($this->checkoutCart->getCrosssellBlock()->getProducts() as $productItem) {
$pageProductNames[] = $productItem->getProductName();
}
sort($productNames);
sort($pageProductNames);
\PHPUnit_Framework_Assert::assertEquals($productNames, $pageProductNames, 'Wrong products are displayed in cross-sell section.');
}