Skip to content

Commit

Permalink
Fix with Carbon 3
Browse files Browse the repository at this point in the history
Add support test Laravel 9, 10, 11
  • Loading branch information
Viktor Mazur committed Mar 28, 2024
1 parent 1290986 commit 322860a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 9 additions & 3 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.0, 8.1]
laravel: [8.*]
php: [8.0, 8.1, 8.2]
laravel: [8.*, 9.*, 10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 8.*
testbench: ^6.23
testbench: ^6.0
- 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 }}

Expand Down
8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,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
Expand Down
5 changes: 2 additions & 3 deletions src/SslCertificationExpiredCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace VictoRD11\SslCertificationHealthCheck;

use Carbon\Carbon;
use Spatie\Health\Checks\Check;
use Spatie\Health\Checks\Result;
use Spatie\SslCertificate\SslCertificate;
Expand Down Expand Up @@ -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');
}

Expand Down

0 comments on commit 322860a

Please sign in to comment.