コード例 #1
0
 /**
  * Assert that requested quantity is not available error message is displayed after adding products to order by sku.
  *
  * @param SalesOrderCreateIndex $salesOrderCreateIndex
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(SalesOrderCreateIndex $salesOrderCreateIndex, array $requiredAttentionProducts)
 {
     foreach ($requiredAttentionProducts as $product) {
         $productName = $product->getName();
         \PHPUnit_Framework_Assert::assertEquals(sprintf(self::ERROR_QUANTITY_MESSAGE, $productName), $salesOrderCreateIndex->getAdvancedOrderCreateBlock()->getItemsBlock()->getItemProduct($productName)->getNoticeMessage());
     }
 }
コード例 #2
0
 /**
  * Add products by SKU on backend.
  *
  * @param Customer $customer
  * @param array $orderOptions
  * @param string $cartBlock
  * @param string|null $products
  * @return array
  */
 public function test(Customer $customer, array $orderOptions, $cartBlock, $products = null)
 {
     // Preconditions
     $products = $this->createProducts($products);
     $orderOptions = $this->prepareOrderOptions($products, $orderOptions);
     // Steps
     $this->orderIndex->open();
     $this->orderIndex->getPageActionsBlock()->addNew();
     $this->orderCreateIndex->getCustomerGrid()->selectCustomer($customer);
     $this->orderCreateIndex->getStoreBlock()->selectStoreView();
     $orderCreateBlock = $this->orderCreateIndex->getAdvancedOrderCreateBlock();
     $orderCreateBlock->getItemsBlock()->clickAddProductsBySku();
     $orderCreateBlock->getAddToOrderBySkuBlock()->getOrderBySkuForm()->fillForm($orderOptions);
     $this->orderCreateIndex->getAdvancedOrderCreateBlock()->getAddToOrderBySkuBlock()->addToCart();
     $filteredProducts = $this->filterProducts($products, $cartBlock);
     return ['products' => isset($filteredProducts['cart']) ? $filteredProducts['cart'] : [], 'requiredAttentionProducts' => isset($filteredProducts['required_attention']) ? $filteredProducts['required_attention'] : []];
 }
 /**
  * Assert that product requires attention error message is displayed after adding products by sku to order.
  *
  * @param SalesOrderCreateIndex $salesOrderCreateIndex
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(SalesOrderCreateIndex $salesOrderCreateIndex, array $requiredAttentionProducts)
 {
     \PHPUnit_Framework_Assert::assertEquals(sprintf(self::ERROR_MESSAGE, count($requiredAttentionProducts)), $salesOrderCreateIndex->getAdvancedOrderCreateBlock()->getRequireAttentionBlock()->getErrorMessage());
 }
コード例 #4
0
 /**
  * Assert that requested qty does not meet the increments error message is displayed after adding products by sku.
  *
  * @param SalesOrderCreateIndex $salesOrderCreateIndex
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(SalesOrderCreateIndex $salesOrderCreateIndex, array $requiredAttentionProducts)
 {
     foreach ($requiredAttentionProducts as $product) {
         \PHPUnit_Framework_Assert::assertEquals(sprintf(self::QTY_INCREMENTS_ERROR_MESSAGE, $product->getStockData()['qty_increments']), $salesOrderCreateIndex->getAdvancedOrderCreateBlock()->getItemsBlock()->getItemProduct($product->getName())->getErrorMessage());
     }
 }
 /**
  * Assert that entered qty is not valid notice message is displayed after adding products to order by sku.
  *
  * @param SalesOrderCreateIndex $salesOrderCreateIndex
  * @param array $requiredAttentionProducts
  * @return void
  */
 public function processAssert(SalesOrderCreateIndex $salesOrderCreateIndex, array $requiredAttentionProducts)
 {
     foreach ($requiredAttentionProducts as $product) {
         \PHPUnit_Framework_Assert::assertEquals(self::NOTICE_MESSAGE, $salesOrderCreateIndex->getAdvancedOrderCreateBlock()->getRequireAttentionBlock()->getFailedItemBlock($product)->getNoticeMessage());
     }
 }