babylon9
(Babylon9)
August 29, 2010, 6:09pm
1
When using phpunit example when I run
#phpunit functional/SiteTest.php
I get this error
Fatal error: Class ‘WebTestCase’ not found in /var/www/yiiwp2/app1002/protected/tests/functional/SiteTest.php on line 3
For php5 and Apache 2 I include_path.ini for yii framework like this
My include_path is in /etc/php5/conf.d/include_path.ini
#cd /etc/php5/conf.d/
#nano include_path.ini
include_path = ".:/usr/share/php:/usr/share/php/PEAR:/usr/share/php/PHPUnit:/home/george/knjiznice/yii/framework/"
My bootstrap.php file is
<?php
// change the following paths if necessary
$yiit=dirname(FILE ).’/../../../../../../home/george/knjiznice/yii/framework/yiit.php’;
$config=dirname(FILE ).’/../config/test.php’;
require_once($yiit);
require_once(dirname(FILE ).’/WebTestCase.php’);
Yii::createWebApplication($config);
Can anybody give me a tip? Thanks in advance.
tri
(tri - Tommy Riboe)
August 29, 2010, 7:15pm
2
babylon9:
When using phpunit example when I run
#phpunit functional/SiteTest.php
I get this error
Fatal error: Class ‘WebTestCase’ not found in /var/www/yiiwp2/app1002/protected/tests/functional/SiteTest.php on line 3
…
To me it looks like you put bootstrap.php in the protected/tests/functional directory. Try to move it up one level. If needed, adjust the yiit path (config path looks fine to me).
/Tommy
babylon9
(Babylon9)
August 29, 2010, 7:29pm
3
bootstrap.php is one level upper directory like so
george@babylon6:/var/www/yiiwp2/app1002/protected/tests$ ls
bootstrap.php fixtures functional phpunit.xml report unit WebTestCase.php
where functional is directory and in is file SiteTest.php
#nano /var/www/yiiwp2/app1002/protected/tests/functional/SiteTest.php
<?php
class SiteTest extends WebTestCase
{
public function testIndex()
{
$this->open('');
$this->assertTextPresent('Welcome');
}
tri
(tri - Tommy Riboe)
August 29, 2010, 9:12pm
4
babylon9:
bootstrap.php is one level upper directory like so
george@babylon6:/var/www/yiiwp2/app1002/protected/tests$ ls
bootstrap.php fixtures functional phpunit.xml report unit WebTestCase.php
…
Seems like I misinterpreted your first post. It was several months since I used functional tests but scripts similar to yours seems to have no problem finding WebTestCase.php. No more clues at the moment.
Edit: I use phpUnit 3.4.0
/Tommy
mikl
(Mike)
August 30, 2010, 7:00am
5
I had the same problem with phpunit < 3.4. After upgrading everything went fine.
The docs for the upcoming Yii 1.1.4 release are already fixed:
babylon9
(Babylon9)
August 30, 2010, 5:59pm
6
Yea you have right. I upgrade phpunit package to testing in lenny debian.
from phpunit == 3.2.16.1 to phpunit == 3.4.14-1
and now it works. Thanks guys.
babylon9:
I upgrade phpunit package to testing in lenny debian.
from phpunit == 3.2.16.1 to phpunit == 3.4.14-1
and now it works. Thanks guys.
To upgrade a single (phpunit) package in debian lenny:
echo "deb http://ftp.us.debian.org/debian testing main non-free contrib" >> /etc/apt/sources.list
aptitude update
aptitude install phpunit/testing