/** * @covers Islandora\Fedora\Chullo::saveGraph * @uses GuzzleHttp\Client * @expectedException GuzzleHttp\Exception\ClientException */ public function testThrowsExceptionOn409() { $mock = new MockHandler([new Response(409)]); $handler = HandlerStack::create($mock); $guzzle = new Client(['handler' => $handler, 'base_uri' => 'http://localhost:8080/fcrepo/rest']); $client = new Chullo($guzzle); $result = $client->saveGraph("", new \EasyRdf_Graph()); }
/** * @covers Islandora\Fedora\Chullo::saveGraph * @uses GuzzleHttp\Client */ public function testReturnsFalseOtherwise() { $mock = new MockHandler([new Response(412), new Response(409)]); $handler = HandlerStack::create($mock); $guzzle = new Client(['handler' => $handler]); $api = new FedoraApi($guzzle); $client = new Chullo($api); foreach ($mock as $response) { $result = $client->saveGraph("", new \EasyRdf_Graph()); $this->assertFalse($result); } }