diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 19d6402..114c1ab 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -16,7 +16,7 @@ jobs: - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.0' + php-version: '8.3' coverage: none - name: Install composer dependencies diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index d728c6f..a5a0973 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,12 +13,16 @@ jobs: fail-fast: true matrix: os: [ubuntu-latest] - php: [8.0, 8.1] - laravel: [8.*] + php: [8.2, 8.3] + laravel: [9.*, 10.*, 11.*] stability: [prefer-lowest, prefer-stable] include: - - laravel: 8.* - testbench: ^6.23 + - laravel: 9.* + testbench: ^7.0 + - laravel: 10.* + testbench: ^8.0 + - laravel: 11.* + testbench: ^9.0 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} diff --git a/.gitignore b/.gitignore index 9a43686..52f505a 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ testbench.yaml vendor node_modules .php-cs-fixer.cache +.phpunit.cache diff --git a/composer.json b/composer.json index 047b048..2d88dde 100644 --- a/composer.json +++ b/composer.json @@ -17,19 +17,17 @@ } ], "require": { - "php": "^8.0", + "php": "^8.1", "spatie/ssl-certificate": "^2.1" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.4", - "nunomaduro/collision": "^5.10", - "pestphp/pest": "^1.21", - "pestphp/pest-plugin-laravel": "^1.1", + "pestphp/pest": "^1.23|^2.12", + "pestphp/pest-plugin-laravel": "^1.4|^2.3", "phpstan/extension-installer": "^1.1", "phpstan/phpstan-deprecation-rules": "^1.0", "phpstan/phpstan-phpunit": "^1.0", - "phpunit/phpunit": "^9.5", - "spatie/laravel-health": "^1.2" + "spatie/laravel-health": "^1.27" }, "autoload": { "psr-4": { @@ -44,11 +42,15 @@ "scripts": { "analyse": "vendor/bin/phpstan analyse", "test": "vendor/bin/pest", - "test-coverage": "vendor/bin/pest coverage", + "test-coverage": "vendor/bin/pest --coverage", "cs-fixer": "vendor/bin/php-cs-fixer fix --config=.php_cs.dist.php --allow-risky=yes" }, "config": { - "sort-packages": true + "sort-packages": true, + "allow-plugins": { + "pestphp/pest-plugin": true, + "phpstan/extension-installer": true + } }, "minimum-stability": "dev", "prefer-stable": true diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 73b5c83..d93b929 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,39 +1,23 @@ - - - - tests - - - - - ./src - - - - - - - - - - + + + + tests + + + + + + + + + + + + + + + ./src + + diff --git a/src/SslCertificationExpiredCheck.php b/src/SslCertificationExpiredCheck.php index b807049..392233a 100644 --- a/src/SslCertificationExpiredCheck.php +++ b/src/SslCertificationExpiredCheck.php @@ -4,7 +4,6 @@ namespace VictoRD11\SslCertificationHealthCheck; -use Carbon\Carbon; use Spatie\Health\Checks\Check; use Spatie\Health\Checks\Result; use Spatie\SslCertificate\SslCertificate; @@ -62,13 +61,13 @@ public function run(): Result } $certificate = SslCertificate::createForHostName($this->url, 30, false); - $daysUntilExpired = Carbon::now()->diffInDays($certificate->expirationDate(), false); + $daysUntilExpired = $certificate->daysUntilExpirationDate(); $result = Result::make() ->meta(['days_until_expired' => $daysUntilExpired]) ->shortSummary($daysUntilExpired . ' days until'); - if ($daysUntilExpired < 0) { + if ($certificate->isExpired()) { return $result->failed('The certificate has expired'); }