'CTestCase' not found when running tests with PHPUnit

I know this has been asked a couple times in the past, but none of those solutions worked for me. I am following along with the yii book and am currently trying to run the first PHPUnit test. But whenever I try to run the test it says “Fatal error: Class ‘CTestCase’ not found”. I just upgraded to the latest version of xdebug yesterday and then installed PHPUnit. I also checked the bootstrap file to make sure $yiit and $config were pointed to the right location. Does anybody have any ideas about how to get this working? I’m running on windows vista.

hello.

try to make sure u have phpunit 3.14 then make sure you include the php path in the enviromental variables of your system path. if that doesnt work

try to follow a step step procedure in the phpunit installation guide

cheer!!!

Jasdo,

I am following along in the Yii book and running on Mac OS X 10.6 and had the same error message.

After I ensuring that my bootstrap.php file pointed to the right places (it did), I found that I was doing a very simple mistake of running the command:

$ php unit/MessageTest.php

when I should have been running

$ phpunit unit/MessageTest.php

Thank you binkabir and jmb. It turns out I had been forgetting to provide the path to phpunit.

you are welcome once again to the YII family!!! ::)

I’m using the version yii-1.1.3.r2247

I have the same problem with CTestCase.

with pear , I can’t load the Phpunit but the version PHPUnit2 is ok.

What must I do ?

I send my config :

[i]C:\wamp\bin\php\php5.2.9-2>pear install phpunit/PHPUnit

Unknown remote channel: pear.symfony-project.com

Unknown remote channel: pear.symfony-project.com

Unknown remote channel: components.ez.no

Unknown remote channel: components.ez.no

phpunit/PHPUnit requires package "channel://pear.symfony-project.com/YAML" (vers

ion >= 1.0.2)

phpunit/PHPUnit can optionally use PHP extension "dbus"

phpunit/PHPUnit can optionally use PHP extension "soap"

phpunit/DbUnit requires package "channel://pear.symfony-project.com/YAML" (versi

on >= 1.0.2)

phpunit/PHP_CodeCoverage requires package "channel://components.ez.no/ConsoleToo

ls" (version >= 1.6)

phpunit/PHP_CodeCoverage can optionally use PHP extension "xdebug" (version >= 2

.0.5)

phpunit/PHP_TokenStream requires package "channel://components.ez.no/ConsoleTool

s" (version >= 1.6)

No valid packages found

install failed[/i][font="Arial Black"][/font][color="#FF0000"][/color]

C:\wamp\bin\php\php5.2.9-2>pear list -a

INSTALLED PACKAGES, CHANNEL __URI:

==================================

(no packages installed)

INSTALLED PACKAGES, CHANNEL DOC.PHP.NET:

========================================

(no packages installed)

INSTALLED PACKAGES, CHANNEL PEAR.PHP.NET:

=========================================

PACKAGE VERSION STATE

Archive_Tar 1.3.7 stable

Auth_SASL 1.0.4 stable

Benchmark 1.2.7 stable

Console_Getopt 1.2.3 stable

DB 1.7.13 stable

Log 1.12.3 stable

MDB2 2.4.1 stable

Mail 1.2.0 stable

Net_SMTP 1.4.2 stable

Net_Socket 1.0.9 stable

PEAR 1.9.1 stable

PHPUnit2 2.3.6 stable

Structures_Graph 1.0.3 stable

XML_Util 1.2.1 stable

INSTALLED PACKAGES, CHANNEL PEAR.PHPUNIT.DE:

============================================

PACKAGE VERSION STATE

File_Iterator 1.2.3 stable

PHPUnit_MockObject 1.0.0 stable

PHPUnit_Selenium 1.0.0 stable

PHP_Timer 1.0.0 stable

Text_Template 1.0.0 stable

INSTALLED PACKAGES, CHANNEL PECL.PHP.NET:

=========================================

(no packages installed)