/**
  * Cancel created order.
  *
  * @param Order $order
  * @return array
  */
 public function test(Order $order)
 {
     // Preconditions
     $order->persist();
     // Steps
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     $this->salesOrderView->getPageActions()->cancel();
     return ['customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer(), 'orderId' => $order->getId(), 'product' => $order->getEntityId()['products'][0]];
 }
 /**
  * Assert that 'Button name' button is absent order page.
  *
  * @param SalesOrderView $salesOrderView
  * @param SalesOrderIndex $orderIndex
  * @param Order $order
  * @param string|null $orderId
  * @return void
  */
 public function processAssert(SalesOrderView $salesOrderView, SalesOrderIndex $orderIndex, Order $order = null, $orderId = null)
 {
     $orderIndex->open();
     $orderId = $orderId == null ? $order->getId() : $orderId;
     $orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     \PHPUnit_Framework_Assert::assertFalse($salesOrderView->getPageActions()->isActionButtonVisible($this->buttonName), "'{$this->buttonName}' button is present on order view page.");
 }
 /**
  * Assert that Order Grand Total is correct on order page in backend.
  *
  * @param SalesOrderIndex $salesOrder
  * @param SalesOrderView $salesOrderView
  * @param mixed $grandTotal
  * @param string $orderId
  * @return void
  */
 public function processAssert(SalesOrderIndex $salesOrder, SalesOrderView $salesOrderView, $grandTotal, $orderId)
 {
     $salesOrder->open()->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     $expected = number_format(is_array($grandTotal) ? array_sum($grandTotal) : $grandTotal, 2);
     $actual = $salesOrderView->getOrderForm()->getTabElement('information')->getOrderTotalsBlock()->getData('grand_total');
     \PHPUnit_Framework_Assert::assertEquals($expected, $actual, "Expected: {$expected}; Actual: {$actual}");
 }
 /**
  * Assert that deleted customers address is not displayed on backend during order creation.
  *
  * @param SalesOrderIndex $orderIndex
  * @param SalesOrderCreateIndex $orderCreateIndex
  * @param Address $deletedAddress
  * @param Customer $customer
  * @return void
  */
 public function processAssert(SalesOrderIndex $orderIndex, SalesOrderCreateIndex $orderCreateIndex, Address $deletedAddress, Customer $customer)
 {
     $orderIndex->open()->getPageActionsBlock()->addNew();
     $orderCreateIndex->getCustomerGrid()->selectCustomer($customer);
     $orderCreateIndex->getStoreBlock()->selectStoreView();
     \PHPUnit_Framework_Assert::assertNotContains($this->prepareAddress($deletedAddress), $orderCreateIndex->getCreateBlock()->getBillingAddressForm()->getExistingAddresses(), 'Deleted address is present on backend during order creation');
 }
 /**
  * Create sales entity for order on backend.
  *
  * @return array
  */
 public function run()
 {
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->orderId]);
     $this->processStep();
     return ['ids' => [$this->entityType . 'Ids' => $this->getEntityIds($this->entityType)]];
 }
 /**
  * Assert that created Store Group can be found in "Purchase Point" dropdown on SalesOrderIndex page.
  *
  * @param SalesOrderIndex $salesOrderIndex
  * @param array $storeGroups
  * @return void
  */
 public function processAssert(SalesOrderIndex $salesOrderIndex, array $storeGroups)
 {
     $salesOrderIndex->open();
     foreach ($storeGroups as $storeGroup) {
         /** @var StoreGroup $storeGroup */
         $storeGroupName = $storeGroup->getName();
         \PHPUnit_Framework_Assert::assertTrue($salesOrderIndex->getSalesOrderGrid()->isRowVisible(['purchased_from' => $storeGroupName]), "Store group '{$storeGroupName}' is not present in grid filter.");
     }
 }
 /**
  * Assert that address on order page in backend is same as address in PayPal.
  *
  * @param SalesOrderIndex $salesOrderIndex
  * @param SalesOrderView $salesOrderView
  * @param PaypalCustomer $paypalCustomer
  * @param string $orderId
  * @return void
  */
 public function processAssert(SalesOrderIndex $salesOrderIndex, SalesOrderView $salesOrderView, PaypalCustomer $paypalCustomer, $orderId)
 {
     $addressBlock = "get{$this->addressType}AddressBlock";
     $salesOrderIndex->open()->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     /** @var Info $informationTab */
     $informationTab = $salesOrderView->getOrderForm()->getTabElement('information');
     $orderAddress = $informationTab->{$addressBlock}()->getAddress();
     $payPalShippingAddress = $this->prepareCustomerAddress($paypalCustomer, $orderAddress);
     \PHPUnit_Framework_Assert::assertEquals($payPalShippingAddress, $orderAddress);
 }
 /**
  * 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'] : []];
 }
Ejemplo n.º 9
0
 /**
  * Assert that message like this persist on Comments History section on order page in backend:
  * "transaction_type amount of some_amount. Transaction ID: "transaction_id"
  *
  * @param SalesOrderIndex $salesOrderIndex
  * @param SalesOrderView $salesOrderView
  * @param string $orderId
  * @param string $transactionType
  * @param string $paymentAction
  * @param string $grandTotal
  * @return void
  */
 public function processAssert(SalesOrderIndex $salesOrderIndex, SalesOrderView $salesOrderView, $orderId, $transactionType, $paymentAction, $grandTotal)
 {
     $filter = ['order_id' => $orderId, 'transaction_type' => $transactionType];
     $salesOrderIndex->open()->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     $orderForm = $salesOrderView->getOrderForm();
     /** Check if transaction present in comments block. */
     /** @var Info $informationTab */
     $informationTab = $orderForm->getTabElement('information');
     $text = $this->prepareSearchedText($grandTotal);
     \PHPUnit_Framework_Assert::assertTrue($informationTab->getCommentsBlock()->isCommentPresent($text), 'Searched text is not present in order comments.');
     \PHPUnit_Framework_Assert::assertTrue($informationTab->getCommentsBlock()->isCommentPresent($paymentAction), 'Order has a wrong payment action.');
     /** Check if transaction present in transactions Grid. */
     $orderForm->openTab('transactions');
     /** @var Transactions $transactionsTab */
     $transactionsTab = $orderForm->getTabElement('transactions');
     \PHPUnit_Framework_Assert::assertTrue($transactionsTab->getGrid()->isRowVisible($filter), 'Searched transaction is not present in transaction grid.');
 }
 /**
  * Assert address.
  *
  * @param SalesOrderIndex $salesOrder
  * @param SalesOrderView $salesOrderView
  * @param string $orderId
  * @param string $addressData
  * @return void
  */
 protected function assert(SalesOrderIndex $salesOrder, SalesOrderView $salesOrderView, $orderId, $addressData)
 {
     $salesOrder->open()->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     \PHPUnit_Framework_Assert::assertEquals($addressData, $this->getFormAddress($salesOrderView));
 }
 /**
  * Open Sales order.
  *
  * @return void
  */
 public function run()
 {
     $this->orderIndex->open();
 }
 /**
  * Assert that status is correct on order page in backend (same with value of orderStatus variable).
  *
  * @param string $previousOrderStatus
  * @param Order $order
  * @param SalesOrderIndex $salesOrder
  * @param SalesOrderView $salesOrderView
  * @return void
  */
 public function processAssert($previousOrderStatus, Order $order, SalesOrderIndex $salesOrder, SalesOrderView $salesOrderView)
 {
     $salesOrder->open()->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
     \PHPUnit_Framework_Assert::assertEquals($previousOrderStatus, $salesOrderView->getOrderForm()->getTabElement('information')->getOrderInfoBlock()->getOrderStatus(), 'Order status is incorrect on order page in backend.');
 }
 /**
  * Assert that specified in data set buttons exist on order page in backend.
  *
  * @param SalesOrderIndex $salesOrder
  * @param SalesOrderView $salesOrderView
  * @param string $orderButtonsAvailable
  * @param string $orderId
  * @return void
  */
 public function processAssert(SalesOrderIndex $salesOrder, SalesOrderView $salesOrderView, $orderButtonsAvailable, $orderId)
 {
     $salesOrder->open()->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     $absentButtons = $this->getAbsentButtons($salesOrderView, $orderButtonsAvailable);
     \PHPUnit_Framework_Assert::assertEmpty($absentButtons, "Next buttons was not found on page: \n" . implode(";\n", $absentButtons));
 }
