From 619c90dd42a38bd3254620da99d8485a70c43000 Mon Sep 17 00:00:00 2001 From: "J.D. Grimes" Date: Tue, 14 Nov 2017 17:02:00 -0500 Subject: [PATCH] Load PHPUnit 6 compat shim from WP If needed. Fixes #19 --- src/WPPPB/Loader.php | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/WPPPB/Loader.php b/src/WPPPB/Loader.php index f9f6948..999be73 100644 --- a/src/WPPPB/Loader.php +++ b/src/WPPPB/Loader.php @@ -75,6 +75,9 @@ public static function instance() { * @since 0.1.0 */ protected function __construct() { + + $this->phpunit_compat(); + if ( $this->should_install_plugins() ) { $this->hook_up_installer(); } @@ -216,6 +219,23 @@ public function locate_wp_tests_config() { return $config_file_path; } + /** + * Ensures compatibility with the current PHPUnit version. + * + * @since 0.3.2 + */ + public function phpunit_compat() { + + if ( class_exists( 'PHPUnit\Runner\Version' ) ) { + /** + * Compatibility with PHPUnit 6+. + * + * @since 0.3.2 + */ + require_once $this->get_wp_tests_dir() . '/includes/phpunit6-compat.php'; + } + } + /** * Check whether the plugins should be installed. *