Пример #1
0
 /**
  * Assert product MAP related data in Shopping Cart.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductView $catalogProductView
  * @param CheckoutCart $checkoutCart
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, CheckoutCart $checkoutCart, InjectableFixture $product)
 {
     /** @var CatalogProductSimple $product */
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
     $catalogCategoryView->getListProductBlock()->getProductItem($product)->open();
     if ($product->hasData('checkout_data')) {
         $catalogProductView->getViewBlock()->addToCart($product);
     } else {
         $catalogProductView->getMsrpViewBlock()->openMapBlock();
         $catalogProductView->getMsrpViewBlock()->getMapBlock()->addToCart();
     }
     $catalogProductView->getMessagesBlock()->waitSuccessMessage();
     $checkoutCart->open();
     $productPrice = $product->hasData('checkout_data') ? $product->getCheckoutData()['cartItem']['price'] : $product->getPrice();
     $unitPrice = $checkoutCart->getCartBlock()->getCartItem($product)->getPrice();
     \PHPUnit_Framework_Assert::assertEquals($productPrice, $unitPrice, 'Incorrect unit price is displayed in Cart');
 }
Пример #2
0
 /**
  * Assert product MAP related data on product view page.
  *
  * @param CmsIndex $cmsIndex
  * @param CatalogCategoryView $catalogCategoryView
  * @param CatalogProductView $catalogProductView
  * @param InjectableFixture $product
  * @return void
  */
 public function processAssert(CmsIndex $cmsIndex, CatalogCategoryView $catalogCategoryView, CatalogProductView $catalogProductView, InjectableFixture $product)
 {
     /** @var CatalogProductSimple $product */
     $cmsIndex->open();
     $cmsIndex->getTopmenu()->selectCategoryByName($product->getCategoryIds()[0]);
     $catalogCategoryView->getListProductBlock()->getProductItem($product)->open();
     $viewBlock = $catalogProductView->getMsrpViewBlock();
     $priceBlock = $viewBlock->getPriceBlock();
     \PHPUnit_Framework_Assert::assertEquals($product->getMsrp(), $priceBlock->getOldPrice(), 'Displayed on Product view page MAP is incorrect');
     \PHPUnit_Framework_Assert::assertFalse($priceBlock->isRegularPriceVisible(), 'Regular price on Product view page is visible and not expected.');
     $viewBlock->openMapBlock();
     $mapBlock = $viewBlock->getMapBlock();
     \PHPUnit_Framework_Assert::assertContains($product->getMsrp(), $mapBlock->getOldPrice(), 'Displayed on Product view page MAP is incorrect.');
     \PHPUnit_Framework_Assert::assertEquals($product->getPrice(), $mapBlock->getActualPrice(), 'Displayed on Product view page price is incorrect.');
 }