Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

More robust version checking of underlying phpUnit #25

Closed
wants to merge 1 commit into from

5 participants

@chandeeland

... the changes are not caught by the function_exists test, so i changed to to check PHPUnit's version function

@chandeeland chandeeland the test for PHPUnit version is more robust. I'm using PHPUnit 3.6, a…
…nd the changes are not caught by the function_exists test, so i changed to to check PHPUnit's version function
9771c95
@Kohana-Builds
Collaborator

Build Scheduled

@hkdobrev hkdobrev commented on the diff
classes/kohana/unittest/tests.php
@@ -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());
@hkdobrev
hkdobrev added a note

Why not using version_compare?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
@Zeelot
Owner

This pull doesn't seem mergable any more but like @hkdobrev said, version_compare should be simpler. You also seem to be using && and || instead of AND and OR.

I would also like to simply get rid of any version comparisons from now on anyway since we include phpunit using composer so we only ever have to support the version we are requiring in composer.json.

@Zeelot Zeelot closed this
@hkdobrev

I would also like to simply get rid of any version comparisons from now on anyway since we include phpunit using composer so we only ever have to support the version we are requiring in composer.json.

:+1: on what @Zeelot said. This is one of the best sides of using Composer. Support only what you use and not everything available.

@zombor
Owner

I'm pretty sure I got rid of all that. Maybe it was in the 3.3 branch.

@Zeelot
Owner

You're right, all this sillyness is gone from 3.3 :) excellent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 11, 2012
  1. @chandeeland

    the test for PHPUnit version is more robust. I'm using PHPUnit 3.6, a…

    chandeeland authored
    …nd the changes are not caught by the function_exists test, so i changed to to check PHPUnit's version function
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 3 deletions.
  1. +4 −3 classes/kohana/unittest/tests.php
View
7 classes/kohana/unittest/tests.php
@@ -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());
@hkdobrev
hkdobrev added a note

Why not using version_compare?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ self::$phpunit_v35 = (($major < 4 && $minor < 6) || $major < 3);
Unittest_tests::$cache = (($cache = Kohana::cache('unittest_whitelist_cache')) === NULL) ? array() : $cache;
@@ -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);
}
@@ -295,7 +296,7 @@ static protected function set_whitelist($files)
{
$filter->addFileToWhitelist($file);
}
- else
+ else if (self::$phpunit_v35)
{
PHPUnit_Util_Filter::addFileToWhitelist($file);
}
Something went wrong with that request. Please try again.