diff options
-rw-r--r-- | src/JWT.php | 1 | ||||
-rw-r--r-- | tests/JWTTest.php | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/JWT.php b/src/JWT.php index 855b742..d1a108f 100644 --- a/src/JWT.php +++ b/src/JWT.php @@ -2,6 +2,7 @@ namespace Firebase\JWT; use \DomainException; +use \UnexpectedValueException; use \DateTime; /** diff --git a/tests/JWTTest.php b/tests/JWTTest.php index 6c996b2..f06f34e 100644 --- a/tests/JWTTest.php +++ b/tests/JWTTest.php @@ -235,4 +235,10 @@ class JWTTest extends PHPUnit_Framework_TestCase $msg = JWT::encode('abc', 'my_key', 'HS256', null, array('cty' => 'test-eit;v=1')); $this->assertEquals(JWT::decode($msg, 'my_key', array('HS256')), 'abc'); } + + public function testInvalidSegmentCount() + { + $this->setExpectedException('UnexpectedValueException'); + JWT::decode('brokenheader.brokenbody', 'my_key', array('HS256')); + } } |