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, Ed, biapar, Willr, Ingo, swaiba

PHPUnit on windows

Go to End

6 Posts   4959 Views


Community Member, 42 Posts

19 October 2010 at 1:04am

Edited: 23/10/2010 4:28am

Hi guys,

Can somebody help me with PHPUnit and SS 2.4.2?
My primary OS is windows 7 ultimate 64-bit, my secondary OS is Ubuntu 10.10. On Ubuntu is all OK.

I’ve troubles only on windows 7: all 32-bit: Apache/2.2.15 (Win32) DAV/2 PHP/5.2.13 mod_ssl/2.2.15 OpenSSL/0.9.8m mod_perl/2.0.4 Perl/v5.10.1, mysql 5.1.51.

I spent whole weekend to setup php with CLI ( I don’t want see shit error “CLI stopped working”).
I tested php versions:
5.3.3 - I cannot connect to mysql
5.3.2 - I cannot connect to mysql
5.3.1 - I can connect to mysql, but I cannot resolve error “CLI stopped working“
5.2.13 - OK. I can connect to mysql , I solved error “CLI stopped working“ (reason: soap.dll).
I install pear.

Archive_Tar 1.3.7 stable
Console_Color 1.0.2 stable
Console_Getargs 1.3.5 stable
Console_Getopt 1.2.3 stable
Console_Table 1.1.3 stable
Event_Dispatcher 1.1.0 stable
File_Find 1.3.1 stable
HTML_Common 1.2.5 stable
HTML_Table 1.8.3 stable
MDB2 2.4.1 stable
MDB2_Driver_mysql 1.4.1 stable
MDB2_Driver_mysqli 1.4.1 stable
PEAR 1.9.1 stable
PHPUnit 1.3.2 stable
PHP_CompatInfo 1.9.0 stable
PhpDocumentor 1.4.3 stable
Structures_Graph 1.0.3 stable
Var_Dump 1.0.4 stable
XML_Beautifier 1.2.0 stable
XML_Parser 1.3.2 stable
XML_Util 1.2.1 stable

As CLI work php phpunit StackTest (.php).
But when I want try, I see only error:

[User Notice] Please no longer include "PHPUnit/Framework.php".
GET /dev/tests
Line 50 in E:\php\PEAR\PHPUnit\Framework.php
41 * @link
42 * @since File available since Release 3.0.0
43 */
45 require_once 'PHP/CodeCoverage/Filter.php';
46 PHP_CodeCoverage_Filter::getInstance()->addFileToBlacklist(__FILE__, 'PHPUNIT');
48 trigger_error(
49 'Please no longer include "PHPUnit/Framework.php".', E_USER_NOTICE
50 );
• trigger_error(Please no longer include "PHPUnit/Framework.php".,1024)
Line 50 of Framework.php
• require_once(E:\php\PEAR\PHPUnit\Framework.php)
Line 20 of TestRunner.php
• include_once(E:\Www\\sapphire\dev\TestRunner.php)
Line 300 of Core.php
• __autoload(TestRunner)
• ReflectionClass->__construct(TestRunner)
Line 89 of Object.php
• Object::create(TestRunner)
Line 108 of DevelopmentAdmin.php
• DevelopmentAdmin->tests(SS_HTTPRequest)
Line 137 of RequestHandler.php
• RequestHandler->handleRequest(SS_HTTPRequest)
Line 147 of Controller.php
• Controller->handleRequest(SS_HTTPRequest)
Line 281 of Director.php
• Director::handleRequest(SS_HTTPRequest,Session)
Line 124 of Director.php
• Director::direct(/dev/tests)
Line 127 of main.php

Where is problem, what I’m doing wrong?

I upgraded php to 5.3.1 and I found this article:, today.
So I made changes:

in /sapphire/dev/TestRunner.php

if(hasPhpUnit()) {
//require_once 'PHPUnit/Framework.php';
//require_once 'PHPUnit/Util/Report.php';
//require_once 'PHPUnit/TextUI/TestRunner.php';
require_once 'PHPUnit/Autoload.php';


in /sapphire/dev/SapphireTest.php

if(hasPhpUnit()) {
//require_once 'PHPUnit/Framework.php';
require_once 'PHPUnit/Autoload.php';

I see screen with links to tests after /dev/tests, but after clik to any link I got error:

Fatal error: Class 'PHPUnit_Framework_TestCase' not found in E:\Www\\sapphire\dev\SapphireTest.php on line 15

I NEED HELP!!!!!!!!!

Attached Files

Forum Moderator, 922 Posts

19 October 2010 at 10:51pm

Edited: 19/10/2010 11:02pm

My usual process to install PHP, PEAR and then PHPUnit on Windows is as follows:

1. Download PHP "Zip" link for appropriate version you need from here:
2. Extract the Zip contents to C:\php5 or wherever you would like PHP installed
3. Rename the php.ini-development to php.ini and edit it, enable extensions etc
4. Open command line as an administrator, browse to where you extracted PHP and type go-pear.bat to install PEAR
5. Install PHPUnit using the instructions here:

Using the above steps, I've always been able to get it working without any trouble.



Forum Moderator, 1890 Posts

19 October 2010 at 11:10pm

Edited: 19/10/2010 11:56pm

@ Sean - So you do not use the wamp version of PHP?
(I ask because wamp downloads and installs the zip for us)


Community Member, 42 Posts

19 October 2010 at 11:18pm

You are happy man!


Community Member, 42 Posts

19 October 2010 at 11:19pm

I'm using xampp cca 7 years......


Forum Moderator, 922 Posts

20 October 2010 at 9:23am

swaiba: Not if I'm working with IIS on Windows, as the PHP version that comes with XAMMP or WAMP is thread safe, and a VC6 compile.