Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More robust version checking of underlying phpUnit #25

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions classes/kohana/unittest/tests.php
Expand Up @@ -51,7 +51,8 @@ static public function configure_environment($do_whitelist = TRUE, $do_blacklist
spl_autoload_register(array('Unittest_tests', 'autoload'));

// As of PHPUnit v3.5 there are slight differences in the way files are black|whitelisted
self::$phpunit_v35 = function_exists('phpunit_autoload');
list($major, $minor, $release) = explode('.', PHPUnit_Runner_Version::id());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using version_compare?

self::$phpunit_v35 = (($major < 4 && $minor < 6) || $major < 3);

Unittest_tests::$cache = (($cache = Kohana::cache('unittest_whitelist_cache')) === NULL) ? array() : $cache;

Expand Down Expand Up @@ -136,7 +137,7 @@ static function addTests(PHPUnit_Framework_TestSuite $suite, array $files)
{
$filter->addFileToBlacklist($file);
}
else
else if (self::$phpunit_v35)
{
PHPUnit_Util_Filter::addFileToFilter($file);
}
Expand Down Expand Up @@ -295,7 +296,7 @@ static protected function set_whitelist($files)
{
$filter->addFileToWhitelist($file);
}
else
else if (self::$phpunit_v35)
{
PHPUnit_Util_Filter::addFileToWhitelist($file);
}
Expand Down