Ejemplo n.º 14
0
 /**
  * Open order.
  *
  * @return void
  */
 public function run()
 {
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->order->getId()]);
 }
 /**
  * Assert that status is correct on order page in backend (same with value of orderStatus variable).
  *
  * @param SalesOrderIndex $salesOrder
  * @param SalesOrderView $salesOrderView
  * @param string $status
  * @param string $orderId
  * @return void
  */
 public function processAssert(SalesOrderIndex $salesOrder, SalesOrderView $salesOrderView, $status, $orderId)
 {
     $salesOrder->open()->getSalesOrderGrid()->searchAndOpen(['id' => $orderId]);
     \PHPUnit_Framework_Assert::assertEquals($status, $salesOrderView->getOrderForm()->getTabElement('information')->getOrderInfoBlock()->getOrderStatus());
 }
 /**
  * Open page for assert.
  *
  * @return void
  */
 protected function openPage()
 {
     $this->orderIndex->open();
     $this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $this->orderId]);
     $this->salesOrderView->getOrderForm()->openTab($this->entityType . 's');
 }
 /**
  * Assert that Order is present in orders grid on backend.
  *
  * @param SalesOrderIndex $salesOrder
  * @param string $orderId
  * @return void
  */
 public function processAssert(SalesOrderIndex $salesOrder, $orderId)
 {
     \PHPUnit_Framework_Assert::assertTrue($salesOrder->open()->getSalesOrderGrid()->isRowVisible(['id' => $orderId]), "Order with id {$orderId} is absent in orders grid on backend.");
 }