diff --git a/src/JWK.php b/src/JWK.php index 1d273917..7632f4a4 100644 --- a/src/JWK.php +++ b/src/JWK.php @@ -3,6 +3,7 @@ namespace Firebase\JWT; use DomainException; +use InvalidArgumentException; use UnexpectedValueException; /** diff --git a/tests/JWKTest.php b/tests/JWKTest.php index 3d317d55..b8b67540 100644 --- a/tests/JWKTest.php +++ b/tests/JWKTest.php @@ -43,6 +43,20 @@ public function testParseJwkKeySet() self::$keys = $keys; } + public function testParseJwkKey_empty() + { + $this->setExpectedException('InvalidArgumentException', 'JWK must not be empty'); + + JWK::parseKeySet(array('keys' => array(array()))); + } + + public function testParseJwkKeySet_empty() + { + $this->setExpectedException('InvalidArgumentException', 'JWK Set did not contain any keys'); + + JWK::parseKeySet(array('keys' => array())); + } + /** * @depends testParseJwkKeySet */