PHPUnit
Moderator: General Moderators
PHPUnit
Hello,
I downloaded PHPUnit PHPUnit-3.0.0beta1. Extracted to a folder and tried to test a sample test. But i am getting errors like....Warning: require_once(PHPUnit/Framework.php). i have even checked the path. Every thing seems to be correct. Can anyone guide me to get it installed?
Regards,
kpraman
I downloaded PHPUnit PHPUnit-3.0.0beta1. Extracted to a folder and tried to test a sample test. But i am getting errors like....Warning: require_once(PHPUnit/Framework.php). i have even checked the path. Every thing seems to be correct. Can anyone guide me to get it installed?
Regards,
kpraman
I believe you have three options:
1) installing with PEAR (see http://www.phpunit.de/pocket_guide/3.0/ ... ation.html)
2) downloading it yourself. This way is just fine, but you must add the parent path of PHPUnit directory to include_path of php (either by editing php.ini or at runtime with set_include_path(), see PHP manual for details).
For example, if you install PHPUnit in /var/php/libs/PHPUnit, the path /var/php/libs must be added to include_path.
3) Another option is to checkout the project from the svn repository, but again you must add that path.
1) installing with PEAR (see http://www.phpunit.de/pocket_guide/3.0/ ... ation.html)
2) downloading it yourself. This way is just fine, but you must add the parent path of PHPUnit directory to include_path of php (either by editing php.ini or at runtime with set_include_path(), see PHP manual for details).
For example, if you install PHPUnit in /var/php/libs/PHPUnit, the path /var/php/libs must be added to include_path.
3) Another option is to checkout the project from the svn repository, but again you must add that path.
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Get the file path to PHPUnit on your system. Then add it to your test file's include path.
If you want a single PHPUnit directory for all your PHP projects, set up PEAR and update it to the alpha. PEAR should already come prepackaged with PHPUnit 2.
AFAIK you start by including the relevant framework component. i.e. once it's installed to PEAR (and PEAR is on the include path) or once you set up the include path as above...
Then write your test case for the test... See the PHPUnit docs - it's the external homepage link from the PEAR page for PHPUnit2
Code: Select all
set_include_path(
get_include_path() . PATH_SEPARATOR . "my/path/from/test/to/PHPUnit"
);AFAIK you start by including the relevant framework component. i.e. once it's installed to PEAR (and PEAR is on the include path) or once you set up the include path as above...
Code: Select all
require_once 'PHPUnit/Framework/TestCase.php';PHPUnit2
I am currently using PHPUnit-1.3.2.
PHPUnit is located in,
server/project/classes/library/PHPUnit
in the testcase files, i am using the following code...
This is working.
if i want to use PHPUnit-2.3.6 What are the changes i have to make?. I am getting errors.
PHPUnit is located in,
server/project/classes/library/PHPUnit
in the testcase files, i am using the following code...
Code: Select all
<?php
set_include_path("library/");
require_once 'members.php';
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'PHPUnit.php';
class MembersTest extends PHPUnit_TestCase {
.......
......
?>if i want to use PHPUnit-2.3.6 What are the changes i have to make?. I am getting errors.
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
Check the internal 2.3.x references. If they are including from a PHPUnit2 directory then PHPUnit2 is what you need to use in your test files. I tried setting up 2.x.x via PEAR a while back and it was throwing include errors. I predominantly use SimpleTest (I also help do general maintenance for it) so I'm not entirely up to speed on the current setup.