Skip to content
Permalink
Browse files

Loading PHPUnit aliases once from all initial autoloaded files

  • Loading branch information...
jeremyharris committed Jun 24, 2017
1 parent 74530d6 commit 39f2b8a9ece5c4eae24cf8bb6ec54488d244002a
@@ -14,12 +14,7 @@
*/
namespace Cake\TestSuite\Fixture;
if (class_exists('PHPUnit_Runner_Version')) {
if (version_compare(\PHPUnit_Runner_Version::id(), '5.7', '<')) {
trigger_error(sprintf('Your PHPUnit Version must be at least 5.7.0 to use CakePHP Testsuite, found %s', \PHPUnit_Runner_Version::id()), E_USER_ERROR);
}
class_alias('PHPUnit_Framework_Test', 'PHPUnit\Framework\Test');
}
loadPHPUnitAliases();
use Cake\TestSuite\TestCase;
use PHPUnit\Framework\BaseTestListener;
@@ -14,6 +14,8 @@
*/
namespace Cake\TestSuite\Fixture;
loadPHPUnitAliases();
use Cake\Core\Configure;
use Cake\Core\Exception\Exception;
use Cake\Database\Schema\TableSchema;
@@ -16,13 +16,7 @@
*/
namespace Cake\TestSuite;
if (class_exists('PHPUnit_Runner_Version')) {
if (version_compare(\PHPUnit_Runner_Version::id(), '5.7', '<')) {
trigger_error(sprintf('Your PHPUnit Version must be at least 5.7.0 to use CakePHP Testsuite, found %s', \PHPUnit_Runner_Version::id()), E_USER_ERROR);
}
class_alias('PHPUnit_Framework_TestSuite', 'PHPUnit\Framework\TestSuite');
class_alias('PHPUnit_Framework_AssertionFailedError', 'PHPUnit\Framework\AssertionFailedError');
}
loadPHPUnitAliases();
use Cake\Filesystem\Folder;
use PHPUnit\Framework\TestSuite as BaseTestSuite;
@@ -140,3 +140,18 @@ function dd($var, $showHtml = null)
die(1);
}
}
if (!function_exists('loadPHPUnitAliases')) {
/**
* Loads PHPUnit aliases
*
* This is an internal function used for backwards compatibility during
* fixture related tests.
*
* @return void
*/
function loadPHPUnitAliases()
{
require_once dirname(__DIR__) . DS . 'tests' . DS . 'phpunit_aliases.php';
}
}
@@ -0,0 +1,10 @@
<?php
if (class_exists('PHPUnit_Runner_Version')) {
if (version_compare(\PHPUnit_Runner_Version::id(), '5.7', '<')) {
trigger_error(sprintf('Your PHPUnit Version must be at least 5.7.0 to use CakePHP Testsuite, found %s', \PHPUnit_Runner_Version::id()), E_USER_ERROR);
}
class_alias('PHPUnit_Framework_Test', 'PHPUnit\Framework\Test');
class_alias('PHPUnit_Framework_AssertionFailedError', 'PHPUnit\Framework\AssertionFailedError');
class_alias('PHPUnit_Framework_TestSuite', 'PHPUnit\Framework\TestSuite');
}

0 comments on commit 39f2b8a

Please sign in to comment.
You can’t perform that action at this time.