Happyr\LinkedIn\LinkedInTest::testAccessTokenAccessors PHP Method

testAccessTokenAccessors() public method

Test a call to getAccessToken when there is no token.
    public function testAccessTokenAccessors()
    {
        $token = 'token';
        $auth = $this->getMock('Happyr\\LinkedIn\\Authenticator', ['fetchNewAccessToken'], [], '', false);
        $auth->expects($this->once())->method('fetchNewAccessToken')->will($this->returnValue($token));
        $linkedIn = $this->getMock('Happyr\\LinkedIn\\LinkedIn', ['getAuthenticator'], [], '', false);
        $linkedIn->expects($this->once())->method('getAuthenticator')->willReturn($auth);
        // Make sure we go to the authenticator only once
        $this->assertEquals($token, $linkedIn->getAccessToken());
        $this->assertEquals($token, $linkedIn->getAccessToken());
    }