public function testEstablishCSRFTokenState()
{
$method = new \ReflectionMethod('Happyr\\LinkedIn\\Authenticator', 'establishCSRFTokenState');
$method->setAccessible(true);
$storage = m::mock('Happyr\\LinkedIn\\Storage\\DataStorageInterface')->shouldReceive('get')->with('state')->andReturn(null, 'state')->shouldReceive('set')->once()->with('state', \Mockery::on(function (&$param) {
return !empty($param);
}))->getMock();
$auth = $this->getMock('Happyr\\LinkedIn\\Authenticator', ['getStorage'], [], '', false);
$auth->expects($this->any())->method('getStorage')->will($this->returnValue($storage));
// Make sure we only set the state once
$method->invoke($auth);
$method->invoke($auth);
}