/** * Test Restock with a partial backorder */ public function testRestockPartialBackorder() { $this->test_order = new TestOrder(['database' => 'test', 'items' => [['qty' => 10, 'sku' => 'US-11803-02'], ['qty' => 3, 'sku' => 'US-11101-02']]]); $this->test_order->create_test_order(); $result = $this->back_order_restock->execute(); $this->assertTrue($result['success']); }
/** * Validate back order card with sets */ public function testReplacementInventoryCountAvailable() { $this->test_order = new TestOrder(['replacement' => true, 'database' => 'test', 'items' => [['qty' => 1, 'sku' => 'US-11404-06']]]); $order_id = $this->test_order->create_test_order(); $this->Order->id = $order_id; $order = $this->Order->loadDisplayDetails(); $this->assertNotEmpty($order['OrderShipment']); }
/** * Duplicate order should be success * @throws Exception * @throws NetSuiteException */ public function testExportOrderDuplicateSuccess() { $this->test_order = new TestOrder(['database' => 'test', 'items' => [['qty' => 5, 'sku' => 'US-11803-02']]]); $order_id = $this->test_order->create_test_order(false); $this->Order->id = $order_id; /** * Execute export order */ $result = $this->DataFlowFour->exportOrder($order_id, $this->timeout); $success = strpos($result['log'], 'Record Already In NetSuite') !== false; $this->assertTrue($result['success']); $this->assertTrue($success); }
/** * Test allocating inventory without a backorder policy */ public function testAllocateInventorySplitNoPolicy() { $warehouse = NsWarehouse::LEHI; /** * Plus Minus */ $this->NsProductCount->id = 2; $this->NsProductCount->saveField('inventory_count', 0); $this->NsWarehouse->updateAvailability(); $address = ["first_name" => "Test", "last_name" => "User", "address1" => 'Epplingser Halde 25', "address2" => NULL, "address3" => NULL, "city" => "Wangen", "state_id" => 52, "postal_code" => "88239", "country_id" => 10, "email_address" => "*****@*****.**"]; $this->test_order = new TestOrder(['database' => 'test', 'address' => $address, 'warehouse' => $warehouse, 'items' => [['qty' => 10, 'sku' => 'US-11101-02'], ['qty' => 10, 'sku' => 'US-11404-06']]]); $order_id = $this->test_order->create_test_order(); $result = $this->Order->allocateInventory($order_id); $this->Order->id = $order_id; $order = $this->Order->loadDisplayDetails(); $this->assertEquals(NsWarehouse::LEHI, $order['OrderCustomer']['OrderItem'][1]['ns_warehouse_id']); $this->assertEquals(1, count($order['OrderShipment'])); $this->assertTrue($result); }
/** * Test empty xml */ public function testEmptyXml() { $order_id = $this->test_order->create_test_order(); $this->assertTrue(!empty($order_id)); $this->Order->id = $order_id; $result = $this->Order->oxxoPaid(''); /** * Validate that it failed */ $this->assertFalse($result['success']); /** * Validate that is was not actionable */ $this->assertFalse($result['actionable']); /** * Validate no Payment */ $payment = Hash::extract($this->OrderPayment->find('first', ['conditions' => ['OrderPayment.order_id' => $order_id, 'OrderPayment.order_payment_status_id' => OrderPayment::STATUS_SUCCESS, 'OrderPayment.order_payment_type_id' => OrderPaymentType::STATUS_OXXO, 'OrderPayment.order_payment_processor_id' => OrderPaymentProcessor::PROCESSOR_WORLDPAY_OXXO]]), 'OrderPayment'); $this->assertEmpty($payment); }
/** * Validate back order card with sets */ public function testBackOrderCardWithPreKitSets() { $this->test_order = new TestOrder(['database' => 'test', 'items' => [['qty' => 1, 'sku' => 'US-32302-01', 'options' => []]]]); $order_id = $this->test_order->create_test_order(); $this->Order->id = $order_id; $result = $this->Order->addBackOrderCard(); $this->assertTrue($result); $order = $this->Order->loadDisplayDetails(); $backorder_card = false; $correct_quantity = false; $item_count = 0; foreach ($order['OrderCustomer']['OrderItem'] as $item) { if ($item['Item']['sku'] == 'US-6006-01') { $item_count++; $backorder_card = true; if ($item['quantity'] == 1) { $correct_quantity = true; } } } $this->assertFalse($backorder_card); $this->assertFalse($correct_quantity); $this->assertEquals(0, $item_count); }