/**
  * Assert that after adding products by sku, wrong requested quantity error message appears.
  *
  * @param CheckoutCart $checkoutCart
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(CheckoutCart $checkoutCart, array $requiredAttentionProducts)
 {
     foreach ($requiredAttentionProducts as $product) {
         $currentMessage = $checkoutCart->getAdvancedCheckoutCart()->getFailedItemErrorMessage($product);
         \PHPUnit_Framework_Assert::assertContains(self::ERROR_QUANTITY_MESSAGE, $currentMessage);
         \PHPUnit_Framework_Assert::assertContains(sprintf($this->allowedQtyMessage, $product->getStockData()[$this->saleQtyType]), $currentMessage);
     }
 }
 /**
  * Assert that requested quantity is not available error message is displayed after adding products to cart by sku.
  *
  * @param CheckoutCart $checkoutCart
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(CheckoutCart $checkoutCart, $requiredAttentionProducts)
 {
     foreach ($requiredAttentionProducts as $product) {
         $currentMessage = $checkoutCart->getAdvancedCheckoutCart()->getFailedItemErrorMessage($product);
         \PHPUnit_Framework_Assert::assertContains(self::ERROR_QUANTITY_MESSAGE, $currentMessage);
         \PHPUnit_Framework_Assert::assertContains(sprintf(self::LEFT_IN_STOCK_ERROR_MESSAGE, $product->getStockData()['qty']), $currentMessage);
     }
 }
 /**
  * Assert that product has tier price message appears after adding products by sku to shopping cart.
  *
  * @param CheckoutCart $checkoutCart
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(CheckoutCart $checkoutCart, array $requiredAttentionProducts)
 {
     foreach ($requiredAttentionProducts as $product) {
         $messages = $checkoutCart->getAdvancedCheckoutCart()->getTierPriceMessages($product);
         $tierPrices = $product->getTierPrice();
         \PHPUnit_Framework_Assert::assertTrue(count($messages) === count($tierPrices), 'Wrong qty messages is displayed.');
         foreach ($tierPrices as $key => $tierPrice) {
             $price = (bool) strpos($messages[$key], (string) $tierPrice['price']);
             $priceQty = (bool) strpos($messages[$key], (string) $tierPrice['price_qty']);
             $savePercent = (bool) strpos($messages[$key], $this->getSavePercent($product->getPrice(), $tierPrice));
             \PHPUnit_Framework_Assert::assertTrue($price and $priceQty and $savePercent, 'Wrong tier price message is displayed.');
         }
     }
 }
 /**
  * Assert that requested qty does not meet the increments error message is displayed after adding products by sku.
  *
  * @param CheckoutCart $checkoutCart
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(CheckoutCart $checkoutCart, array $requiredAttentionProducts)
 {
     foreach ($requiredAttentionProducts as $product) {
         \PHPUnit_Framework_Assert::assertEquals(sprintf(self::QTY_INCREMENTS_ERROR_MESSAGE, $product->getStockData()['qty_increments']), $checkoutCart->getAdvancedCheckoutCart()->getFailedItemErrorMessage($product));
     }
 }
 /**
  * Assert that sku not found error message is displayed after adding products to shopping cart by sku.
  *
  * @param CheckoutCart $checkoutCart
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(CheckoutCart $checkoutCart, array $requiredAttentionProducts)
 {
     foreach ($requiredAttentionProducts as $product) {
         \PHPUnit_Framework_Assert::assertEquals(self::ERROR_MESSAGE, $checkoutCart->getAdvancedCheckoutCart()->getFailedItemErrorMessage($product));
     }
 }
 /**
  * Assert that specify products options link is displayed after adding products to cart by sku.
  *
  * @param CheckoutCart $checkoutCart
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(CheckoutCart $checkoutCart, array $requiredAttentionProducts)
 {
     foreach ($requiredAttentionProducts as $product) {
         \PHPUnit_Framework_Assert::assertTrue($checkoutCart->getAdvancedCheckoutCart()->specifyProductOptionsLinkIsVisible($product), "Specify the product's options link is not visible.");
     }
 }
Ejemplo n.º 7
0
 /**
  * Assert that notice is present that product with enabled MAP.
  *
  * @param CheckoutCart $checkoutCart
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(CheckoutCart $checkoutCart, array $requiredAttentionProducts)
 {
     foreach ($requiredAttentionProducts as $product) {
         \PHPUnit_Framework_Assert::assertTrue($checkoutCart->getAdvancedCheckoutCart()->isMsrpNoticeDisplayed($product), 'Notice that product with enabled MAP is absent.');
     }
 }
 /**
  * Assert that out of stock error message is displayed after adding out of stock products to cart by sku.
  *
  * @param CheckoutCart $checkoutCart
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(CheckoutCart $checkoutCart, array $requiredAttentionProducts)
 {
     foreach ($requiredAttentionProducts as $product) {
         \PHPUnit_Framework_Assert::assertContains(self::ERROR_MESSAGE, $checkoutCart->getAdvancedCheckoutCart()->getFailedItemErrorMessage($product), 'Wrong error message is displayed.');
     }
 }