PHPUnit - 15+ hrs wasted and still doesn't work
"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_IteratorPackage details:================Latest 1.2.6Installed 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:\
- Version 1.7.3 will create
xampp
directory automatically, here's what I answered...- Should I add shortcuts to the startmenu/desktop?
No
- Should I locate the XAMPP paths correctly?
Yes
- Portable?
Yes
- Enter enter exit etc.
- Should I add shortcuts to the startmenu/desktop?
2. Open C:\xampp\php\php.ini
and enable curl
- uncomment line 952
- extension=php_curl.dll
3. Install new PEAR Version needed for PHPUnit 3.X
- Download: http://pear.php.net/go-pear.phar
- Save it under:
C:\xampp\php
- Open a Command Prompt with Administrator privileges
- Right-click on Command Prompt -icon and choose
Run as administrator
- Right-click on Command Prompt -icon and choose
- Change directory to
C:\xampp\php
cd xampp
cd php
- Type
php go-pear.phar
(Installs new PEAR) - Choose
system
-wide installation - Install
All
components - Would you like alter php.ini
- Answer
Yes
- This will add PEAR to the path
include_path = ".;\xampp\php\PEAR"
line 796
- Answer
- After installing run
C:\xampp\php\PEAR_ENV.reg
4. Install PHPUnit
- Be sure you're still in
C:\xampp\php
- Type
pear channel-discover components.ez.no
(this is needed for PHPUnit) - Type
pear channel-discover pear.symfony-project.com
(also needed by PHPUnit) - Type
pear channel-discover pear.phpunit.de
(This IS phpunit) - Type
pear update-channels
(updates channel definitions) - Type
pear upgrade --alldeps
(upgrades all existing packages and pear) - Type
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
- PHP Unit
- PHP Token Stream
- PHP Timer
- PHP TextTemplate
- PHP File Itérator
- PHP CodeCoverage
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.