Merge pull request #30472 from woocommerce/fix/unit-tests
Try fix WP nightly unit tests
This commit is contained in:
commit
2445f7b303
|
@ -65,7 +65,9 @@ jobs:
|
||||||
unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip
|
unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip
|
||||||
composer bin phpunit config --unset platform
|
composer bin phpunit config --unset platform
|
||||||
composer bin phpunit config repositories.0 '{"type": "path", "url": "/tmp/phpunit-7.5-fork/phpunit-add-compatibility-with-php8-to-phpunit-7", "options": {"symlink": false}}'
|
composer bin phpunit config repositories.0 '{"type": "path", "url": "/tmp/phpunit-7.5-fork/phpunit-add-compatibility-with-php8-to-phpunit-7", "options": {"symlink": false}}'
|
||||||
composer bin phpunit require --dev -W phpunit/phpunit:@dev --ignore-platform-reqs
|
composer bin phpunit require --dev -W phpunit/phpunit:@dev --ignore-platform-reqs
|
||||||
|
rm -rf ./vendor/phpunit/
|
||||||
|
composer dump-autoload
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Init DB and WP
|
- name: Init DB and WP
|
||||||
|
|
|
@ -62,7 +62,9 @@ jobs:
|
||||||
unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip
|
unzip -d /tmp/phpunit-7.5-fork /tmp/phpunit-7.5-fork.zip
|
||||||
composer bin phpunit config --unset platform
|
composer bin phpunit config --unset platform
|
||||||
composer bin phpunit config repositories.0 '{"type": "path", "url": "/tmp/phpunit-7.5-fork/phpunit-add-compatibility-with-php8-to-phpunit-7", "options": {"symlink": false}}'
|
composer bin phpunit config repositories.0 '{"type": "path", "url": "/tmp/phpunit-7.5-fork/phpunit-add-compatibility-with-php8-to-phpunit-7", "options": {"symlink": false}}'
|
||||||
composer bin phpunit require --dev -W phpunit/phpunit:@dev --ignore-platform-reqs
|
composer bin phpunit require --dev -W phpunit/phpunit:@dev --ignore-platform-reqs
|
||||||
|
rm -rf ./vendor/phpunit/
|
||||||
|
composer dump-autoload
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Init DB and WP
|
- name: Init DB and WP
|
||||||
|
|
|
@ -143,6 +143,10 @@
|
||||||
"sftp",
|
"sftp",
|
||||||
"storage"
|
"storage"
|
||||||
],
|
],
|
||||||
|
"support": {
|
||||||
|
"issues": "https://github.com/thephpleague/flysystem/issues",
|
||||||
|
"source": "https://github.com/thephpleague/flysystem/tree/1.1.5"
|
||||||
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
"url": "https://offset.earth/frankdejonge",
|
"url": "https://offset.earth/frankdejonge",
|
||||||
|
|
|
@ -25,7 +25,8 @@
|
||||||
"woocommerce/woocommerce-blocks": "5.7.0"
|
"woocommerce/woocommerce-blocks": "5.7.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"bamarni/composer-bin-plugin": "^1.4"
|
"bamarni/composer-bin-plugin": "^1.4",
|
||||||
|
"yoast/phpunit-polyfills": "^1.0"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
"optimize-autoloader": true,
|
"optimize-autoloader": true,
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -46,7 +46,4 @@
|
||||||
</exclude>
|
</exclude>
|
||||||
</whitelist>
|
</whitelist>
|
||||||
</filter>
|
</filter>
|
||||||
<listeners>
|
|
||||||
<listener class="SpeedTrapListener" file="tests/legacy/includes/listener-loader.php" />
|
|
||||||
</listeners>
|
|
||||||
</phpunit>
|
</phpunit>
|
||||||
|
|
|
@ -67,6 +67,12 @@ class WC_Unit_Tests_Bootstrap {
|
||||||
// install WC.
|
// install WC.
|
||||||
tests_add_filter( 'setup_theme', array( $this, 'install_wc' ) );
|
tests_add_filter( 'setup_theme', array( $this, 'install_wc' ) );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Load PHPUnit Polyfills for the WP testing suite.
|
||||||
|
* @see https://github.com/WordPress/wordpress-develop/pull/1563/
|
||||||
|
*/
|
||||||
|
define( 'WP_TESTS_PHPUNIT_POLYFILLS_PATH', __DIR__ . '/../vendor/yoast/phpunit-polyfills/phpunitpolyfills-autoload.php' );
|
||||||
|
|
||||||
// load the WP testing environment.
|
// load the WP testing environment.
|
||||||
require_once $this->wp_tests_dir . '/includes/bootstrap.php';
|
require_once $this->wp_tests_dir . '/includes/bootstrap.php';
|
||||||
|
|
||||||
|
|
|
@ -1,47 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Listener loader.
|
|
||||||
*
|
|
||||||
* @package WooCommerce\UnitTests
|
|
||||||
*/
|
|
||||||
|
|
||||||
$wp_tests_dir = getenv( 'WP_TESTS_DIR' ) ? getenv( 'WP_TESTS_DIR' ) : sys_get_temp_dir() . '/wordpress-tests-lib';
|
|
||||||
|
|
||||||
// Polyfill a function that wasn't added until WordPress 5.1.
|
|
||||||
if ( ! function_exists( 'tests_get_phpunit_version' ) ) {
|
|
||||||
/**
|
|
||||||
* Retrieves PHPUnit runner version.
|
|
||||||
*/
|
|
||||||
function tests_get_phpunit_version() {
|
|
||||||
if ( class_exists( 'PHPUnit_Runner_Version' ) ) {
|
|
||||||
$version = PHPUnit_Runner_Version::id();
|
|
||||||
} elseif ( class_exists( 'PHPUnit\Runner\Version' ) ) {
|
|
||||||
// Must be parsable by PHP 5.2.x.
|
|
||||||
$version = call_user_func( 'PHPUnit\Runner\Version::id' );
|
|
||||||
} else {
|
|
||||||
$version = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $version;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The listener-loader.php file wasn't introduced into the core test framework until r44701, which
|
|
||||||
* means it came after WordPress 5.0 (r43971).
|
|
||||||
*
|
|
||||||
* Once WordPress 5.0 is no longer supported, we can safely reduce this to:
|
|
||||||
*
|
|
||||||
* require_once $wp_tests_dir . '/includes/listener-loader.php';
|
|
||||||
*
|
|
||||||
* @link https://core.trac.wordpress.org/changeset/44701/
|
|
||||||
*/
|
|
||||||
if ( file_exists( $wp_tests_dir . '/includes/listener-loader.php' ) ) {
|
|
||||||
require_once $wp_tests_dir . '/includes/listener-loader.php';
|
|
||||||
} else {
|
|
||||||
if ( version_compare( tests_get_phpunit_version(), '7.0', '>=' ) ) {
|
|
||||||
require $wp_tests_dir . '/includes/phpunit7/speed-trap-listener.php';
|
|
||||||
} else {
|
|
||||||
require $wp_tests_dir . '/includes/speed-trap-listener.php';
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue