whichEncoding() public method

Returns one of Auth_OpenID_ENCODE_URL, Auth_OpenID_ENCODE_KVFORM, or null, depending on the type of encoding expected for this error's payload.
public whichEncoding ( )
 function test_noMessage()
 {
     $e = new Auth_OpenID_ServerError();
     $this->assertFalse($e->hasReturnTo());
     $this->assertEquals($e->whichEncoding(), null);
     $this->assertEquals($e->getReturnTo(), null);
 }
Example #2
0
 function test_browserWithReturnTo_OpenID1_exceeds_limit()
 {
     $return_to = "http://rp.unittest/consumer" . str_repeat('x', Auth_OpenID_OPENID1_URL_LIMIT);
     // will be a ProtocolError raised by Decode or
     // CheckIDRequest.answer
     $args = Auth_OpenID_Message::fromPostArgs(array('openid.mode' => 'monkeydance', 'openid.identity' => 'http://wagu.unittest/', 'openid.return_to' => $return_to));
     $this->assertTrue($args->isOpenID1());
     $e = new Auth_OpenID_ServerError($args, "plucky");
     $this->assertTrue($e->hasReturnTo());
     $expected_args = array('openid.mode' => 'error', 'openid.error' => 'plucky');
     $this->assertTrue($e->whichEncoding() == Auth_OpenID_ENCODE_URL);
     list($rt_base, $result_args_s) = explode('?', $e->encodeToURL(), 2);
     $result_args = Auth_OpenID::parse_str($result_args_s);
     $this->assertEquals($result_args, $expected_args);
 }