Hi, I am following Agile Web Application Development with Yii 1.1 and PHP5.
In chapter 3, when I tried to go along with the unit testing example described, the following error came up in the command prompt.
C:\wamp\www\yiiprojects\demo\protected\tests>phpunit unit/MessageTest.php
PHPUnit 3.7.9 by Sebastian Bergmann.
Function 'phpunit_autoload' not found (function 'phpunit_autoload' not found or
invalid function name)
But functional test example worked well for me. I tried re-installing phpunit and other dependencies many times.still no luck.
Can someone help? thanks.
Page 1 of 1
Yii Unit Test Not Working !
#2
Posted 07 November 2012 - 12:36 PM
Try to change the file : framework\test\CTestCase.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');
#3
Posted 08 November 2012 - 09:09 AM
Marek Surek, on 07 November 2012 - 12:36 PM, said:
Try to change the file : framework\test\CTestCase.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');Hello Marek Surek,
Well, guess what.. it worked.
Thank you so much. I was searching all over the Internet for this and your solution did work.
It prints a large amount of code like a stack trace of the error in the console window. but when the code is error free it works really fine.
thanks for the support Marek. really appreciate it.
#4
Posted 08 November 2012 - 09:11 AM
Dedicated PR in the Github: https://github.com/y...yii/issues/1563 (just linking with forum topic)
#5
Posted 30 November 2012 - 02:36 PM
amsandun, on 08 November 2012 - 09:09 AM, said:
Hello Marek Surek,
Well, guess what.. it worked.
Thank you so much. I was searching all over the Internet for this and your solution did work.
It prints a large amount of code like a stack trace of the error in the console window. but when the code is error free it works really fine.
thanks for the support Marek. really appreciate it.
Well, guess what.. it worked.
Thank you so much. I was searching all over the Internet for this and your solution did work.
It prints a large amount of code like a stack trace of the error in the console window. but when the code is error free it works really fine.
thanks for the support Marek. really appreciate it.
This modification also works for PhPUnit 3.7.9!
Thanks Folks!
Share this topic:
Page 1 of 1

Help










