Exemple #1
0
 /**
  * @covers            Islandora\Fedora\Chullo::moveResource
  * @uses              GuzzleHttp\Client
  * @expectedException GuzzleHttp\Exception\ServerException
  */
 public function testThrowsExceptionOn502()
 {
     $mock = new MockHandler([new Response(502)]);
     $handler = HandlerStack::create($mock);
     $guzzle = new Client(['handler' => $handler, 'base_uri' => 'http://localhost:8080/fcrepo/rest']);
     $client = new Chullo($guzzle);
     $result = $client->moveResource("", "");
 }
 /**
  * @covers            Islandora\Fedora\Chullo::moveResource
  * @uses              GuzzleHttp\Client
  */
 public function testReturnsNullOtherwise()
 {
     $mock = new MockHandler([new Response(404), new Response(409), new Response(502)]);
     $handler = HandlerStack::create($mock);
     $guzzle = new Client(['handler' => $handler]);
     $api = new FedoraApi($guzzle);
     $client = new Chullo($api);
     foreach ($mock as $response) {
         $result = $client->moveResource("", "");
         $this->assertNull($result);
     }
 }