summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAztech <thibaud@aztech.io>2015-05-19 12:46:52 +0200
committerAztech <thibaud@aztech.io>2015-05-19 12:46:52 +0200
commitc595e2bd231c7aedb7c27d15713a213feafda073 (patch)
treecd895d5b86080015c9dbee00ae20dc86098e04da
parentd089a3a9255425d3cc3fbc13ed29a31ae997c2f5 (diff)
downloadphp-jwt-c595e2bd231c7aedb7c27d15713a213feafda073.zip
php-jwt-c595e2bd231c7aedb7c27d15713a213feafda073.tar.gz
php-jwt-c595e2bd231c7aedb7c27d15713a213feafda073.tar.bz2
Add tests for \ArrayAccess key chooser
-rw-r--r--tests/JWTTest.php8
1 files changed, 8 insertions, 0 deletions
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');