Pest v2 #26
Replies: 6 comments 14 replies
-
Hi! I was planning to, but the pest v2 requirement is PHP 8.1, so if I'd release v2 it would be limited to PHP 8.1. I'd have to check out if it would work with my dependencies as intended. Plus WP core itself is not fully compatible with PHP 8.1 yet, so I'm not sure if there would be some underlying issues when running tests. I'll have to invest some time in testing it out. |
Beta Was this translation helpful? Give feedback.
-
Hello, I am trying to test one of our custom plugin, using the feature/v2 branch. The composer.json of our plugin is:
Executing vendor/bin/wp-pest setup plugin --plugin-slug the-plugin-slug I am getting this structure in my plugin project: Executing vendor/bin/pest I am getting:
Can you put me on the right track? I am missing some basic concepts. Thank you |
Beta Was this translation helpful? Give feedback.
-
Hi @davideprevosto, as mentioned in the readme, to run unit tests, you'll need to run: vendor/bin/pest --group=unit And in order to run integration tests, you'll need to run vendor/bin/pest --group=integration Be careful about the integration tests, as you'll probably have to do some modifications to the test suite in order to run them. There was also a comment about running integration tests that might help. |
Beta Was this translation helpful? Give feedback.
-
I have got the same error even executing:
I read the comment and I changed my phpunit.xml as described (can't imagine it, my fault)
...but I am still getting the same error |
Beta Was this translation helpful? Give feedback.
-
I'll have to investigate this a bit more I didn't get errors about no test case being found when running it 🤔 |
Beta Was this translation helpful? Give feedback.
-
Since you put the require 'bootstrap.php'; before the I just tried it on my personal project, and I got it to work (both unit and integration tests). I have these scripts in my ...
"scripts": {
"test:unit": "@php ./vendor/bin/pest --group=unit",
"test:integration": "@php ./vendor/bin/pest --group=integration"
}, I updated the config to this: <?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="Unit Test Suite">
<directory>./tests/Unit/</directory>
</testsuite>
<testsuite name="Integration Test Suite">
<directory>./tests/Integration/</directory>
</testsuite>
</testsuites>
<php>
<env name="WP_TESTS_DIR" value="wp/tests/phpunit"/>
<env name="TEST" value="true" force="true"/>
<server name="DB_NAME" value="wp_pest_test_db"/>
<server name="DB_USER" value="root"/>
<server name="DB_PASSWORD" value=""/>
<server name="DB_HOST" value="localhost"/>
</php>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
<coverage>
<report>
<clover outputFile="tests/coverage/clover.xml"/>
<html outputDirectory="tests/coverage/html" lowUpperBound="50" highLowerBound="90"/>
</report>
</coverage>
</phpunit> |
Beta Was this translation helpful? Give feedback.
-
Hello,
Thank you for sharing this package.
Do you plan to upgrade it and using Pest V2?
Regards
Beta Was this translation helpful? Give feedback.
All reactions