summaryrefslogtreecommitdiffstats
path: root/tests/JWTTest.php
diff options
context:
space:
mode:
authorChris Raynor <chris@firebase.com>2015-05-20 10:52:42 -0700
committerChris Raynor <chris@firebase.com>2015-05-20 10:52:42 -0700
commit08a5a47bf3987d82b4d88f4cc53e6a07e17678d6 (patch)
tree3913b5d0e1ac319adeef28bb44bb7e2bf777978c /tests/JWTTest.php
parent7a15d3cbabb5903192f81487634239ecfc1af309 (diff)
parentee031fb7588bf350e88d550ebe85054a0e3cb8bb (diff)
downloadphp-jwt-08a5a47bf3987d82b4d88f4cc53e6a07e17678d6.zip
php-jwt-08a5a47bf3987d82b4d88f4cc53e6a07e17678d6.tar.gz
php-jwt-08a5a47bf3987d82b4d88f4cc53e6a07e17678d6.tar.bz2
Merge pull request #47 from firebase/rd-improve-test-isolation
Reset clock skew / leeway after relevant tests & update README
Diffstat (limited to 'tests/JWTTest.php')
-rw-r--r--tests/JWTTest.php6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/JWTTest.php b/tests/JWTTest.php
index b1fc1eb..0605e4c 100644
--- a/tests/JWTTest.php
+++ b/tests/JWTTest.php
@@ -84,6 +84,7 @@ class JWTTest extends PHPUnit_Framework_TestCase
$encoded = JWT::encode($payload, 'my_key');
$decoded = JWT::decode($encoded, 'my_key', array('HS256'));
$this->assertEquals($decoded->message, 'abc');
+ JWT::$leeway = 0;
}
public function testExpiredTokenWithLeeway()
@@ -96,6 +97,7 @@ class JWTTest extends PHPUnit_Framework_TestCase
$encoded = JWT::encode($payload, 'my_key');
$decoded = JWT::decode($encoded, 'my_key', array('HS256'));
$this->assertEquals($decoded->message, 'abc');
+ JWT::$leeway = 0;
}
public function testValidTokenWithList()
@@ -129,6 +131,7 @@ class JWTTest extends PHPUnit_Framework_TestCase
$encoded = JWT::encode($payload, 'my_key');
$decoded = JWT::decode($encoded, 'my_key', array('HS256'));
$this->assertEquals($decoded->message, 'abc');
+ JWT::$leeway = 0;
}
public function testInvalidTokenWithNbfLeeway()
@@ -140,6 +143,7 @@ class JWTTest extends PHPUnit_Framework_TestCase
$encoded = JWT::encode($payload, 'my_key');
$this->setExpectedException('BeforeValidException');
$decoded = JWT::decode($encoded, 'my_key', array('HS256'));
+ JWT::$leeway = 0;
}
public function testValidTokenWithIatLeeway()
@@ -151,6 +155,7 @@ class JWTTest extends PHPUnit_Framework_TestCase
$encoded = JWT::encode($payload, 'my_key');
$decoded = JWT::decode($encoded, 'my_key', array('HS256'));
$this->assertEquals($decoded->message, 'abc');
+ JWT::$leeway = 0;
}
public function testInvalidTokenWithIatLeeway()
@@ -162,6 +167,7 @@ class JWTTest extends PHPUnit_Framework_TestCase
$encoded = JWT::encode($payload, 'my_key');
$this->setExpectedException('BeforeValidException');
$decoded = JWT::decode($encoded, 'my_key', array('HS256'));
+ JWT::$leeway = 0;
}
public function testInvalidToken()