summaryrefslogtreecommitdiffstats
path: root/tests/JWTTest.php
diff options
context:
space:
mode:
authordrtriumph <chris@firebase.com>2015-04-01 11:07:46 -0700
committerdrtriumph <chris@firebase.com>2015-04-01 11:07:46 -0700
commitc612b998eb6d6177c6678e7ba93fcb646bef7891 (patch)
treed829cef6a092f312641e53e61ddd7ea113b8ef9c /tests/JWTTest.php
parentb2c2be6a45fda769c8c2ffe5ec4259a9d1e46e5b (diff)
downloadphp-jwt-c612b998eb6d6177c6678e7ba93fcb646bef7891.zip
php-jwt-c612b998eb6d6177c6678e7ba93fcb646bef7891.tar.gz
php-jwt-c612b998eb6d6177c6678e7ba93fcb646bef7891.tar.bz2
A few additional tests for none algorithm and an incorrect algorithm
Diffstat (limited to 'tests/JWTTest.php')
-rw-r--r--tests/JWTTest.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/JWTTest.php b/tests/JWTTest.php
index 1ace7f5..cc2eb8c 100644
--- a/tests/JWTTest.php
+++ b/tests/JWTTest.php
@@ -116,4 +116,18 @@ class JWTTest extends PHPUnit_Framework_TestCase
$decoded = JWT::decode($msg, $keys, array('HS256'));
$this->assertEquals($decoded, 'abc');
}
+
+ public function testNoneToken()
+ {
+ $msg = JWT::encode('abc', 'my_key');
+ $this->setExpectedException('DomainException');
+ JWT::decode($msg, 'my_key', array('none'));
+ }
+
+ public function testIncorrectAlgorithm()
+ {
+ $msg = JWT::encode('abc', 'my_key');
+ $this->setExpectedException('DomainException');
+ JWT::decode($msg, 'my_key', array('RS256'));
+ }
}