本文整理汇总了PHP中Magento\Cms\Test\Page\CmsIndex::getCartSidebarBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CmsIndex::getCartSidebarBlock方法的具体用法?PHP CmsIndex::getCartSidebarBlock怎么用?PHP CmsIndex::getCartSidebarBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Cms\Test\Page\CmsIndex
的用法示例。
在下文中一共展示了CmsIndex::getCartSidebarBlock方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert product is present on mini shopping cart
*
* @param CmsIndex $cmsIndex
* @param array $products
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, array $products)
{
$cmsIndex->open();
foreach ($products as $product) {
$cmsIndex->getCartSidebarBlock()->openMiniCart();
\PHPUnit_Framework_Assert::assertTrue($cmsIndex->getCartSidebarBlock()->getCartItem($product)->isVisible(), 'Product ' . $product->getName() . ' is absent in Mini Shopping Cart.');
}
}
示例2: test
/**
* Update product from mini shopping cart.
*
* @param string $originalProduct
* @param array $checkoutData
* @return array
*/
public function test($originalProduct, $checkoutData)
{
// Preconditions:
$product = $this->createProduct($originalProduct);
$this->addToCart($product);
// Steps:
$productData = $product->getData();
$productData['checkout_data'] = $checkoutData;
$newProduct = $this->createProduct(explode('::', $originalProduct)[0], [$productData]);
$miniShoppingCart = $this->cmsIndex->getCartSidebarBlock();
$miniShoppingCart->openMiniCart();
$miniShoppingCart->getCartItem($newProduct)->clickEditItem();
$this->catalogProductView->getViewBlock()->addToCart($newProduct);
// Prepare data for asserts:
$cart['data']['items'] = ['products' => [$newProduct]];
$deletedCart['data']['items'] = ['products' => [$product]];
return ['deletedCart' => $this->fixtureFactory->createByCode('cart', $deletedCart), 'cart' => $this->fixtureFactory->createByCode('cart', $cart)];
}
示例3: processAssert
/**
* Assert that product quantity in the mini shopping cart is equals to expected quantity from data set
*
* @param CmsIndex $cmsIndex
* @param Cart $cart
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, Cart $cart)
{
$cmsIndex->open();
/** @var Items $sourceProducts */
$sourceProducts = $cart->getDataFieldConfig('items')['source'];
$products = $sourceProducts->getProducts();
$items = $cart->getItems();
$productsData = [];
$miniCartData = [];
foreach ($items as $key => $item) {
/** @var CatalogProductSimple $product */
$product = $products[$key];
$productName = $product->getName();
/** @var FixtureInterface $item */
$checkoutItem = $item->getData();
$productsData[$productName] = ['qty' => $checkoutItem['qty']];
$miniCartData[$productName] = ['qty' => $cmsIndex->getCartSidebarBlock()->getProductQty($productName)];
}
$error = $this->verifyData($productsData, $miniCartData, true);
\PHPUnit_Framework_Assert::assertEmpty($error, $error);
}
示例4: removeProduct
/**
* Remove product form cart
*
* @param FixtureInterface $product
* @return void
*/
protected function removeProduct(FixtureInterface $product)
{
$this->cmsIndex->open();
$this->cmsIndex->getCartSidebarBlock()->openMiniCart();
$this->cmsIndex->getCartSidebarBlock()->getCartItem($product)->removeItemFromMiniCart();
}
示例5: processAssert
/**
* Assert that customer minicart is empty
*
* @param CmsIndex $cmsIndex
*/
public function processAssert(CmsIndex $cmsIndex)
{
\PHPUnit_Framework_Assert::assertEquals(self::TEXT_EMPTY_MINICART, $cmsIndex->getCartSidebarBlock()->getEmptyMessage(), 'Empty minicart message not found');
\PHPUnit_Framework_Assert::assertFalse($cmsIndex->getCartSidebarBlock()->isItemsQtyVisible(), 'Minicart is not empty');
}
示例6: processAssert
/**
* Assert product is absent on mini shopping cart
*
* @param CmsIndex $cmsIndex
* @param FixtureInterface $deletedProduct
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, FixtureInterface $deletedProduct)
{
$cmsIndex->open();
$cmsIndex->getCartSidebarBlock()->openMiniCart();
\PHPUnit_Framework_Assert::assertFalse($cmsIndex->getCartSidebarBlock()->getCartItem($deletedProduct)->isVisible(), 'Product ' . $deletedProduct->getName() . ' is presents in Mini Shopping Cart.');
}