Skip to content

Commit

Permalink
Fix PHPUnit tests bootstrap for WC 4.4 and WP 5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
vbelolapotkov committed Sep 22, 2021
1 parent edd1791 commit e820df4
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 40 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"vimeo/psalm": "4.8.1",
"php-stubs/wordpress-stubs": "5.7.2",
"php-stubs/woocommerce-stubs": "5.5.0",
"rregeer/phpunit-coverage-check": "0.3.1"
"rregeer/phpunit-coverage-check": "0.3.1",
"yoast/phpunit-polyfills": "^1.0"
},
"scripts": {
"test": [
Expand Down
98 changes: 60 additions & 38 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tests/unit/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
// Give access to tests_add_filter() function.
require_once $_tests_dir . '/includes/functions.php';


/**
* Manually load the plugin being tested.
*/
Expand Down Expand Up @@ -77,6 +76,9 @@ function _manually_load_plugin() {

tests_add_filter( 'muplugins_loaded', '_manually_load_plugin' );

// Need those polyfills to run tests in CI.
require_once dirname( __FILE__ ) . '/../../vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php';

// Start up the WP testing environment.
require $_tests_dir . '/includes/bootstrap.php';

Expand Down

0 comments on commit e820df4

Please sign in to comment.