Closed nextgenthemes closed 1 year ago
@nextgenthemes As far as I can see your issue is not related to this repo, but to the setup-php
action.
Having said that, I have a suspicion of what may be the cause of the issues. Could you add an extra step after the "Setup PHP, with composer and extension" step to gather some more information ?
Once you have done this and got a link to a workflow, please drop a link here so I can have a look.
- name: Debug - composer global info
run: composer global info
- name: Debug - PHPUnit version
run: phpunit --version
@nextgenthemes Just for arguments sake, I've set up a minimal scenario to test that the setup-php
tools setup with phpunit-polyfills
works and I cannot reproduce the issues you are seeing. Everything works as expected.
All in all, I think your problem is something else altogether and unrelated to either setup-php
or the PHPUnit Polyfills.
This is the code I've used to test everything: https://github.com/jrfnl/bug-report-reproduction-scenarios/commit/7a2c211a72b7c618b5e107c218e7293eaaa2774b
This is the resulting workflow run confirming that everything works as it should: https://github.com/jrfnl/bug-report-reproduction-scenarios/actions/runs/5006929088
Thinking this over some more, I suspect (but haven't verified) that your problem is that you install PHPUnit twice - once via Setup PHP, once via Composer and then you load the vendor/autoload.php
file from your test bootstrap.
Chances are high that that means PHPUnit will have a mismatch in versions between your local and your global composer installs and if that's the case, I'm not surprised you are seeing issues.
@jrfnl Thanks so much, the bug report test code you linked was basically exactly what I was looking for. I just wanted to make sure I am not going down a many hour long trail and error hell again for something that may be an issue others ran into. I expected that this may not be a issue with this at all, I was very desperate. Did way to many things at once as usual.
I am so glad I filed this and you responded and put in on the right track right away. You are totally right, I did "install" things twice. I forgot to exclude a /vendor
folder that I use for my local testing that was never supposed to end up on Github, so that fucked everything up. Your assumption that I loaded this was right. It was actually supposed to NOT load.
if ( is_file( __DIR__ . '/vendor/autoload.php' ) ) {
require_once __DIR__ . '/vendor/autoload.php';
}
Should probably use a better check for it. ! getenv( 'GITHUB_CI' )
or something like that. Again, thanks you very much.
Workflow file: https://github.com/nextgenthemes/advanced-responsive-video-embedder/blob/master/.github/workflows/test-deploy.yml
It worked previously and I do not know what is going wrong now. The readme should refer to some basic project that actually uses it as reference IMO, that actually tests it. Not sure what is specific about my setup.
For php 5.6 it runs from the
vendor
directly in my plugin I find that strange ...strict_types
implies it some code running that is expecting a php version that is 7.x no idea what that happens.Because for php 7.2 I get another error and it runs in
/home/runner/.composer/vendor
Any idea what is wrong? Again I think the readme should point to an actual maintained project that uses Githhub actions for this.
Not all the test code is part of that repo anymore and its in a private repo now but I had a monorepo strcture b4 and and the that did not change AFAIK. Here is the phpunit boot. https://github.com/nextgenthemes/advanced-responsive-video-embedder/blob/a9d19f49eb63d6d5df6c96c343db29ad77b7b859/phpunit-boot.php