phpcs errors

This commit is contained in:
Paul Sealock 2019-11-21 13:23:27 +13:00 committed by Jeff Stieler
parent 6c9e78850a
commit 7987abfd1e
1 changed files with 17 additions and 12 deletions

View File

@ -3,6 +3,11 @@
* WooCommerce Unit Tests Bootstrap
*
* @since 2.2
* @package WooCommerce Tests
*/
/**
* Class WC_Unit_Tests_Bootstrap
*/
class WC_Unit_Tests_Bootstrap {
@ -25,10 +30,10 @@ class WC_Unit_Tests_Bootstrap {
*/
public function __construct() {
// phpcs:disable WordPress.PHP.DiscouragedPHPFunctions, WordPress.PHP.DevelopmentFunctions
ini_set( 'display_errors', 'on' );
// phpcs:disable
ini_set( 'display_errors', 'on' ); // @codingStandardsIgnoreLine
error_reporting( E_ALL );
// phpcs:enable WordPress.PHP.DiscouragedPHPFunctions, WordPress.PHP.DevelopmentFunctions
// phpcs:enable
// Ensure server variable is set for WP email functions.
// phpcs:disable WordPress.VIP.SuperGlobalInputUsage.AccessDetected
@ -41,19 +46,19 @@ class WC_Unit_Tests_Bootstrap {
$this->plugin_dir = dirname( $this->tests_dir );
$this->wp_tests_dir = getenv( 'WP_TESTS_DIR' ) ? getenv( 'WP_TESTS_DIR' ) : '/tmp/wordpress-tests-lib';
// load test function so tests_add_filter() is available
// load test function so tests_add_filter() is available.
require_once $this->wp_tests_dir . '/includes/functions.php';
// load WC
// load WC.
tests_add_filter( 'muplugins_loaded', array( $this, 'load_wc' ) );
// install WC
// install WC.
tests_add_filter( 'setup_theme', array( $this, 'install_wc' ) );
// load the WP testing environment
// load the WP testing environment.
require_once $this->wp_tests_dir . '/includes/bootstrap.php';
// load WC testing framework
// load WC testing framework.
$this->includes();
}
@ -86,7 +91,7 @@ class WC_Unit_Tests_Bootstrap {
\Automattic\WooCommerce\Admin\Install::create_tables();
\Automattic\WooCommerce\Admin\Install::create_events();
// Reload capabilities after install, see https://core.trac.wordpress.org/ticket/28374
// Reload capabilities after install, see https://core.trac.wordpress.org/ticket/28374.
if ( version_compare( $GLOBALS['wp_version'], '4.7', '<' ) ) {
$GLOBALS['wp_roles']->reinit();
} else {
@ -104,7 +109,7 @@ class WC_Unit_Tests_Bootstrap {
*/
public function includes() {
// framework
// framework.
require_once $this->tests_dir . '/framework/class-wc-unit-test-factory.php';
require_once $this->tests_dir . '/framework/class-wc-mock-session-handler.php';
require_once $this->tests_dir . '/framework/class-wc-mock-wc-data.php';
@ -113,13 +118,13 @@ class WC_Unit_Tests_Bootstrap {
require_once $this->tests_dir . '/framework/class-wc-payment-token-stub.php';
require_once $this->tests_dir . '/framework/vendor/class-wp-test-spy-rest-server.php';
// test cases
// test cases.
require_once $this->tests_dir . '/includes/wp-http-testcase.php';
require_once $this->tests_dir . '/framework/class-wc-unit-test-case.php';
require_once $this->tests_dir . '/framework/class-wc-api-unit-test-case.php';
require_once $this->tests_dir . '/framework/class-wc-rest-unit-test-case.php';
// Helpers
// Helpers.
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-product.php';
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-coupon.php';
require_once $this->tests_dir . '/framework/helpers/class-wc-helper-fee.php';