/** * Execute back order restock task */ public function execute() { if (!empty($this->args[0])) { $this->sku = $this->args[0]; } if (!empty($this->args[1])) { $this->date = $this->args[1]; } if (!empty($this->args[2])) { $this->sku_quantity = $this->args[2]; } if (!empty($this->args[3])) { $this->warehouse = $this->args[3]; } if (isset($this->args[4])) { $this->send_email = $this->args[4]; } if (!empty($this->args[5])) { $this->second_date = $this->args[5]; } if (!empty($this->args[6])) { $this->second_sku_quantity = $this->args[6]; } $options = ['sku' => $this->sku, 'warehouse' => $this->warehouse, 'date' => $this->date, 'second_date' => $this->second_date, 'second_sku_quantity' => $this->second_sku_quantity, 'sku_quantity' => $this->sku_quantity, 'send_email' => $this->send_email]; $this->api = new BackOrderRestock($options); /** * Execute and send return to output */ $results = $this->api->execute(); $this->out($results['output'], 1, Shell::NORMAL); }
/** * 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']); }