From 4c488ffae3f42294dc246657c7c119e305ca2601 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=CC=88nther=20Debrauwer?= Date: Tue, 12 Mar 2024 12:54:27 +0100 Subject: [PATCH 1/3] Add support for Laravel v11 --- .github/workflows/run-tests.yml | 7 +++++-- composer.json | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 86b1daa..7102346 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -11,8 +11,11 @@ jobs: fail-fast: false matrix: php: [8.1, 8.2, 8.3] - laravel: [10.*] + laravel: [10.*, 11.*] dependency-version: [prefer-lowest, prefer-stable] + exclude: + - php: 8.1 + laravel: 11.* name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.dependency-version }} @@ -44,7 +47,7 @@ jobs: - name: Install dependencies run: | - composer require "illuminate/database:${{ matrix.laravel }}" "illuminate/notifications:${{ matrix.laravel }}" "illuminate/support:${{ matrix.laravel }}" --no-interaction --no-update + composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest - name: Execute tests diff --git a/composer.json b/composer.json index 5459871..1ae21e8 100644 --- a/composer.json +++ b/composer.json @@ -29,14 +29,14 @@ ], "require": { "php": "^8.1|^8.2|^8.3", - "illuminate/database": "^7.0|^8.0|^9.0|^10.0", - "illuminate/notifications": "^7.0|^8.0|^9.0|^10.0", - "illuminate/support": "^7.0|^8.0|^9.0|^10.0" + "illuminate/database": "^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/notifications": "^7.0|^8.0|^9.0|^10.0|^11.0", + "illuminate/support": "^7.0|^8.0|^9.0|^10.0|^11.0" }, "require-dev": { "adamwojs/php-cs-fixer-phpdoc-force-fqcn": "^2.0", "friendsofphp/php-cs-fixer": "^3.0", - "orchestra/testbench": "^5.0|^6.0|^7.0|^8.0", + "orchestra/testbench": "^5.0|^6.0|^7.0|^8.0|^9.0", "phpunit/phpunit": "^9.1", "squizlabs/php_codesniffer": "^3.6" }, From 398c09f44f7c2e6c931403ce1335417e04cab2ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=CC=88nther=20Debrauwer?= Date: Fri, 15 Mar 2024 12:52:34 +0100 Subject: [PATCH 2/3] Small fixes --- .gitignore | 1 + .php-cs-fixer.php | 6 +++--- composer.json | 2 +- config/verification-code.php | 4 ++-- phpunit.xml.dist | 29 +++++++-------------------- tests/Models/VerificationCodeTest.php | 4 ++-- 6 files changed, 16 insertions(+), 30 deletions(-) diff --git a/.gitignore b/.gitignore index 9fc4735..f91236d 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ phpunit.xml .env .phpunit.result.cache .php-cs-fixer.cache +.phpunit.cache diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php index acfb07f..d6bfef7 100644 --- a/.php-cs-fixer.php +++ b/.php-cs-fixer.php @@ -1,8 +1,8 @@ true, @@ -32,7 +32,7 @@ // Converts implicit variables into explicit ones in double-quoted strings or heredoc syntax. 'explicit_string_variable' => true, // Transforms imported FQCN parameters and return types in function arguments to short version. - 'fully_qualified_strict_types' => true, + 'fully_qualified_strict_types' => false, // Add missing space between function's argument and its typehint. 'function_typehint_space' => true, // Pre- or post-increment and decrement operators should be used if possible. @@ -195,7 +195,7 @@ return (new Config()) ->registerCustomFixers([ - new ForceFQCNFixer(), + new ForceFQCNFixer() ]) ->setRules($rules) ->setFinder($finder); diff --git a/composer.json b/composer.json index 1ae21e8..2dbe42a 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ "adamwojs/php-cs-fixer-phpdoc-force-fqcn": "^2.0", "friendsofphp/php-cs-fixer": "^3.0", "orchestra/testbench": "^5.0|^6.0|^7.0|^8.0|^9.0", - "phpunit/phpunit": "^9.1", + "phpunit/phpunit": "^9.1|^10.0", "squizlabs/php_codesniffer": "^3.6" }, "autoload": { diff --git a/config/verification-code.php b/config/verification-code.php index 5fb88cc..0fc5db1 100644 --- a/config/verification-code.php +++ b/config/verification-code.php @@ -59,7 +59,7 @@ | - \NextApps\VerificationCode\Notifications\VerificationCodeCreatedInterface | */ - 'notification' => \NextApps\VerificationCode\Notifications\VerificationCodeCreated::class, + 'notification' => NextApps\VerificationCode\Notifications\VerificationCodeCreated::class, /* |-------------------------------------------------------------------------- @@ -72,7 +72,7 @@ | - \NextApps\VerificationCode\Models\VerificationCode | */ - 'model' => \NextApps\VerificationCode\Models\VerificationCode::class, + 'model' => NextApps\VerificationCode\Models\VerificationCode::class, /* |-------------------------------------------------------------------------- diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 8454a4c..34c4242 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,31 +1,16 @@ - + - + tests - - + + src/ - - - - - - - - + + - + diff --git a/tests/Models/VerificationCodeTest.php b/tests/Models/VerificationCodeTest.php index f6ee529..2661d66 100644 --- a/tests/Models/VerificationCodeTest.php +++ b/tests/Models/VerificationCodeTest.php @@ -30,7 +30,7 @@ public function it_sets_expiration_date_based_on_config() $dbVerificationCode = VerificationCode::first(); $this->assertNotNull($dbVerificationCode->expires_at); - $this->assertEquals(0, $dbVerificationCode->expires_at->diffInMinutes(now()->addHours(6))); + $this->assertEquals(0, (int) $dbVerificationCode->expires_at->diffInMinutes(now()->addHours(6))); } /** @test */ @@ -79,7 +79,7 @@ public function it_sets_expiration_date_if_not_set_on_create() ]); $this->assertNotNull($verificationCode->expires_at); - $this->assertEquals(0, $verificationCode->expires_at->diffInMinutes(now()->addHours(4))); + $this->assertEquals(0, (int) $verificationCode->expires_at->diffInMinutes(now()->addHours(4))); } /** @test */ From 6ce2a2e186bf1e82a7681605d89a7666c04269e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gu=CC=88nther=20Debrauwer?= Date: Fri, 15 Mar 2024 12:55:15 +0100 Subject: [PATCH 3/3] Fix phpunit config --- phpunit.xml.dist | 1 + 1 file changed, 1 insertion(+) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 34c4242..1a9ea9c 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -12,5 +12,6 @@ +