So I want to get PHUnit up so I can run selenium server, but I've come to that sad realization that this will likely never happen for me. I have tried it with numerous different versions of WAMP and XAMPP (which I don't think is my problem) but I always end up hitting a wall where either one of two things happens:
A package cannot be found ie: "No releases available for package "pear.phpunit.de/File_Iterator" install failed", and I do have all of the proper channels discovered.
I get through the install (one way of another) and I end up with a error like "Fatal error: 'PHPUnit_Runner_BaseTestRunner' not found in C:\xampp\php\PEAR\PHPUnit\TextUI\TestRunner.php on line 60" - swap 'PHPUnit_Runner_BaseTestRunner' for any other file that should be included.
I'm incredibility frustrated because of the lack of consistency across the board with not only PHPUnit but pear as well. It seems like I have to run through 50 steps, wait for the planets to align and rotate in my chair a dozen times - clockwise...
Sorry for the rant - my question:
Is there a simple, straight forward tutorial for doing this, that you guys have had success with? Or perhaps is there a tut + zip somewhere that I can use to just bypass the pear install and just copy over the files? - because it seems like that is all pear is doing anyways. Any type of server (Wamp, Xampp, etc) and version is fine - I'll perform a fresh install and I don't need to run anything else on that machine so all i want is to get this working.
Edit:
So I've manually went through all of the files and added require_once()'s everywhere that it appeared that they were needed. Then I downloaded the remaining files from http://pear.phpunit.de/ and place them in there required locations. No Errors! But now when I run 'c:\xampp\php > phpunit', nothing happens! I just get another command line - this also happens when I try to run something like, 'c:\xampp\php > phpunit test1', even though I'm not sure exactly where I need to be storing the test1.php file...
Edit 2:
I'm pretty sure something is wrong with the .bat file for phpunit because when I try to run any command (ie: phpunit --help, --version, etc.) nothing happens, I just get another command line. Should i delete the .bat file and the phpunit folder and try again? I also think that there is a firewall issue because I'm able to run the same command on a different machine that isn't apart of my company's domain.
"No releases available for package "pear.phpunit.de/File_Iterator
This can have several reasons:
You need to update the channel information
$ pear channel-update pear.phpunit.de
Your network connection has problems, i.e. firewall doesn't allow it or you need to setup the proxy.
To debug it, try a
# pear remote-info pear.phpunit.de/File_Iterator
Package details:
================
Latest 1.2.6
Installed 1.2.6
If that works, you can install it. Otherwise, try to force it:
$ pear install -f pear.phpunit.de/File_Iterator
if that still does not work, visit http://pear.phpunit.de and download the package manually. install it with
$ pear install File_iterator-1.2.6.tgz
Download and install XAMPP Windows 1.7.3 Installer.
Filename: xampp-win32-1.7.3.exe
I would NOT recommend to use any newer version, it MAY break this procedure.
1. Install XAMPP to C:\
xampp
directory automatically, here's what I answered...
No
Yes
Yes
2. Open C:\xampp\php\php.ini
and enable curl
3. Install new PEAR Version needed for PHPUnit 3.X
C:\xampp\php
Run as administrator
C:\xampp\php
cd xampp
cd php
php go-pear.phar
(Installs new PEAR)system
-wide installationAll
componentsYes
include_path = ".;\xampp\php\PEAR"
line 796C:\xampp\php\PEAR_ENV.reg
4. Install PHPUnit
C:\xampp\php
pear channel-discover components.ez.no
(this is needed for PHPUnit)pear channel-discover pear.symfony-project.com
(also needed by PHPUnit)pear channel-discover pear.phpunit.de
(This IS phpunit)pear update-channels
(updates channel definitions)pear upgrade --alldeps
(upgrades all existing packages and pear)pear install --alldeps phpunit/PHPUnit
(installs PHPUnit and all dependencies)You're welcome! This took multiple hours to solve :)
If there's anything to add/remove, please leave a comment.
I had the same problem before and I didn't find any tutorial about this issue.
I finally solved it after a while.
You can try following thoses steps.
Download PHPUnit and his dependencies at : https://github.com/sebastianbergmann
Extract PHPUnit and each of his dependancies in the folder of your choice.
Open the file
FolderWhereYouExtractedEverything/PHPUnit-3.5.13OrAnotherVersion/phpunit.php
Add the following code while replacing text by the paths :
$originalpath = 'PathToTheFolderWhereYouExtractedEverything';
$path = $originalpath .'PathToThePHPUnitFolderContainedInTheFolderExtracted';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
$path = $originalpath .'PathToThePHPCodeCoverageFolder';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
$path = $originalpath .'PathToThePHPFileIteratorFolder';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
$path = $originalpath .'PathToThePHPTextTemplateFolder';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
$path = $originalpath .'PathToThePHPTokenStreamFolder';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
$path = $originalpath .'PathToThePHPTimerFolder';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
Open the file "phpunit.bat" in the phpunit folder that you extracted. (Something like PHPUnit-3.5.13)
Replace all the bottom lines by the following code :
set PHPBIN="PathToThephp.exeFile"
php -d safe_mode=Off "PathToThephpunit.phpFile" %*
Edit your evironnement variables by adding the path to the
PathToThePHPUnitFolderContainedInThePHPUnitFolderExtracted
Edit your evironnement variables by adding the path to the php.exe file.
You may have some deprecated function warnings, just replace the functions by a not deprecated one.
I hope all this helps.
try this before trying to install anything using PEAR:
pear clear-cache
I had all kinds of problems, no packages were found, and now it works. whenever i do anything using pear, i clear the cache first
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With