예제 #1
0
 protected function setUp() {
     $this->injector = $this->getMockBuilder('OAuth_io\Injector')->getMock();
     OAuth_io\Injector::setInstance($this->injector);
     $this->request_mock = $this->getMockBuilder('OAuth_io\HttpWrapper')->setMethods(array())->getMock();
     $this->injector->expects($this->any())->method('getRequest')->will($this->returnValue($this->request_mock));
     
     $this->injector->session = array();
     $this->oauth = new OAuth();
     
     $this->oauth->initialize('somekey', 'somesecret');
     $this->token = $this->oauth->generateStateToken();
     
     $response = (object)array(
         'body' => (object)array(
             'access_token' => 'someaccesstoken',
             'state' => $this->token,
             'provider' => 'someprovider'
         )
     );
     
     $this->request_mock->expects($this->at(0))->method('make_request')->will($this->returnValue($response));
     $this->request_object = $this->oauth->auth('someprovider', array(
         'code' => 'somecode'
     ));
 }
예제 #2
0
    protected function setUp() {
        $this->injector = $this->getMockBuilder('OAuth_io\Injector')->getMock();
        OAuth_io\Injector::setInstance($this->injector);
        $this->request_mock = $this->getMockBuilder('OAuth_io\HttpWrapper')->getMock();

        $this->injector->expects($this->any())->method('getRequest')->will($this->returnValue($this->request_mock));
        
        $this->injector->session = array(
            'hello' => 'world'
        );
        $this->oauth = new OAuth();
        $this->oauth->initialize('somekey', 'somesecret');
        $this->token = $this->oauth->generateStateToken();
    }