assertInstanceOf($expected, Request_Client_External::factory($params, $client)); } /** * Data provider for test_options * * @return array */ public function provider_options() { return [ [ NULL, NULL, [] ], [ ['foo' => 'bar', 'stfu' => 'snafu'], NULL, ['foo' => 'bar', 'stfu' => 'snafu'] ], [ 'foo', 'bar', ['foo' => 'bar'] ], [ ['foo' => 'bar'], 'foo', ['foo' => 'bar'] ] ]; } /** * Tests the [Request_Client_External::options()] method * * @dataProvider provider_options * * @param mixed $key key * @param mixed $value value * @param array $expected expected * @return void */ public function test_options($key, $value, $expected) { // Create a mock external client $client = new Request_Client_Stream; $client->options($key, $value); $this->assertSame($expected, $client->options()); } /** * Data provider for test_execute * * @return array */ public function provider_execute() { $json = '{"foo": "bar", "snafu": "stfu"}'; $post = ['foo' => 'bar', 'snafu' => 'stfu']; return [ [ 'application/json', $json, [], [ 'content-type' => 'application/json', 'body' => $json ] ], [ 'application/json', $json, $post, [ 'content-type' => 'application/x-www-form-urlencoded; charset='.Kohana::$charset, 'body' => http_build_query($post, NULL, '&') ] ] ]; } }