Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Yii 1.1.12 CTestCase doesn't work with PHPUnit 3.7.7 #1563

Closed
DexterHD opened this Issue · 11 comments

10 participants

@DexterHD

I have PHPUnit 3.7.7, Yii framework 1.1.12 and PHP 5.4.5. My include_path variable is:

.:/usr/local/php/lib/php:/usr/local/php/lib/php/yii/framework:/usr/local/php/lib/php/PHPUnit:/usr/local/php/lib/php/PEAR

But when I'm trying to start some unit test for my Yii Framework application I get this error:

Fatal error: Uncaught exception 'LogicException' with message 'Function 'phpunit_autoload' not found (function 'phpunit_autoload' not found or invalid function name)' in /usr/local/php/lib/php/yii/framework/YiiBase.php on line 628

LogicException: Function 'phpunit_autoload' not found (function 'phpunit_autoload' not found or invalid function name) in /usr/local/php/lib/php/yii/framework/YiiBase.php on line 628

@samdark samdark was assigned
@jmalinens

I have the same problem.

Use:

require_once('PHPUnit/Runner/Version.php');
require_once('PHPUnit/Autoload.php');

instead of:

require_once('PHPUnit/Util/Filesystem.php'); // workaround for PHPUnit <= 3.6.11
require_once('PHPUnit/Autoload.php');
spl_autoload_unregister('phpunit_autoload');
Yii::registerAutoloader('phpunit_autoload');
@tanakahisateru

I also have.

I can use PHPUnit 3.7 with modifying yii/framework/test/CTestCase.php to:

require_once('PHPUnit/Runner/Version.php');
require_once('PHPUnit/Util/Filesystem.php'); // workaround for PHPUnit <= 3.6.11
require_once('PHPUnit/Autoload.php');
if (in_array('phpunit_autoload', spl_autoload_functions())) { // PHPUnit >= 3.7 'phpunit_alutoload' was obsoleted
    spl_autoload_unregister('phpunit_autoload');
    Yii::registerAutoloader('phpunit_autoload');
}
@DaSourcerer

Can we get @tanakahisateru's code in? I suspect this is also the culprit of the failing travis builds for php 5.3+ ...

@tanakahisateru

I will send a pull request soon.

@samdark samdark closed this in 5357ebe
@samdark
Owner

@tanakahisateru applied your proposed solution. Works like a charm. Thanks for it.

@tanakahisateru

@samdark Thanks for your commit.

@aliv aliv referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@peterver

works like a charm :+1: thanks !

@mplanigale

Brilliant, thanks @tanakahisateru

@gaurishpatil

Excellent.... Excellent...... , thank you very much....@tanakahisateru.... my code look like this in yi-1.1.12//framework/test/CTestCase.php,

<?php
/**

require_once('PHPUnit/Runner/Version.php');
require_once('PHPUnit/Util/Filesystem.php'); // workaround for PHPUnit <= 3.6.11
require_once('PHPUnit/Autoload.php');
if (in_array('phpunit_autoload', spl_autoload_functions())) { // PHPUnit >= 3.7 'phpunit_alutoload' was obsoleted
spl_autoload_unregister('phpunit_autoload');
Yii::registerAutoloader('phpunit_autoload');
}

/**

abstract class CTestCase extends PHPUnit_Framework_TestCase
{
}

@CityBeekeeper

Thanks. Helped me too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.