本文整理匯總了PHP中Magento\Sales\Test\Fixture\OrderInjectable類的典型用法代碼示例。如果您正苦於以下問題:PHP OrderInjectable類的具體用法?PHP OrderInjectable怎麽用?PHP OrderInjectable使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了OrderInjectable類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processAssert
/**
* Assert order is not visible in customer account on frontend
*
* @param OrderInjectable $order
* @param Customer $customer
* @param CustomerAccountIndex $customerAccountIndex
* @param OrderHistory $orderHistory
* @param string $status
* @return void
*/
public function processAssert(OrderInjectable $order, Customer $customer, CustomerAccountIndex $customerAccountIndex, OrderHistory $orderHistory, $status)
{
$filter = ['id' => $order->getId(), 'status' => $status];
$this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
$customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Orders');
\PHPUnit_Framework_Assert::assertFalse($orderHistory->getOrderHistoryBlock()->isVisible() && $orderHistory->getOrderHistoryBlock()->isOrderVisible($filter), 'Order with following data \'' . implode(', ', $filter) . '\' is present in Orders block on frontend.');
}
示例2: processAssert
/**
* Assert bestseller info in report: date, product name and qty.
*
* @param Bestsellers $bestsellers
* @param OrderInjectable $order
* @param string $date
* @return void
*/
public function processAssert(Bestsellers $bestsellers, OrderInjectable $order, $date)
{
/** @var CatalogProductSimple $product */
$product = $order->getEntityId()['products'][0];
$filter = ['date' => date($date), 'product' => $product->getName(), 'price' => $product->getPrice(), 'orders' => $product->getCheckoutData()['qty']];
\PHPUnit_Framework_Assert::assertTrue($bestsellers->getGridBlock()->isRowVisible($filter, false), 'Bestseller does not present in report grid.');
}
示例3: test
/**
* Create invoice.
*
* @param OrderInjectable $order
* @param array $data
* @return array
*/
public function test(OrderInjectable $order, array $data)
{
// Preconditions
$order->persist();
// Steps
$result = $this->objectManager->create('Magento\\Sales\\Test\\TestStep\\CreateInvoiceStep', ['order' => $order, 'data' => $data])->run();
return ['ids' => ['invoiceIds' => $result['invoiceIds'], 'shipmentIds' => isset($result['shipmentIds']) ? $result['shipmentIds'] : null]];
}
示例4: processAssert
/**
* Assert coupon info in report: code, rule name, subtotal, discount on coupons report page
*
* @param SalesCouponReportView $salesCouponReportView
* @param OrderInjectable $order
* @param string $currency
* @return void
*/
public function processAssert(SalesCouponReportView $salesCouponReportView, OrderInjectable $order, $currency = '$')
{
$data = $order->getData();
$discount = $data['price']['discount'] != 0 ? '-' . $currency . number_format($data['price']['discount'], 2) : $currency . '0.00';
$couponCode = $data['coupon_code']->getCouponCode();
$filter = ['coupon_code' => $couponCode, 'rule_name' => $data['coupon_code']->getName(), 'subtotal' => $currency . number_format($data['price']['subtotal'], 2), 'discount' => $discount];
\PHPUnit_Framework_Assert::assertTrue($salesCouponReportView->getGridBlock()->isRowVisible($filter, false), "Coupon with code - '{$couponCode}' is not visible.");
}
示例5: processAssert
/**
* Assert that order is present in Orders grid on frontend.
*
* @param OrderInjectable $order
* @param Customer $customer
* @param ObjectManager $objectManager
* @param CustomerAccountIndex $customerAccountIndex
* @param OrderHistory $orderHistory
* @param string $status
* @param string $orderId
* @param string|null $statusToCheck
* @return void
*/
public function processAssert(OrderInjectable $order, Customer $customer, ObjectManager $objectManager, CustomerAccountIndex $customerAccountIndex, OrderHistory $orderHistory, $status, $orderId = '', $statusToCheck = null)
{
$filter = ['id' => $order->hasData('id') ? $order->getId() : $orderId, 'status' => $statusToCheck === null ? $status : $statusToCheck];
$objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
$customerAccountIndex->getAccountMenuBlock()->openMenuItem('My Orders');
$errorMessage = implode(', ', $filter);
\PHPUnit_Framework_Assert::assertTrue($orderHistory->getOrderHistoryBlock()->isOrderVisible($filter), 'Order with following data \'' . $errorMessage . '\' is absent in Orders block on frontend.');
}
示例6: processAssert
/**
* Assert that order with fixture data in not more in the Orders grid
*
* @param OrderInjectable $order
* @param OrderIndex $orderIndex
* @return void
*/
public function processAssert(OrderInjectable $order, OrderIndex $orderIndex)
{
$data = $order->getData();
$filter = ['id' => $data['id']];
$orderIndex->open();
$errorMessage = implode(', ', $filter);
\PHPUnit_Framework_Assert::assertFalse($orderIndex->getSalesOrderGrid()->isRowVisible($filter), 'Order with following data \'' . $errorMessage . '\' is present in Orders grid.');
}
示例7: test
/**
* Create invoice.
*
* @param OrderInjectable $order
* @param array $data
* @return array
*/
public function test(OrderInjectable $order, array $data)
{
// Preconditions
$order->persist();
// Steps
$result = $this->objectManager->create('Magento\\Sales\\Test\\TestStep\\CreateInvoiceStep', ['order' => $order, 'data' => $data])->run();
return $result;
}
示例8: test
/**
* Search order products report.
*
* @param OrderInjectable $order
* @param array $customersReport
* @return void
*/
public function test(OrderInjectable $order, array $customersReport)
{
// Preconditions
$order->persist();
// Steps
$this->orderedProducts->open();
$this->orderedProducts->getGridBlock()->searchAccounts($customersReport);
}
示例9: test
/**
* Create shipment.
*
* @param OrderInjectable $order
* @param array $data
* @return array
*/
public function test(OrderInjectable $order, array $data)
{
// Preconditions
$order->persist();
// Steps
$createShipping = $this->objectManager->create('Magento\\Sales\\Test\\TestStep\\CreateShipmentStep', ['order' => $order, 'data' => $data]);
return ['ids' => $createShipping->run()];
}
示例10: processAssert
/**
* Assert that invoiced Grand Total amount is equal to placed order Grand total amount on invoice page (frontend)
*
* @param OrderHistory $orderHistory
* @param OrderInjectable $order
* @param CustomerOrderView $customerOrderView
* @param InvoiceView $invoiceView
* @param array $ids
* @return void
*/
public function processAssert(OrderHistory $orderHistory, OrderInjectable $order, CustomerOrderView $customerOrderView, InvoiceView $invoiceView, array $ids)
{
$this->loginCustomerAndOpenOrderPage($order->getDataFieldConfig('customer_id')['source']->getCustomer());
$orderHistory->getOrderHistoryBlock()->openOrderById($order->getId());
$customerOrderView->getOrderViewBlock()->openLinkByName('Invoices');
foreach ($ids['invoiceIds'] as $key => $invoiceId) {
\PHPUnit_Framework_Assert::assertEquals(number_format($order->getPrice()[$key]['grand_invoice_total'], 2), $invoiceView->getInvoiceBlock()->getItemBlock($invoiceId)->getGrandTotal());
}
}
示例11: getOrdersResults
/**
* Get orders quantity from Ordered Products Report grid
*
* @param OrderInjectable $order
* @return array
*/
public function getOrdersResults(OrderInjectable $order)
{
$products = $order->getEntityId()['products'];
$views = [];
foreach ($products as $key => $product) {
$views[$key] = $this->_rootElement->find(sprintf($this->product, $product->getName()), Locator::SELECTOR_XPATH)->getText();
}
return $views;
}
示例12: test
/**
* Put created order on hold.
*
* @param OrderInjectable $order
* @return array
*/
public function test(OrderInjectable $order)
{
// Preconditions
$order->persist();
// Steps
$this->orderIndex->open();
$this->orderIndex->getSalesOrderGrid()->searchAndOpen(['id' => $order->getId()]);
$this->salesOrderView->getPageActions()->hold();
return ['customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer()];
}
示例13: processAssert
/**
* Assert that shipped items quantity in 'Total Quantity' is equal to data from fixture on My Account page
*
* @param OrderHistory $orderHistory
* @param OrderInjectable $order
* @param CustomerOrderView $customerOrderView
* @param ShipmentView $shipmentView
* @param array $ids
* @return void
*/
public function processAssert(OrderHistory $orderHistory, OrderInjectable $order, CustomerOrderView $customerOrderView, ShipmentView $shipmentView, array $ids)
{
$totalQty = $order->getTotalQtyOrdered();
$this->loginCustomerAndOpenOrderPage($order->getDataFieldConfig('customer_id')['source']->getCustomer());
$orderHistory->getOrderHistoryBlock()->openOrderById($order->getId());
$customerOrderView->getOrderViewBlock()->openLinkByName('Order Shipments');
foreach ($ids['shipmentIds'] as $key => $shipmentIds) {
\PHPUnit_Framework_Assert::assertEquals($totalQty[$key], $shipmentView->getShipmentBlock()->getItemShipmentBlock($shipmentIds)->getTotalQty());
}
}
示例14: processAssert
/**
* Assert shipment with corresponding shipment/order ID is present in 'Shipments' with correct total qty field
*
* @param ShipmentIndex $shipmentIndex
* @param OrderInjectable $order
* @param array $ids
* @return void
*/
public function processAssert(ShipmentIndex $shipmentIndex, OrderInjectable $order, array $ids)
{
$shipmentIndex->open();
$orderId = $order->getId();
$totalQty = $order->getTotalQtyOrdered();
foreach ($ids['shipmentIds'] as $key => $shipmentIds) {
$filter = ['id' => $shipmentIds, 'order_id' => $orderId, 'total_qty_from' => $totalQty[$key], 'total_qty_to' => $totalQty[$key]];
\PHPUnit_Framework_Assert::assertTrue($shipmentIndex->getShipmentsGrid()->isRowVisible($filter), 'Shipment is absent in shipment grid on shipment index page.');
}
}
示例15: prepareOrderProducts
/**
* Prepare order products
*
* @param OrderInjectable $order
* @param array|null $data [optional]
* @return array
*/
protected function prepareOrderProducts(OrderInjectable $order, array $data = null)
{
$products = $order->getEntityId()['products'];
$productsData = [];
/** @var CatalogProductSimple $product */
foreach ($products as $key => $product) {
$productsData[] = ['product' => $product->getName(), 'sku' => $product->getSku(), 'qty' => isset($data[$key]['qty']) && $data[$key]['qty'] != '-' ? $data[$key]['qty'] : $product->getCheckoutData()['qty']];
}
return $this->sortDataByPath($productsData, $this->sortKey);
}