Skip to content

Commit

Permalink
added phpunit 5 <-> 6 compatibility dirty hack
Browse files Browse the repository at this point in the history
  • Loading branch information
hiqsol committed Mar 30, 2017
1 parent 9a90cf6 commit d7a000e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,22 @@
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';

/// PHPUNIT 5 <-> 6 compatibility dirty hack
foreach ([
\PHPUnit_Framework_TestCase::class => \PHPUnit\Framework\TestCase::class,
\PHPUnit_Framework_Constraint::class => \PHPUnit\Framework\Constraint\Constraint::class,
] as $old => $new) {
foreach ([$old => $new, $new => $old] as $one => $other) {
if (!class_exists($one) && class_exists($other)) {
$pos = strrpos($one, '\\');
$class = $pos === FALSE ? $one : substr($one, $pos+1);
$space = $pos === FALSE ? '' : substr($one, 0, $pos);
$namespace = $space ? "namespace $space;" : '';
eval("${namespace}abstract class $class extends \\$other {};\n");
}
}
}

use hiqdev\composer\config\Builder;
use yii\console\Application;

Expand Down

0 comments on commit d7a000e

Please sign in to comment.