/** * @dataProvider parametersProvider */ public function test_get($order, $sort, $limit, $isValid) { Phake::when($this->client)->request('get', '/1/items', ['order' => $order, 'sort' => $sort, 'limit' => $limit, 'offset' => 0])->thenReturn(['items' => [['test1' => 'test'], ['test2' => 'test'], ['test3' => 'test']]]); Phake::when($this->em)->getEntity('Item', ['test1' => 'test'])->thenReturn('entity1'); Phake::when($this->em)->getEntity('Item', ['test2' => 'test'])->thenReturn('entity2'); Phake::when($this->em)->getEntity('Item', ['test3' => 'test'])->thenReturn('entity3'); $itemsApi = new Items($this->client, $this->em); $expected = ['entity1', 'entity2', 'entity3']; if (!$isValid) { $this->setExpectedException('\\Quartet\\BaseApi\\Exception\\InvalidParameterException'); } $this->assertEquals($expected, $itemsApi->get($order, $sort, $limit)); }
var_dump($user); // object(Quartet\BaseApi\Entity\User)[30] // public 'shop_id' => string 'sample_shop' (length=11) // public 'shop_name' => string 'sample shop name' (length=16) // public 'shop_introduction' => string '' (length=0) // public 'shop_url' => string 'http://sample_shop.thebase.in' (length=29) // public 'twitter_id' => string '' (length=0) // public 'facebook_id' => string '' (length=0) // public 'ameba_id' => string '' (length=0) // public 'instagram_id' => string '' (length=0) // public 'background' => null // public 'logo' => null // public 'mail_address' => null // Items api. $itemsApi = new Items($client); $items = $itemsApi->get(); var_dump($items[0]); // object(Quartet\BaseApi\Entity\Item)[49] // public 'item_id' => int 842194 // public 'title' => string 'Tシャツ' (length=10) // public 'detail' => string '' (length=0) // public 'price' => int 2000 // public 'stock' => int 8 // public 'visible' => int 1 // public 'list_order' => int 1 // public 'identifier' => null // public 'img1_origin' => null // public 'img1_76' => null // public 'img1_146' => null // public 'img1_300' => null // public 'img1_500' => null