Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.0.0 beta #60

Merged
merged 44 commits into from
Jan 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
392e1c9
Fixed namespacing by adding Unit in test files in tests/Unit directory.
RobDWaller Dec 11, 2020
4e09aa8
Fixed return type issues in ParseTest file.
RobDWaller Dec 11, 2020
963ecf0
Fixed return type and mock / stub issues in BuildTest file.
RobDWaller Dec 11, 2020
9381e27
Renamed EndToEnd integration tests file to BuildParse as this is more…
RobDWaller Dec 11, 2020
ffd5a78
Tidied up namespacing in BuildParse integrations tests.
RobDWaller Dec 28, 2020
0f6838a
Got most of the BuildParse integration tests working.
RobDWaller Dec 28, 2020
665383d
Removed commented code from BuildParse integration tests.
RobDWaller Dec 30, 2020
8ce5236
Used commented code from BuildParse integration tests to create worki…
RobDWaller Dec 30, 2020
39ceede
Applied PSR 12 lint code fixes to new integration tests.
RobDWaller Dec 30, 2020
3e618a3
Tidied up types and doc types in Validate class.
RobDWaller Dec 30, 2020
e99c99e
Fixed types and type docs in Build class.
RobDWaller Dec 30, 2020
e64a9f9
Amend to wrong doc type in Build class comments.
RobDWaller Dec 30, 2020
da738c7
Updated the Build reset method to return a fresh instance of the Buil…
RobDWaller Dec 30, 2020
a4ff322
Fixed doc type issues in Token and Tokens class.
RobDWaller Dec 30, 2020
a6a0a22
Applied type and doc type fixes to Encoders and Decoders.
RobDWaller Dec 30, 2020
266d36d
Added types and doc types to Signature interface.
RobDWaller Dec 30, 2020
d736804
Added types and doc types to Parse class.
RobDWaller Dec 30, 2020
b20a4d5
Bumped PHPStan strictness level to 8.
RobDWaller Dec 30, 2020
f8d380a
Applied PSR-12 lint fixes after types and doctype fixes.
RobDWaller Dec 30, 2020
5e76028
Added php md doc annotation to suppress specific short variable on cr…
RobDWaller Dec 30, 2020
43e568c
Defined seperate unit and integration test suites in PHP Unit config …
RobDWaller Dec 31, 2020
df2fc17
Fixed Benchmark tests so they work and applied PHPStan checks to benc…
RobDWaller Dec 31, 2020
bfa56ca
Updated Infection PHP mutation tests to only run against unit test su…
RobDWaller Dec 31, 2020
1a13f59
Fixed code coverage issues in Build class.
RobDWaller Dec 31, 2020
cd2ac64
Fixed PSR-12 code lint issues in BuildTests file.
RobDWaller Dec 31, 2020
24299d1
Tidied up and added further mocking to ParsedTest class.
RobDWaller Dec 31, 2020
d376df1
Removed Errors trait as no longer needed due to improvements in valid…
RobDWaller Dec 31, 2020
177df36
Moved JsonEncoder Test into Helper directory to reflect src directory…
RobDWaller Dec 31, 2020
10272b8
Dropped Mutation Score Index check to 93 as this is about as high as …
RobDWaller Dec 31, 2020
02acf58
Bumped PHPUnit version to 9.5 in composer config.
RobDWaller Dec 31, 2020
7461115
Bumped PHPMD and Infection versions in composer config.
RobDWaller Dec 31, 2020
8b000ba
Bumped CI Workflow to run on Ubuntu 20.04.
RobDWaller Dec 31, 2020
739cad5
Set fail fast to false and implemented ox matrix in GitHub actions ci…
RobDWaller Jan 1, 2021
69814cd
Created seperate composer installation steps for PHP 7.4 vs 8.0 in Gi…
RobDWaller Jan 1, 2021
e77400c
Added ubuntu-18.04 to github actions os matrix.
RobDWaller Jan 1, 2021
065c620
Further types and doc types tidy up.
RobDWaller Jan 2, 2021
b367c27
Applied PSR-12 lint fixes after types and type doc edits.
RobDWaller Jan 2, 2021
63e5d48
Applied styleci lint fixes to tokens fixtures and signature test class.
RobDWaller Jan 2, 2021
a17d9b6
Applied some duplication fixes and fixed poorly implemented tests in …
RobDWaller Jan 2, 2021
2814a48
Further tidy up to remove duplication and improve implementation for …
RobDWaller Jan 3, 2021
c971203
Amended execution flow to remove furhter duplication in BuildParse In…
RobDWaller Jan 3, 2021
eaf40bd
Removed pointless duplicate assignment from build parse integration t…
RobDWaller Jan 3, 2021
90350ed
Jumbled assertion execution to improve duplication in BuildParse inte…
RobDWaller Jan 3, 2021
dd32f58
Fixed some code duplication and unused variable issues in the BuildVa…
Jan 6, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ on: [push, pull_request, release]

jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
php-versions: ['7.4', '8.0']
os: [ubuntu-18.04, ubuntu-20.04]
name: PHP ${{ matrix.php-versions }} Test
steps:
- name: Checkout
Expand All @@ -23,9 +25,14 @@ jobs:
- name: Validate Composer
run: composer validate --strict

