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

[Laravel 6] Bring code to a state where unit tests pass #443

Merged
merged 30 commits into from
Jan 19, 2020

Conversation

bennothommo
Copy link
Contributor

@bennothommo bennothommo commented Nov 22, 2019

This PR brings the state of the Library code, running Laravel 6 as the foundation, so that the unit tests pass. Whilst it is definitely no guarantee that the code will work with Laravel 6, it's at least a good start. This work forms part of the work towards octobercms/october#4381.

Changes made:

  • Now using Laravel 6 as the foundation framework for the library.
  • Now using PHPUnit 8 as opposed to 7, as Laravel 6 uses PHPUnit 8 as a dev dependency, and it will also be supported for longer. Refactored several tests to stop using deprecated assertions, which should also theoretically make them compatible with PHPUnit 9.
  • Now using maintainer-run Assetic library repo for bringing in Assetic library and supporting the latest Symfony Process library. Temporarily using an explicit repository definition in composer.json whilst the library is still unpublished on Packagist.
  • Breaking change: Changed October\Rain\Halcyon\MemoryRepository to use seconds instead of minutes, as per changes made to Illuminate\Cache\Repository. I didn't see this being used anywhere in the library, but I imagine this will likely result in needing changes done to October CMS core.
  • Changed some Input facade calls to comparable Request facade calls, as the Input facade is no longer available in Laravel 6 (although we are making the facade available in October still).

Ben Thomson added 15 commits November 22, 2019 00:15
- Require Laravel framework components ^6.0
- Require PHPUnit 8 to take advantage of longer support timeline
- Require Assetic from October CMS' Assetic repo, to fix conflict with Symfony Process
Prevents test from failing to load as `choice` method must be present in a class extending the Translator contract.
Exception docblock annotations were deprecated in PHPUnit 8 and will be removed in PHPUnit 9. This changes the @ExpectedException annotation to an `expectException()` call, and the @expectedExceptionMessage annotation to an `expectExceptionMessage()` call.
The `assertInternalType()` method is deprecated in PHPUnit 8 and will be removed in PHPUnit 9. We were using them to test if arrays were returned in certain test cases, so these calls have been changed to `assertIsArray()`.
`assertContain()` calls with a string haystack is deprecated in PHPUnit 8 and will be not be supported in PHPUnit 9. This changes these calls to `assertStringContainsString()`.
`assertArraySubset()` calls are deprecated in PHPUnit 8 and will be removed in PHPUnit 9. This change brings in the "dms/phpunit-arraysubset-asserts" package which retains this assertion for PHPUnit 8 and beyond.
@bennothommo
Copy link
Contributor Author

Submitted a PR to meyfa/phpunit-assert-gd to make the library compatible with PHPUnit 8, so we don't have to rewrite the Resizer unit tests. This should resolve the unit test errors reported by Actions.

meyfa/phpunit-assert-gd#2

@LukeTowers
Copy link
Contributor

@bennothommo I've sent an email to @meyfa asking if they're interested in merging that PR. If they aren't we'll just fork it over to @octoberrain and use that instead.

@@ -1,13 +1,12 @@
<?php namespace October\Rain\Parse\Assetic;

use Event;
Copy link
Contributor

Choose a reason for hiding this comment

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

@bennothommo @jaxwilko @christianWilling is there value in moving this filter to the Assetic core? I'm not 100% sure what it does differently from the already included Assetic filters.

Copy link
Contributor

Choose a reason for hiding this comment

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

From the looks of it the October one also add's in file version hashing functionality, could merge it in this filter or add in that functionality as an option for the Assetic project?

Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't spent enough time on this filter or the core Assetic filter to understand the difference between those two options @jaxwilko, are you able to explain it in a bit more detail for me?

Copy link
Contributor

Choose a reason for hiding this comment

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

@jaxwilko ping

@@ -1,12 +1,11 @@
<?php namespace October\Rain\Parse\Assetic;

use Event;
Copy link
Contributor

@LukeTowers LukeTowers Nov 22, 2019

Choose a reason for hiding this comment

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

@bennothommo @jaxwilko @christianWilling is there value in moving this filter to the Assetic core? I'm not 100% sure what it does differently from the already included Assetic filters.

@LukeTowers
Copy link
Contributor

@bennothommo note that the assetic package is on packagist: https://packagist.org/packages/assetic/framework#dev-2.0/dev

@bennothommo
Copy link
Contributor Author

@LukeTowers sweet, will drop the repository definition in composer.json.

@meyfa
Copy link

meyfa commented Nov 22, 2019

@LukeTowers FYI, I've released v2.0.0 of phpunit-assert-gd with the proposed changes.

@LukeTowers
Copy link
Contributor

@meyfa awesome, thanks very much for that! @bennothommo do you need to update the constraint in composer?

@bennothommo
Copy link
Contributor Author

Thanks heaps @meyfa. Yep, will adjust composer.json accordingly, @LukeTowers :)

@bennothommo
Copy link
Contributor Author

@LukeTowers Input facade has been re-added.

Ben Thomson added 4 commits November 23, 2019 21:45
Newer versions deprecate, and drop, support for numeric keys in arrays, which prevents our plugin version files from working.
composer.json Outdated Show resolved Hide resolved
@bennothommo bennothommo merged commit bb1511a into wip/laravel-5.9 Jan 19, 2020
@bennothommo bennothommo deleted the l6/unit-tests branch January 19, 2020 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants