예제 #1
0
 public function testInheritRequestParams()
 {
     $requestParams = array('param1' => 'requestValue1');
     $request = new \Zend\Http\PhpEnvironment\Request();
     $request->setQuery(new \Zend\Stdlib\Parameters($requestParams));
     $helper = new \Console\View\Helper\ConsoleUrl($request, $this->_getHelper('Url'));
     $params = array();
     $this->assertEquals('/console/controller/action/?param1=requestValue1', $helper('controller', 'action', $params, true));
     $params['param2'] = 'value2';
     $this->assertEquals('/console/controller/action/?param1=requestValue1&param2=value2', $helper('controller', 'action', $params, true));
     $params['param1'] = 'value1';
     $this->assertEquals('/console/controller/action/?param1=value1&param2=value2', $helper('controller', 'action', $params, true));
 }
 public function testGetTokenMocked()
 {
     $this->client->getUrl();
     $httpClientMock = $this->getMock('\\ReverseOAuth2\\OAuth2HttpClient', array('send'), array(null, array('timeout' => 30, 'adapter' => '\\Zend\\Http\\Client\\Adapter\\Curl')));
     $httpClientMock->expects($this->exactly(1))->method('send')->will($this->returnCallback(array($this, 'getMockedTokenResponse')));
     $this->client->setHttpClient($httpClientMock);
     $request = new \Zend\Http\PhpEnvironment\Request();
     $request->setQuery(new \Zend\Stdlib\Parameters(array('code' => 'some code', 'state' => $this->client->getState())));
     $this->assertTrue($this->client->getToken($request));
     $this->client->getToken($request);
     $this->assertTrue($this->client->getToken($request));
     // from session
     $this->assertTrue(strlen($this->client->getSessionToken()->access_token) > 0);
 }