Happyr\LinkedIn\AuthenticatorTest::testGetCode PHP Method

testGetCode() public method

public testGetCode ( )
    public function testGetCode()
    {
        $method = new \ReflectionMethod('Happyr\\LinkedIn\\Authenticator', 'getCode');
        $method->setAccessible(true);
        $state = 'bazbar';
        $storage = m::mock('Happyr\\LinkedIn\\Storage\\DataStorageInterface')->shouldReceive('clear')->once()->with('state')->shouldReceive('get')->once()->with('code')->andReturn(null)->shouldReceive('get')->once()->with('state')->andReturn($state)->getMock();
        $auth = $this->getMock('Happyr\\LinkedIn\\Authenticator', ['getStorage'], [], '', false);
        $auth->expects($this->once())->method('getStorage')->will($this->returnValue($storage));
        $_REQUEST['code'] = 'foobar';
        $_REQUEST['state'] = $state;
        $this->assertEquals('foobar', $method->invoke($auth));
    }