コード例 #1
0
 public function testCreatePutBodyWithCorrectResourceRequestKey()
 {
     $this->assertEquals('product', $this->product->resourceRequestKey);
     $request = new \SkyHub\Request\ProductRequest($this->auth);
     $putBody = $request->createPutBody($this->product);
     $putBodyArray = json_decode($putBody, true);
     $this->assertArrayHasKey('product', $putBodyArray);
 }
コード例 #2
0
 public function testApiSkyHubEndpointSuccessfully()
 {
     $attributes = new \SkyHub\Request\AttributeRequest($this->auth);
     $this->assertEquals('https://in.skyhub.com.br/attributes', $attributes->endpoint());
     $categories = new \SkyHub\Request\CategoryRequest($this->auth);
     $this->assertEquals('https://in.skyhub.com.br/categories', $categories->endpoint());
     $orders = new \SkyHub\Request\OrderRequest($this->auth);
     $this->assertEquals('https://in.skyhub.com.br/orders', $orders->endpoint());
     $products = new \SkyHub\Request\ProductRequest($this->auth);
     $this->assertEquals('https://in.skyhub.com.br/products', $products->endpoint());
     $statusTypes = new \SkyHub\Request\StatusTypeRequest($this->auth);
     $this->assertEquals('https://in.skyhub.com.br/status_types', $statusTypes->endpoint());
 }
コード例 #3
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());
     }
 }