- name: Install Composer Dependencies
- name: Install Composer Dependencies PHP 7.4
if: ${{ matrix.php-versions == '7.4' }}
run: composer install --no-interaction --prefer-dist

- name: Install Composer Dependencies PHP 8.0
if: ${{ matrix.php-versions == '8.0' }}
run: composer install --no-interaction --prefer-dist --ignore-platform-reqs

- name: Run Tests
run: composer run-script pipeline
env:
Expand Down
43 changes: 22 additions & 21 deletions benchmarks/ReallySimpleJWTBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,26 @@
use ReallySimpleJWT\Build;
use ReallySimpleJWT\Validate;
use ReallySimpleJWT\Secret;
use ReallySimpleJWT\Encode;
use ReallySimpleJWT\Parse;
use ReallySimpleJWT\Jwt;
use ReallySimpleJWT\Encoders\EncodeHs256;
use ReallySimpleJWT\Decoders\DecodeHs256;
use ReallySimpleJWT\Helper\Validator;

class ReallySimpleJWTBench
{
/**
* @Revs(2500)
* @Iterations(20)
*/
public function benchCreateToken()
public function benchCreateToken(): void
{
$build = new Build('JWT', new Validate(), new Secret(), new Encode());
$build = new Build(
'JWT',
new Validator(),
new Secret(),
new EncodeHs256()
);

$expiration = time() + 10;
$notBefore = time() - 10;
Expand All @@ -41,28 +48,29 @@ public function benchCreateToken()
* @Revs(2500)
* @Iterations(20)
*/
public function benchParseToken()
public function benchParseToken(): void
{
$token = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.' .
'eyJhdWQiOiJodHRwczovL2dvb2dsZS5jb20iLCJuYW1lIjoiQ2hyaXMiLCJpYXQiOjE1MTYyMzkwMjJ9.' .
'dA-VMA__ZkvaLjSui-dOgNi23KLU52Y--_dutVvohio';

$parse = new Parse(
new Jwt($token, '123$car*PARK456'),
new Validate(),
new Encode()
);
$parse = new Parse(new Jwt($token, '123$car*PARK456'), new DecodeHs256());

$parse->validate()->parse();
$parse->parse();
}

/**
* @Revs(1250)
* @Iterations(10)
*/
public function benchBuildAndParse()
public function benchBuildAndParse(): void
{
$build = new Build('JWT', new Validate(), new Secret(), new Encode());
$build = new Build(
'JWT',
new Validator(),
new Secret(),
new EncodeHs256()
);

$expiration = time() + 10;
$notBefore = time() - 10;
Expand All @@ -81,15 +89,8 @@ public function benchBuildAndParse()
->setPayloadClaim('uid', 2)
->build();

$parse = new Parse(
$token,
new Validate(),
new Encode()
);
$parse = new Parse($token, new DecodeHs256());

$parse->validate()
->validateExpiration()
->validateNotBefore()
->parse();
$parse->parse();
}
}
13 changes: 7 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
"php": ">=7.4.0"
},
"require-dev": {
"phpunit/phpunit": "9.2.*",
"phpunit/phpunit": "^9.5",
"phpstan/phpstan": "^0.12",
"phpmd/phpmd": "^2.8",
"phpmd/phpmd": "^2.9",
"squizlabs/php_codesniffer": "^3.5",
"infection/infection": "^0.16",
"infection/infection": "^0.20",
"phploc/phploc": "^7.0",
"sebastian/phpcpd": "^6.0",
"phpbench/phpbench": "^0.17"
Expand All @@ -37,10 +37,11 @@
"scripts" : {
"pipeline": [
"vendor/bin/phpcs --standard=psr12 src/ tests/ benchmarks/",
"vendor/bin/phpstan analyse -l 7 src/ tests/",
"vendor/bin/phpstan analyse -l 8 src/ tests/ benchmarks/",
"vendor/bin/phpmd src/ text ruleset.xml",
"vendor/bin/phpunit --coverage-clover=coverage.xml",
"vendor/bin/infection -s --min-msi=95 --threads=2",
"vendor/bin/phpunit --testsuite unit --coverage-clover=coverage.xml",
"vendor/bin/phpunit --testsuite integration",
"vendor/bin/infection --test-framework-options='--testsuite unit' -s --min-msi=93 --threads=2",
"vendor/bin/phpcpd --min-lines=2 --min-tokens=35 src/",
"vendor/bin/phpbench run benchmarks/ReallySimpleJWTBench.php --report=aggregate",
"vendor/bin/phploc src/"
Expand Down
7 changes: 5 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@
failOnRisky="true"
failOnWarning="true">
<testsuites>
<testsuite name="Really Simple JWT Test Suite">
<directory suffix=".php">./tests/</directory>
<testsuite name="unit">
<directory suffix=".php">./tests/Unit/</directory>
</testsuite>
<testsuite name="integration">
<directory suffix=".php">./tests/Integration/</directory>
</testsuite>
</testsuites>
<filter>
Expand Down
Loading