Page 1 of 1
PHPUnit2/PHPUnit3 installation
Posted: Sat Jan 06, 2007 7:52 am
by kpraman
Hello,
Is it possible to use phpunit 2 or phpunit 3 by using the include statement without installing? (As we do with phpunit 1.3)?
Thanx
Posted: Sat Jan 06, 2007 9:03 am
by feyd
Have you tried it?
Posted: Sat Jan 06, 2007 6:16 pm
by kpraman
i tried i am getting error.
Posted: Sat Jan 06, 2007 7:22 pm
by feyd
.....and the error is.....
Posted: Tue Jan 09, 2007 6:19 am
by kpraman
i renamed phpunit to phpunit2.php, i did not change #!@php_bin@. what path should i have to give there?
in the testcase,
Code: Select all
<?php
set_include_path("PHPUNIT2/");
require_once 'membertypes.php';
require_once 'PHPUnit2.php';
...
?>
#!@php_bin@
Warning: require(PHPUnit2/TextUI/TestRunner.php) [function.require]: failed to open stream: No such file or directory in D:\Projects\proj1\classes\PHPUNIT2\PHPUnit2.php on line 40
Fatal error: require() [function.require]: Failed opening required 'PHPUnit2/TextUI/TestRunner.php' (include_path='PHPUNIT2/') in D:\Projects\proj1\classes\PHPUNIT2\PHPUnit2.php on line 40
Thanx
Posted: Tue Jan 09, 2007 7:39 am
by Maugrim_The_Reaper
Based on your require usage, you should have a file at location (relative):
PHPUNIT2/PHPUnit2/TextUI/TestRunner.php
And yes, the PHPUnit2 directory really should be inside the all-capitals PHPUNIT2 directory. The include_path should point to whichever directory contains the PHPUnit2 package under the PEAR convention. Also, when setting an include path, for compatibility with any other PEAR or included paths, you should add your path to the contents of
get_include_path().
Posted: Tue Jan 09, 2007 8:04 am
by kpraman
Could you pls elobrate your reply?
1. what should i type in the place of #!@php_bin@.
2. i was using PHPUnit 1 inside a PHPUNIT folder, in the code i was using set_include_path("PHPUNIT/"); , now i replaced PHPUnit2 inside the folder
Posted: Tue Jan 09, 2007 9:31 am
by Maugrim_The_Reaper
Just reiterating that:
PHPUnit2/TextUI/TestRunner.php is a relative path *from* the parent include_path entry. If you have set the include_path to PHPUnit2 and your capitalised PHPUNIT2 is not a parent directory (i.e. above the non-capitalised PHPUnit2) than you have the include_path setup wrong - hence the fatal error if using from a webserver.
If using the PHP command line, you should add the include_path directly to the php.ini file. Also be warned - on Windows the PHP command line will use any php.ini file in the Windows or System32 folders in favour of any other alternative. I've seen some people installing standalone PHP versions, then installing other alternatives like XAMPP, and forget to delete the old php.ini instances. Makes for some puzzling moments when using PHP CLI - e.g. managing your PEAR packages.
php_bin should be set as an environment variable in your system. Its value is the full path to the PHP bin directory - see your PHP install for details.