From c595e2bd231c7aedb7c27d15713a213feafda073 Mon Sep 17 00:00:00 2001 From: Aztech Date: Tue, 19 May 2015 12:46:52 +0200 Subject: Add tests for \ArrayAccess key chooser --- tests/JWTTest.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/JWTTest.php b/tests/JWTTest.php index da9975c..b1fc1eb 100644 --- a/tests/JWTTest.php +++ b/tests/JWTTest.php @@ -194,6 +194,14 @@ class JWTTest extends PHPUnit_Framework_TestCase $this->assertEquals($decoded, 'abc'); } + public function testArrayAccessKIDChooser() + { + $keys = new ArrayObject(array('1' => 'my_key', '2' => 'my_key2')); + $msg = JWT::encode('abc', $keys['1'], 'HS256', '1'); + $decoded = JWT::decode($msg, $keys, array('HS256')); + $this->assertEquals($decoded, 'abc'); + } + public function testNoneAlgorithm() { $msg = JWT::encode('abc', 'my_key'); -- cgit v1.1