/** * @covers Redmine\Client * @test */ public function testProcessCurlResponse() { // Create the object under test $client = new Client('http://test.local', 'asdf'); // Perform the tests // failed request $this->assertFalse($client->processCurlResponse(false, 'application/xml')); // successfull request $this->assertTrue($client->processCurlResponse(true, 'text/html')); // Text response $this->assertSame('response content', $client->processCurlResponse('response content', 'text/plain')); // JSON response $this->assertSame('{"api": "redmine"}', $client->processCurlResponse('{"api": "redmine"}', 'application/json')); // XML response /* @var $xmlResponse SimpleXMLElement */ $xmlResponse = $client->processCurlResponse('<issue/>', 'application/xml'); $this->assertInstanceOf('SimpleXMLElement', $xmlResponse); $this->assertSame('issue', $xmlResponse->getName()); }