function runTest()
 {
     foreach ($this->cases as $thing_to_raise) {
         $fetcher = ErrorRaisingFetcher($thing_to_raise);
         Auth_OpenID_discover('http://doesnt.matter/', $fetcher);
         $exc = __getError();
         if ($exc !== $thing_to_raise) {
             $this->fail('FetchException expected %s to be raised', $thing_to_raise);
         }
     }
 }
Exemple #2
0
 function test_error_exception()
 {
     $this->consumer->fetcher = new _ExceptionRaisingMockFetcher();
     $query = array('openid.mode' => 'associate');
     $message = Auth_OpenID_Message::fromPostArgs($query);
     $this->consumer->_makeKVPost($message, "http://server_url");
     if (__getError() !== E_MOCK_FETCHER_EXCEPTION) {
         $this->fail("Expected ExceptionRaisingMockFetcher to " . "raise E_MOCK_FETCHER_EXCEPTION");
     }
     $endpoint = new Auth_OpenID_ServiceEndpoint();
     $endpoint->server_url = 'some://url';
     // exception fetching returns no association
     $this->assertEquals($this->consumer->_getAssociation($endpoint), null);
     $query = array('openid.signed' => '');
     $message = Auth_OpenID_Message::fromPostArgs($query);
     $this->consumer->_checkAuth($message, 'some://url');
     if (__getError() !== E_MOCK_FETCHER_EXCEPTION) {
         $this->fail("Expected ExceptionRaisingMockFetcher to " . "raise E_MOCK_FETCHER_EXCEPTION (_checkAuth)");
     }
 }
Exemple #3
0
 function test_error_exception()
 {
     $this->consumer->fetcher = new _ExceptionRaisingMockFetcher();
     $this->consumer->_makeKVPost(array('openid.mode' => 'associate'), "http://server_url");
     if (__getError() !== E_MOCK_FETCHER_EXCEPTION) {
         $this->fail("Expected ExceptionRaisingMockFetcher to " . "raise E_MOCK_FETCHER_EXCEPTION");
     }
     // exception fetching returns no association
     $this->assertEquals(@$this->consumer->_getAssociation('some://url'), null);
     $this->consumer->_checkAuth(array('openid.signed' => ''), 'some://url');
     if (__getError() !== E_MOCK_FETCHER_EXCEPTION) {
         $this->fail("Expected ExceptionRaisingMockFetcher to " . "raise E_MOCK_FETCHER_EXCEPTION (_checkAuth)");
     }
 }