Example #1
0
 /**
  * Test array of models in response defined with wrapper model containing an array property
  * @group mock
  * @depends testClientConstruct
  */
 public function testModelListObjectResponse(Client $client)
 {
     // fake a response with multiple valid objects
     $plugin = new MockPlugin();
     $plugin->addResponse(new Response(200, array(), '{"list":[{"foo":4},{"foo":5},{"foo":6}]}'));
     $client->addSubscriber($plugin);
     $response = $client->testwrapobj();
     // test response is a model
     $this->assertInstanceof('\\Guzzle\\Service\\Resource\\Model', $response);
     // test response has 3 items
     $list = $response->get('list');
     $this->assertCount(3, $list);
 }