Ejemplo n.º 1
0
 /**
  * @dataProvider statusProvider
  */
 public function test_edit_status($status, $isValid)
 {
     Phake::when($this->client)->request('post', '/1/orders/edit_status', ['order_item_id' => 100, 'status' => $status, 'add_comment' => 'test'])->thenReturn(['order' => ['test' => 'test']]);
     Phake::when($this->em)->getEntity('Order', ['test' => 'test'])->thenReturn('entity');
     $ordersApi = new Orders($this->client, $this->em);
     if (!$isValid) {
         $this->setExpectedException('\\Quartet\\BaseApi\\Exception\\InvalidParameterException');
     }
     $this->assertEquals('entity', $ordersApi->edit_status(100, $status, 'test'));
 }
 /**
  * @group functional
  * @group orders
  */
 public function test_orders_detail()
 {
     $this->setFixture(__FUNCTION__);
     $ordersApi = new Orders($this->client);
     $order = $ordersApi->detail('unique_key');
     $this->assertInstanceOf('\\Quartet\\BaseApi\\Entity\\Order', $order);
     $this->assertEquals('154D88A39E454289', $order->unique_key);
     $this->assertEquals('106-0032', $order->zip_code);
     $this->assertInstanceOf('\\Quartet\\BaseApi\\Entity\\Subset\\OrderReceiver', $order->order_receiver);
     $this->assertInstanceOf('\\Quartet\\BaseApi\\Entity\\Subset\\OrderDiscount', $order->order_discount);
     $this->assertInstanceOf('\\Quartet\\BaseApi\\Entity\\Subset\\CCPaymentTransaction', $order->c_c_payment_transaction);
     $this->assertInstanceOf('\\Quartet\\BaseApi\\Entity\\Subset\\CvsPaymentTransaction', $order->cvs_payment_transaction);
     $this->assertInstanceOf('\\Quartet\\BaseApi\\Entity\\Subset\\OrderItem', $order->order_items[0]);
     $this->assertEquals('150-0043', $order->order_receiver->zip_code);
     $this->assertEquals(1000, $order->order_discount->discount);
     $this->assertEquals(200, $order->c_c_payment_transaction->collected_fee);
     $this->assertEquals(null, $order->cvs_payment_transaction->collected_fee);
     $this->assertEquals(124, $order->order_items[1]->order_item_id);
 }