-
Notifications
You must be signed in to change notification settings - Fork 5
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
Running unit test shows an error #25
Comments
@Ratko-Solaja for now it looks to be an upstream issue. I'm not sure if this will be fixed, or if this was intended to be done in this way, but based on what I'll get as an answer I might have to limit the functionality of this package to integration tests only :/
The above suggestion won't work. In that case even the unit tests will use the integration test base test class :/ |
@Ratko-Solaja I think I found a dirty workaround that should do the trick. In your integration tests, before the if (!empty($GLOBALS['argv']) && $GLOBALS['argv'][1] === '--group=unit') {
return;
} That way, you'll bail out of the integration test file during unit tests. EDIT:You can also create a helper in the function isUnitTest() {
return !empty($GLOBALS['argv']) && $GLOBALS['argv'][1] === '--group=unit';
} And then just use in your integration test: <?php
use Yoast\WPTestUtils\WPIntegration\TestCase;
if (isUnitTest()) {
return;
}
uses(TestCase::class);
// Rest of the tests. Looks a bit cleaner 😄 |
I have stumbled upon this error today and after many attempts I think that I found what causes that error. By default Switching attribute to |
I will try to test this and if this works update the lib 👍🏼 Thanks! |
@Dartui it looks like this works, so I will try to update the readme with the instructions. Thanks! |
Describe your bug
After doing a clean install of wp-pest and running the command
vendor/bin/pest --group=unit
- the following error appears:Steps to Reproduce
composer require dingo-d/wp-pest-integration-test-setup --dev
vendor/bin/wp-pest setup theme
vendor/bin/pest --group=unit
Expected behavior
It should do the tests.
Environment info
Please confirm that you have searched existing issues in this repo.
Yes
The text was updated successfully, but these errors were encountered: