Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: fix getPublicKeys test
Browse files Browse the repository at this point in the history
gsomoza committed Apr 1, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 63d6094 commit ff08f09
Showing 3 changed files with 8,789 additions and 5 deletions.
35 changes: 35 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "plus54/m2-cloudflare-access",
"description": "Authorize CloudFlare Access requests",
"type": "magento2-module",
"license": "proprietary",
"authors": [
{
"name": "Mage2Gen",
"email": "[email protected]"
}
],
"minimum-stability": "dev",
"require": {
"firebase/php-jwt": "dev-master",
"magento/framework": "^103.0.2"
},
"autoload": {
"files": [
"src/registration.php"
],
"psr-4": {
"Plus54\\CloudFlareAccess\\": "./src",
"Plus54\\CloudFlareAccessTests\\": "./tests"
}
},
"require-dev": {
"magento/magento2-functional-testing-framework": "^3.3.0"
},
"repositories": [
{
"type": "composer",
"url": "https://repo.magento.com/"
}
]
}
8,747 changes: 8,747 additions & 0 deletions composer.lock

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions tests/TokenValidatorTest.php
Original file line number Diff line number Diff line change
@@ -23,12 +23,14 @@ public function testGetPublicKeys(): void
{
$url = 'http://example.com';
$this->curlClient->expects($this->once())->method('get')->with($url);
$this->curlClient->expects($this->once())->method('getBody');
$this->json->expects($this->once())->method('unserialize')->with($this->isType('string'));
$this->curlClient->expects($this->once())->method('getBody')->willReturn('{"foo": "bar"}');
$this->json->expects($this->once())->method('unserialize')
->with('{"foo": "bar"}')
->willReturn(['foo' => 'bar'])
;
$tokenValidator = new TokenValidator($this->json, $this->curlClient);

$res = $tokenValidator->getPublicKeys($url);
$this->assertArrayHasKey('kid', $res);
//$this->assertSame(expected: )
$this->assertIsArray($res);
$this->assertArrayHasKey('foo', $res);
}
}

0 comments on commit ff08f09

Please sign in to comment.