Skip to content

Commit

Permalink
User correct PHPUnit 6 compat file path
Browse files Browse the repository at this point in the history
It has changed on more recent versions of WordPress.

See #27
  • Loading branch information
JDGrimes committed Apr 22, 2019
1 parent 00d40b3 commit cc117cf
Showing 1 changed file with 23 additions and 8 deletions.
31 changes: 23 additions & 8 deletions src/WPPPB/Loader.php
Expand Up @@ -227,14 +227,29 @@ public function locate_wp_tests_config() {
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';


$tests_dir = $this->get_wp_tests_dir();

// Back-compat for older WP versions.
if ( file_exists( $tests_dir . '/includes/phpunit6-compat.php' ) ) {

/**
* Compatibility with PHPUnit 6+.
*
* @since 0.3.2
*/
require_once $tests_dir . '/includes/phpunit6-compat.php';

} else {

/**
* Compatibility with PHPUnit 6+.
*
* @since 0.3.6
*/
require_once $tests_dir . '/includes/phpunit6/compat.php';
}

class_alias(
'PHPUnit\Framework\Constraint\Constraint'
, 'PHPUnit_Framework_Constraint'
Expand Down

0 comments on commit cc117cf

Please sign in to comment.