diff --git a/README.md b/README.md index 137f6e9..1f7eba5 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,34 @@ For an in-depth reasoning and explanation of how this package came to be, you ca Basically what's "under the hood" is downloaded [wordpress-develop](https://github.com/WordPress/wordpress-develop) repository to your project, added an in memory DB (sql lite from [aaemnnosttv/wp-sqlite-db](https://github.com/aaemnnosttv/wp-sqlite-db)), and a base test class from [Yoast/wp-test-utils](https://github.com/Yoast/wp-test-utils). All that combined allows you to run integration tests in WordPress with Pest PHP without any additional setup. +## Running unit tests alongside integration tests + +Due to the bug in how Pest handles [file loading](https://github.com/pestphp/pest/issues/649), in order to successfully run the unit tests, you'll need to add the following helper to either your `Pest.php` file, or your `Helpers.php` file: + +```php +function isUnitTest() { + return !empty($GLOBALS['argv']) && $GLOBALS['argv'][1] === '--group=unit'; +} +``` + +Then, in your **integration** tests, you'll need to add, before the test case `uses()` call + +```php +