public function testExpiresInWithExpiresAt()
 {
     $token = new AuthCode();
     $token->setExpiresAt(time() + 60);
     $this->assertEquals(60, $token->getExpiresIn());
 }
 protected function createAuthCode($token, $expiresAt = false)
 {
     $authCode = new AuthCode();
     $authCode->setClientId(1);
     $authCode->setToken($token);
     $authCode->setRedirectUri('foo');
     if ($expiresAt) {
         $authCode->setExpiresAt($expiresAt);
     }
     $authCode->save();
     return $authCode;
 }