From 6959beb98747ac86629ba291c08d0751bbff01fc Mon Sep 17 00:00:00 2001 From: Lucas Michot Date: Wed, 30 Aug 2017 19:56:55 +0200 Subject: [PATCH] Improve code coverage. (#1292) --- tests/Providers/JWT/NamshiTest.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/Providers/JWT/NamshiTest.php b/tests/Providers/JWT/NamshiTest.php index 1652b9174..a1e87f0f1 100644 --- a/tests/Providers/JWT/NamshiTest.php +++ b/tests/Providers/JWT/NamshiTest.php @@ -179,6 +179,34 @@ public function it_should_throw_a_exception_when_the_algorithm_passed_is_invalid $this->getProvider('secret', 'AlgorithmWrong')->decode('foo.bar.baz'); } + /** + * @test + */ + public function it_should_return_the_public_key() + { + $provider = $this->getProvider( + 'does_not_matter', + 'RS256', + $keys = ['private' => $this->getDummyPrivateKey(), 'public' => $this->getDummyPublicKey()] + ); + + $this->assertSame($keys['public'], $provider->getPublicKey()); + } + + /** + * @test + */ + public function it_should_return_the_keys() + { + $provider = $this->getProvider( + 'does_not_matter', + 'RS256', + $keys = ['private' => $this->getDummyPrivateKey(), 'public' => $this->getDummyPublicKey()] + ); + + $this->assertSame($keys, $provider->getKeys()); + } + public function getProvider($secret, $algo, array $keys = []) { return new Namshi($secret, $algo, $keys, $this->jws);