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

Add Support for Laravel 11 #1757

merged 8 commits into from
Feb 6, 2024

Conversation

stefanzweifel
Copy link
Contributor

@stefanzweifel stefanzweifel commented Feb 6, 2024

Update dependency constraints to support Laravel 11 and GitHub Actions workflow to run the test suite for Laravel 11 as well.

Test suite currently fails for Laravel 11 installations that either use Carbon v2 or Carbon v3. (diffForHumans() transforms 0 seconds either to "1 second ago" or "0 seconds ago".)

Edit: Fixed the test suite by updating the assertions.

@@ -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)

@stefanzweifel stefanzweifel marked this pull request as ready for review February 6, 2024 07:14
@freekmurze freekmurze merged commit a1de347 into spatie:main Feb 6, 2024
10 of 11 checks passed
@freekmurze
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants