当前位置: 首页>>代码示例>>PHP>>正文


PHP CmsIndex::getCartSidebarBlock方法代码示例

本文整理汇总了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.');
     }
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:15,代码来源:AssertProductPresentInMiniShoppingCart.php

示例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)];
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:25,代码来源:UpdateProductFromMiniShoppingCartEntityTest.php

示例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);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:28,代码来源:AssertProductQtyInMiniShoppingCart.php

示例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();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:12,代码来源:DeleteProductFromMiniShoppingCartTest.php

示例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');
 }
开发者ID:koliaGI,项目名称:magento2,代码行数:10,代码来源:AssertMinicartEmpty.php

示例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.');
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:13,代码来源:AssertProductAbsentInMiniShoppingCart.php


注:本文中的Magento\Cms\Test\Page\CmsIndex::getCartSidebarBlock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。