/**
  * Tests authentication failure due to a malformed GID inside the cookie.
  *
  * @covers empire\framework\login\SecurePersistentLoginMethod::authenticate
  */
 public function testAuthenticateCookieGidFail()
 {
     $gid = '58d93d649ffffffff5331ad0219ea200';
     $storage = new JsonLoginStorage(__DIR__ . DIRECTORY_SEPARATOR . 'login.json', new Md5HashFunction(), 100, 'mykey');
     $malformedCookie = new Cookie('login');
     $malformedCookie->setData(array('gid' => 'not a valid gid', 'token' => 'not a valid token'));
     $transceiver = new SecureCookieTransceiver(self::$cryptoFactory->getHashFunction('Sha256'), self::$cryptoFactory->getHashFunction('Sha256'), self::$cryptoFactory->getSymmetricCypher('Aes256'), 'secret key', new GID(), 'session id', $gid);
     $method = new SecurePersistentLoginMethod($storage, $transceiver);
     $method->setCookieName('login');
     $this->remoteCall('login', $method, $gid);
     $this->remoteCall('sendCookie', null, array($transceiver, $malformedCookie));
     $this->assertNull($this->remoteCall('authenticate', $method));
 }