Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

UnitTest Error


Reply


4 Posts   2104 Views

Avatar
ChrisBryer

Community Member, 95 Posts

23 December 2009 at 10:51am

Hi Everyone,
I'm trying to set up unit tests, and installed pear and PHPUnit-3.3.17 on wamp. PHPUnit says it installed ok.
i restarted apache, and visited localhost/mysite/dev/tests/ and receive this error on all tests.

Fatal error: Class 'PHPUnit_Framework_TestSuite' not found in C:\wamp\www\mysite\sapphire\dev\TestRunner.php on line 144

i checked out this file and dont see a class definition for PHPUnit_Framework_TestSuite. i'm running SS version 2.3.3, and also tested with SS 2.3.1

can anyone let me know what i'm missing?
thanks alot,
-Chris

Avatar
tobych

Community Member, 97 Posts

27 December 2009 at 3:32pm

PHPUnit_Framework_TestSuite is a class from PHPUnit. PHPUnit/Framework.php must be in your include path so the code at the top of dev/TestRunner.php finds it. I imagine this is best done in .htaccess if you can; I don't know the best place to do this in the SilverStripe code itself. For code snippets for doing adding a folder to the include path, see http://www.silverstripe.org/blog-module-forum/show/267774?start=0#post273560

Avatar
ChrisBryer

Community Member, 95 Posts

5 January 2010 at 10:26am

Hi Tobych,
thanks for the reply.
I just got it working.

i had to do a few things to get it to work..
i manually added path environment variables to let pear and phpunit run. (added ;C:\wamp\bin\php\php5.2.6\ to the path)
my pear installation installed the PHPUnit folder in c:\wamp\bin\php\php5.2.6\PEAR. i needed to change the php.ini file to reflect that:

(php.ini)
include_path = ".;C:/wamp/bin/php/php5.2.6/PEAR;"

thanks again for the help,
-Chris

Avatar
ChrisBryer

Community Member, 95 Posts

5 January 2010 at 10:35am

actually, i didnt need to adjust the environment variables at all.. just changing the include path and restarting apache worked.

thanks again,
-Chris