public function testPost()
 {
     $resource = TestProductFactory::factory();
     try {
         $this->request->post($resource);
     } catch (\Exception $e) {
         $this->fail('Product test POST fail: ' . $e->getMessage());
     }
     return $resource;
 }
示例#2
0
 public function testCreateTest()
 {
     $productRequest = new \SkyHub\Request\ProductRequest($this->auth);
     $product = TestProductFactory::factory();
     try {
         $productRequest->post($product);
     } catch (\Exception $e) {
         $this->fail('Product test POST fail: ' . $e->getMessage());
     }
     $order = new \SkyHub\Resource\Order();
     $order->channel = "Submarino";
     $order->status = "11";
     $order->items = array(array("id" => $product->sku, "qty" => 1));
     $order->customer = array("name" => "Glauber Portella", "email" => "*****@*****.**", "date_of_birth" => "1998-01-25", "gender" => "male", "vat_number" => "78732371683", "phones" => array("21 3722-3902"));
     $order->billing_address = array("street" => "Rua Sacadura Cabral", "number" => "130", "detail" => "", "neighborhood" => "Centro", "city" => "Rio de Janeiro", "region" => "RJ", "country" => "BR", "post_code" => "20081262");
     $order->shipping_address = array("street" => "Rua Sacadura Cabral", "number" => "130", "detail" => "", "neighborhood" => "Centro", "city" => "Rio de Janeiro", "region" => "RJ", "country" => "BR", "post_code" => "20081262");
     $order->shipping_method = "Correios PAC";
     $order->estimated_delivery = "2017-02-11";
     $order->shipping_cost = 15.32;
     $order->interest = 3.54;
     try {
         $this->request->createTest($order);
     } catch (Exception $e) {
         $this->fail('Request fail on OrderRequest::createTest()');
     }
     // delete product
     try {
         $productRequest->delete($product);
     } catch (\Exception $e) {
         $this->fail('Product test DELETE fail: ' . $e->getMessage());
     }
 }