-
Notifications
You must be signed in to change notification settings - Fork 10
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
Downgrade to PHP 7.4, move from Pest to PHPUnit, establish CI #25
Conversation
Coding standards matching WordPress' support for 7.0:
I'll explore CodeSniffer and Mess Detector more. Any takes @adamziel ? |
There's a lot happening here. Let's ship this one with failing tests and downgrade in a separate PR.
That's fine. People should be able to run the published Blueprints package in their PHP 7 codebase, but contributing to the project doesn't have the same constraint. It's perfectly fine for the developer tools to require PHP 8. Test runner is more tricky since we want the tests to pass on PHP 7 so, presumably, the runner should be compatible with that version. If that means we need to move from Pest to PHPUnit, then let's do that.
This is the standard WordPress tool, let's go with that one. |
I wonder if composer can even enforce PHP 7.0 in the project while allowing the dev tools to run on PHP 8.2 🤔 Perhaps we'll need a separate list of global composer dependencies just to free them from these restrictions. |
It does. I'll start with my recent pr. For PHP 7.0 the valid PHPUnit version is 6.5. source Of course it is no longer supported. But this is expected. What is more, this would be beneficial for cross-version and cross-os testing, with something along these lines: tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
dependency_version: [prefer-lowest, prefer-stable]
Not with a trivial solution. The question being - which tolls lack a acceptable 7.0 alternative? |
It's quite confusing. For PHP 7.0 For now I'll do a workaround and focus on moving from |
Let's continue in #30 and focus on a basic pipeline and Pest -> PHPUnits change. |
Well. After lengthy discussions with @adamziel it became apparent that downgrading / testing are more interconnected than initially expected. See problems mentioned at #30. So, to meet #27 and finally #26, we'll downgrade the code as far back as possible without extraneous effort. Essentially to PHP 7.4. At this version we can rewrite / keep writing unit tests in PHPUnit 6.5 and have pipelines run somewhat smoothly. And after that is done, and the code mostly works 👼, we can carefully move to 7.0. Which will include replacing or transpiling dependencies. |
2d58a21
to
078a9e1
Compare
src/WordPress/Blueprints/ResourceManager/Resolver/FilesystemResourceResolver.php
Outdated
Show resolved
Hide resolved
src/WordPress/Blueprints/ResourceManager/Resolver/FilesystemResourceResolver.php
Outdated
Show resolved
Hide resolved
075b3b7
to
ae4256f
Compare
src/WordPress/Blueprints/Resources/Resolver/ResourceResolverCollection.php
Outdated
Show resolved
Hide resolved
src/WordPress/Blueprints/Resources/Resolver/ResourceResolverCollection.php
Outdated
Show resolved
Hide resolved
src/WordPress/Blueprints/Resources/Resolver/ResourceResolverCollection.php
Outdated
Show resolved
Hide resolved
src/WordPress/Blueprints/Resources/Resolver/ResourceResolverInterface.php
Outdated
Show resolved
Hide resolved
Actually, what is the specific issue with the word <?php
namespace Test\Resource;
$resource = 'test';
class Resource {}
function resource($resource) { echo "This is fine"; }
resource('a'); You can try it here: https://3v4l.org/nEQv0#v7.0.8 |
This one is close. Let's conclude the discussion about the word Resource and resort back to using it if there are no issues with it, resolve the merge conflicts, and merge. |
d2f4ef5
to
732e955
Compare
All done now. 😎 |
@reimic This needs to be resolved before the PR can be merged: |
|
||
// TODO Review class |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use @TODO:
for these to make them easier to find. Not a blocker here, just a note for the future.
Also, this one isn't very clear. Why does this class need an additional review? What to look for?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, for the first part. Regarding the reason for marking it for review. It had a lot of commented out code, I wanted to signal that that could be addressed, but there was no reason to do that in this PR.
} | ||
} | ||
|
||
// TODO Evaluate waring: 'ext-json' is missing in composer.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just add that extension to composer.json:
{
"require": {
"ext-json": "*"
}
}
I left a few nitpicks, but this PR looks pretty good otherwise. I'll go ahead and merge, let's address any remaining issues in a follow-up one. |
What is this PR doing?
Acts as an intermediary step in reaching goals set in #26 , #27.
Caveats
prefer-lowest
as one of the arguments in thedependency_version
list. This will allow for the broadest version support. But at this point in time it fails at 7.4. Fixing this serves little purpose as, see logic above.PHP Fatal error: Cannot acquire reference to $GLOBALS
. This is still a step in the right direction as writing PHPUnit tests in 9.6 and then downgrading them to 6.5 is still easier, than writing in Pest and then going for PHPUnit 6.5.