Example #1
0
 function test_get_access_status_error()
 {
     $accessStatusUri = 'http://example.org/store/config/access-status';
     $response = new HttpResponse(500);
     $mockRequest = $this->getMock('HttpRequest', array('set_accept', 'execute'), array('GET', $accessStatusUri));
     $mockRequest->expects($this->once())->method('set_accept')->with(MIME_RDFXML);
     $mockRequest->expects($this->once())->method('execute')->will($this->returnValue($response));
     $mockRequestFactory = $this->getMock('HttpRequestFactory', array('make'));
     $mockRequestFactory->expects($this->once())->method('make')->will($this->returnValue($mockRequest));
     $this->setExpectedException('Exception', 'Error determining access status:');
     $config = new Config("http://example.org/store/config", null, $mockRequestFactory);
     $actual = $config->get_access_status();
 }
 function test_get_access_status_error()
 {
     $accessStatusUri = 'http://example.org/store/config/access-status';
     $response = new HttpResponse(500);
     $mockRequest = $this->getMock('HttpRequest', array('set_accept', 'execute'), array('GET', $accessStatusUri));
     $mockRequest->expects($this->once())->method('set_accept')->with(MIME_RDFXML);
     $mockRequest->expects($this->once())->method('execute')->will($this->returnValue($response));
     $mockRequestFactory = $this->getMock('HttpRequestFactory', array('make'));
     $mockRequestFactory->expects($this->once())->method('make')->will($this->returnValue($mockRequest));
     $config = new Config("http://example.org/store/config", null, $mockRequestFactory);
     try {
         $actual = $config->get_access_status();
         $this->fail("Should have got exception thrown by get_access_status");
     } catch (Exception $ex) {
         $msg = trim($ex->getMessage());
         $this->assertEquals('Error determining access status: 500', $msg, 'should get expected exception message');
     }
 }