本文整理匯總了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.');
}