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

Add Support for Laravel 11 #1757

Merged
merged 8 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 6 additions & 1 deletion .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,16 @@ jobs:
matrix:
os: [ubuntu-latest]
php: [8.3, 8.2, 8.1]
laravel: [10.*]
laravel: [10.*, 11.*]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 11.*
php: 8.1

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

Expand Down
24 changes: 12 additions & 12 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,29 @@
"require": {
"php": "^8.1",
"ext-zip": "^1.14.0",
"illuminate/console": "^10.10.0",
"illuminate/contracts": "^10.10.0",
"illuminate/events": "^10.10.0",
"illuminate/filesystem": "^10.10.0",
"illuminate/notifications": "^10.10.0",
"illuminate/support": "^10.10.0",
"illuminate/console": "^10.10.0|^11.0",
"illuminate/contracts": "^10.10.0|^11.0",
"illuminate/events": "^10.10.0|^11.0",
"illuminate/filesystem": "^10.10.0|^11.0",
"illuminate/notifications": "^10.10.0|^11.0",
"illuminate/support": "^10.10.0|^11.0",
"league/flysystem": "^3.0",
"spatie/db-dumper": "^3.0",
"spatie/laravel-package-tools": "^1.6.2",
"spatie/laravel-signal-aware-command": "^1.2",
"spatie/laravel-signal-aware-command": "^1.2|^2.0",
"spatie/temporary-directory": "^2.0",
"symfony/console": "^6.0",
"symfony/finder": "^6.0"
"symfony/console": "^6.0|^7.0",
"symfony/finder": "^6.0|^7.0"
},
"require-dev": {
"ext-pcntl": "*",
"composer-runtime-api": "^2.0",
"larastan/larastan": "^2.7.0",
"laravel/slack-notification-channel": "^2.5",
"laravel/slack-notification-channel": "^2.5|^3.0",
"league/flysystem-aws-s3-v3": "^2.0|^3.0",
"mockery/mockery": "^1.4",
"orchestra/testbench": "^8.0",
"pestphp/pest": "^1.20",
"orchestra/testbench": "^8.0|^9.0",
"pestphp/pest": "^1.20|^2.0",
"phpstan/extension-installer": "^1.1",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.1"
Expand Down
2 changes: 1 addition & 1 deletion tests/FormatTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
it('can determine the age in days', function () {
Carbon::setTestNow(Carbon::create(2016, 1, 1)->startOfDay());

expect(Format::ageInDays(Carbon::now()))->toEqual('0.00 (1 second ago)');
expect(Format::ageInDays(Carbon::now()->subSeconds(5)))->toEqual('0.00 (5 seconds ago)');
Copy link
Contributor Author

@stefanzweifel stefanzweifel Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the assertion here to be compatible with Carbon v2 and v3.
Internally v3 uses floats instead of integers.

This led to issues when the diff was ~0 seconds. See test run.

There's also a great summary of the major changes in this comment: laravel/framework#49764 (comment)

expect(Format::ageInDays(Carbon::now()->subHour(1)))->toEqual('0.04 (1 hour ago)');
expect(Format::ageInDays(Carbon::now()->subHour(1)->subDay(1)))->toEqual('1.04 (1 day ago)');
expect(Format::ageInDays(Carbon::now()->subHour(1)->subMonths(1)))->toEqual('30.04 (4 weeks ago)');
Expand Down
Loading