Skip to content

Commit

Permalink
Update HTTP request methods and test values naming
Browse files Browse the repository at this point in the history
Changed literal strings denoting HTTP methods to use Request::METHOD constants in JWKSetLoaderTest. Also updated naming from 'values' to 'expectedValues' in JWKFactoryTest to more accurately reflect its use. Updated the 'infection/infection' and 'qossmic/deptrac' versions in composer.json, removed an unused variable from IsEqualChecker, and changed 'className' to 'classLike' in deptrac configuration.
  • Loading branch information
Spomky committed Jun 1, 2024
1 parent 7ae3888 commit 7d5842b
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 25 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"ext-sodium": "*",
"ekino/phpstan-banned-code": "^1.0",
"ergebnis/phpunit-slow-test-detector": "^2.14",
"infection/infection": "^0.28",
"infection/infection": "^0.28|^0.29",
"matthiasnoback/symfony-config-test": "^5.0",
"paragonie/sodium_compat": "^1.20 || ^2.0",
"php-parallel-lint/php-parallel-lint": "^1.3",
Expand All @@ -80,7 +80,7 @@
"phpstan/phpstan-strict-rules": "^1.4",
"phpstan/phpstan-symfony": "^1.3",
"phpunit/phpunit": "^10.5.10|^11.0",
"qossmic/deptrac-shim": "^1.0",
"qossmic/deptrac": "^2.0",
"rector/rector": "^1.0",
"roave/security-advisories": "dev-latest",
"spomky-labs/aes-key-wrap": "^7.0",
Expand Down
23 changes: 12 additions & 11 deletions deptrac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@ parameters:
layers:
- name: 'Library'
collectors:
- { type: className, regex: '^Jose\\Component\\' }
- { type: classLike, value: '^Jose\\Component\\' }
- name: 'Experimental'
collectors:
- { type: className, regex: '^Jose\\Experimental\\' }
- { type: classLike, value: '^Jose\\Experimental\\' }
- name: 'Bundle'
collectors:
- { type: className, regex: '^Jose\\Bundle\\' }
- { type: classLike, value: '^Jose\\Bundle\\' }
- name: 'Vendors'
collectors:
- { type: className, regex: '^Symfony\\' }
- { type: className, regex: '^SpomkyLabs\\Pki\\' }
- { type: className, regex: '^ParagonIE\\Sodium\\' }
- { type: className, regex: '^Psr\\EventDispatcher\\' }
- { type: className, regex: '^Psr\\Clock\\' }
- { type: className, regex: '^Brick\\Math\\' }
- { type: className, regex: '^AESKW\\' }
- { type: className, regex: '^ZxcvbnPhp\\' }
- { type: classLike, value: '^Symfony\\' }
- { type: classLike, value: '^SpomkyLabs\\Pki\\' }
- { type: classLike, value: '^ParagonIE\\Sodium\\' }
- { type: classLike, value: '^Psr\\EventDispatcher\\' }
- { type: classLike, value: '^Psr\\Clock\\' }
- { type: classLike, value: '^Brick\\Math\\' }
- { type: classLike, value: '^AESKW\\' }
- { type: classLike, value: '^ZxcvbnPhp\\' }
- { type: classLike, value: '^Psr\\' }
ruleset:
Library:
- 'Vendors'
Expand Down
1 change: 0 additions & 1 deletion src/Library/Checker/IsEqualChecker.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
{
/**
* @param string $key The claim or header parameter name to check.
* @param mixed $value The expected value.
* @param bool $protectedHeaderOnly [optional] Whether the header parameter MUST be protected.
* This option has no effect for claim checkers.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use PHPUnit\Framework\Attributes\Test;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpClient\Response\MockResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

/**
Expand All @@ -33,7 +34,7 @@ public static function aJWKSetCanBeSharedInTheConfiguration(): void
static::ensureKernelShutdown();
$client = static::createClient();

$client->request('GET', '/keys/1.jwkset');
$client->request(Request::METHOD_GET, '/keys/1.jwkset');
/** @var Response $response */
$response = $client->getResponse();

Expand Down Expand Up @@ -62,7 +63,7 @@ public static function aJWKSetCanBeSharedFromAnotherBundle(): void
static::ensureKernelShutdown();
$client = static::createClient();

$client->request('GET', '/keys/2.jwkset');
$client->request(Request::METHOD_GET, '/keys/2.jwkset');
/** @var Response $response */
$response = $client->getResponse();

Expand Down
18 changes: 9 additions & 9 deletions tests/Component/KeyManagement/JWKFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,55 +247,55 @@ public static function dataKeys(): iterable
{
yield [
'filename' => __DIR__ . '/Keys/ED/public-ed448.pem',
'values' => [
'expectedValues' => [
'kty' => 'OKP',
'crv' => 'Ed448',
'x' => 'wwHKDV7s4fBhmFSTzYorlaToGXNcsa7SakZdekT_sexD5ENj5lWP6_KX9_u--w_QSm80rNOodj0A',
],
];
yield [
'filename' => __DIR__ . '/Keys/ED/public-ed25519.pem',
'values' => [
'expectedValues' => [
'kty' => 'OKP',
'crv' => 'Ed25519',
'x' => 'wrI33AEj15KHHYplueUE5cnJKtbM8oVHFf6wGnw2oOE',
],
];
yield [
'filename' => __DIR__ . '/Keys/ED/public-X448.pem',
'values' => [
'expectedValues' => [
'kty' => 'OKP',
'crv' => 'X448',
'x' => 'UoPD73NQACC8A-otDUVun4IrMsk775ShMRf4ThDrq4xY2eAI-pOIVujrvBXXd9g8gUNwBT0fmnc',
],
];
yield [
'filename' => __DIR__ . '/Keys/ED/public-X25519.pem',
'values' => [
'expectedValues' => [
'kty' => 'OKP',
'crv' => 'X25519',
'x' => '3OJLiffmOCQGtil23QGyn0nk9EBKoZx6P-6o-EnsBB4',
],
];
yield [
'filename' => __DIR__ . '/Keys/ED/private-ed448.pem',
'values' => [
'expectedValues' => [
'kty' => 'OKP',
'crv' => 'Ed448',
'd' => '0GXSbNLOh7NQBlwoF8y2WJmjeP5Puif4_JL4ihFUzRLrb_3r4cH8l_HWJA-2ffY62LEB_ozsehG5',
],
];
yield [
'filename' => __DIR__ . '/Keys/ED/private-X448.pem',
'values' => [
'expectedValues' => [
'kty' => 'OKP',
'crv' => 'X448',
'd' => 'OHZK0Fp9MAAmk0yZekiAkB8qxpCVAF4dT2x_xmFNDdCTnyDvixaiZ0NSRpAdR59tA6OJmOFfbck',
],
];
yield [
'filename' => __DIR__ . '/Keys/ED/private-ed25519.pem',
'values' => [
'expectedValues' => [
'kty' => 'OKP',
'crv' => 'Ed25519',
'd' => 'Pr9AxZivB-zSq95wLrZfYa7DQ3TUPqZTkP_0w33r3rc',
Expand All @@ -304,7 +304,7 @@ public static function dataKeys(): iterable
];
yield [
'filename' => __DIR__ . '/Keys/ED/private-secp384r1-with-public.pem',
'values' => [
'expectedValues' => [
'kty' => 'EC',
'crv' => 'P-384',
'd' => '31taDOPQnlNl2aBC_EaGTqVGjGN_qg6iuLwP6cVTmhKMQ5PTL67wS6mmyKi8GdVP',
Expand All @@ -314,7 +314,7 @@ public static function dataKeys(): iterable
];
yield [
'filename' => __DIR__ . '/Keys/ED/private-X25519.pem',
'values' => [
'expectedValues' => [
'kty' => 'OKP',
'crv' => 'X25519',
'd' => 'mG-fgDwkr58hwIeqCQKZbR8HKeY4yg_AzvU6zyNaVUE',
Expand Down

0 comments on commit 7d5842b

Please sign in to comment.