/** * @covers Guzzle\Service\Description\ApiCommand::toArray */ public function testConvertsToArray() { $data = array('name' => 'test', 'class' => 'Guzzle\\Service\\Command\\ClosureCommand', 'doc' => 'test', 'doc_url' => 'http://www.example.com', 'method' => 'PUT', 'uri' => '/', 'params' => array('p' => array('name' => 'foo')), 'result_type' => null, 'result_doc' => null, 'deprecated' => false); $c = new ApiCommand($data); $toArray = $c->toArray(); $this->assertArrayHasKey('params', $toArray); $this->assertInternalType('array', $toArray['params']); // Normalize the array unset($data['params']); unset($toArray['params']); $this->assertEquals($data, $toArray); }
/** * @covers Guzzle\Service\Description\ApiCommand::toArray */ public function testConvertsToArray() { $data = array('name' => 'test', 'class' => 'Guzzle\\Service\\Command\\ClosureCommand', 'doc' => 'test', 'method' => 'PUT', 'uri' => '/', 'params' => array('p' => new ApiParam(array('name' => 'foo')))); $c = new ApiCommand($data); $this->assertEquals($data, $c->toArray()); }