/** * Gets the local instance of OpenID_Store_CacheLite * * @return OpenID_Store_CacheLite */ protected function getOpenIDStore() { if ($this->openid === null) { $this->openid = new OpenID_Store_CacheLite(); OpenID::setStore($this->openid); } return $this->openid; }
/** * setUp * * @return void */ public function setUp() { $this->rp = $this->getMock('OpenID_RelyingParty', array('getAssociationRequestObject', 'getAssertionObject'), array($this->returnTo, $this->realm, $this->id)); $this->store = $this->getMock('OpenID_Store_Mock', array('getDiscover', 'getAssociation', 'getNonce')); OpenID::setStore($this->store); $this->discover = $this->getMock('OpenID_Discover', array('__get'), array($this->id)); $opEndpoint = new OpenID_ServiceEndpoint(); $opEndpoint->setURIs(array($this->opEndpointURL)); $opEndpoint->setVersion(OpenID::SERVICE_2_0_SERVER); $opEndpoints = new OpenID_ServiceEndpoints($this->id, $opEndpoint); $this->discover->expects($this->any())->method('__get')->will($this->returnValue($opEndpoints)); $params = array('uri' => 'http://example.com', 'expiresIn' => 600, 'created' => 1240980848, 'assocType' => 'HMAC-SHA256', 'assocHandle' => 'foobar{}', 'sharedSecret' => '12345qwerty'); $this->association = $this->getMock('OpenID_Association', array('checkMessageSignature'), array($params)); }
/** * testSetAndGetStore * * @return void */ public function testSetAndGetStore() { $this->assertInstanceOf('OpenID_Store_CacheLite', OpenID::getStore()); OpenID::setStore(OpenID_Store::factory('Mock')); $this->assertInstanceOf('OpenID_Store_Mock', OpenID::getStore()); }
/** * testVerifyResponseNonceFail * * @return void */ public function testVerifyResponseNonceFail() { $store = $this->getMock('OpenID_Store_Mock', array('getNonce')); OpenID::setStore($store); $this->nonce = new OpenID_Nonce($this->opURL, $this->skew, $store); $store->expects($this->once())->method('getNonce')->will($this->returnValue(true)); $nonce = gmstrftime('%Y-%m-%dT%H:%M:%SZ', time()) . '12345abcde'; $this->assertFalse($this->nonce->verifyResponseNonce($nonce)); }
/** * testValidateDiscoverFail * * @expectedException OpenID_Assertion_Exception * @return void */ public function testValidateDiscoverFail() { OpenID::setStore($this->store); $this->assertion = $this->getMock('OpenID_Assertion', array('getHTTPRequest2Instance', 'getDiscover'), array($this->message, new Net_URL2($this->requestedURL), $this->clockSkew)); }