I am using wamp 2.2 in win 7 and trying to install phpunit
1.I downoad phpunit-master.zip from https://github.com/sebastianbergmann/phpunit.
2. I unzip it.
3. I put it under D:\wamp\bin\php\php5.3.10, Then, I run below php script;
<?php
//testsuite.wordcount.php
require_once 'PHPUnit/TextUI/TestRunner.php';
require_once "PHPUnit/Framework/TestSuite.php";
require_once "class.testwordcount.php";
$suite = new PHPUnit_Framework_TestSuite();
$suite->addTestSuite("TestWordCount");
PHPUnit_TextUI_TestRunner::run($suite);
?>
The output is:
*Warning: require_once(PHPUnit/TextUI/TestRunner.php) [function.require-once]: failed to open stream: No such file or directory in D:\wamp\www\oop\test.php on line 4*
It seems that I did not install phpunit correctly, so what may go wrong?
Run the following commands (they may take a while to update):
pear channel-update pear.php.net
pear upgrade-all
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear channel-discover pear.symfony-project.com
pear update-channels
To install PHPUnit, run
pear install --alldeps --force phpunit/PHPUnit
To test that PHPUnit was successfully installed, run
phpunit -v
You can't just plop the files there and hope for it to work, you need to follow the installation instructions here: https://github.com/sebastianbergmann/phpunit#installation
For me, the easiest way I've found to install it is via Pear if you're happy to have it installed system wide, although this can get messy down the track with upgrades, different versions etc, or on a per project basis you can install via composer (which is my preference)
Recently I successfully uninstalled pear using the following command:
$ sudo pear uninstall pear
So I recently reinstalled it, but I botched the installation and I want to start over (once again). This time, when I run the above command, pear gives me this message:
pear/pear not installed
Any suggestions?
PEAR is just a bunch of php scripts. To uninstall it manually just remove /usr/share/php/PEAR (the path can vary on distribs)
Refer to the correct way to install and uninstall pear:
http://pear.php.net/manual/en/installation.getting.php
I'm trying to install PHP_Depend as here below but I'm getting that error you can see..
javier#javier-mbp:/var/www$ pear channel-discover pear.pdepend.org
Channel "pear.pdepend.org" is already initialized
javier#javier-mbp:/var/www$ pear remote-list -c pdepend
Channel pdepend Available packages:
===================================
Package Version
PHP_CodeSniffer_Standards_PDepend2 -n/a-
PHP_Depend 0.10.6
PHP_Depend_Log_Arbit 1.0.0
staticReflection -n/a-
javier#javier-mbp:/var/www$ pear install pdepend/PHP_Depend
No releases available for package "pear.pdepend.org/PHP_Depend"
install failed
Any help?
Javi
You no longer have to install the -beta package (as shown here - http://pear.pdepend.org/).
If you're still getting this error, you may have an issue with your pear cache.
Try running:
pear clear-cache
And then try installing again.
Another thing I'd like to make mention of: PHP_Depend is now available on Packagist as 'pdepend' via Composer: http://pdepend.org/news/pdepend-1.1.0-released.html
As stated in http://pdepend.org/documentation/handbook/installation/pear-installer.html:
$ pear install pdepend/PHP_Depend-beta
Note the "beta" in it. By default, the pear installer only installs software marked as stable, which phpdepend is not.
Here is my problem. I already asked that question in the XAMPP community forum
but no reply. Maybe some of you can help.
I am running XAMPP with the following config
Win 7, 32 bit
xampp-win32-1.7.4-VC6
I want to update PHPUnit via pear that I can use it for Selenium Testing
First, add I the Channel
pear channel-discover pear.phpunit.de
Then I install package
pear install phpunit/PHPUnit
Right here I get always the same error message ...
Warning: file_exists (): Unable to find the wrapper "channel" - did you forget to
enable it when you configured PHP? in PEAR \ Downloader \ Package.php on line 1416
Warning: is_file (): Unable to find the wrapper "channel" - did you forget to ena
ble it when you configured PHP? in PEAR \ Downloader \ Package.php on line 1425
Warning: is_file (): Unable to find the wrapper "channel" - did you forget to ena
ble it when you configured PHP? in PEAR \ Downloader \ Package.php on line 1425
I even tried to reinstall xampp completely, which didn't helped.
I also did an
pear install phpunit/PHPUnit
Didn't changed a thing.
Can this be due to an firefall setting?
I hope somebody can help me with this problem.
Best regards
Jeremy
Jeremy,
I have the exact same set-up on my pc environment...
Win 7, 32 bit
xampp-win32-1.7.4-VC6
what version pear is installed on you system...type " pear info pear " (without quotes).
You need version 1.9.1 at least. If not type " pear upgrade pear "
Tip - open cmd open as administrator - it makes a huge difference
also try " pear remote-list -c phpunit " to discover packages you have in phpunit
and either " pear install phpunit/the_package_name "
It worked for me - I hope this helps...There are other ways but I find this the most effective way with xampp 1.7.4 in windows 7
Try:
pear install --force pear
pear channel-discover pear.phpunit.de
pear install --force --alldeps phpunit/PHPUnit
Post a comment if it doesn't work and I'll investigate further
Pear update Problems?
To update your PEAR installation, request http://pear.php.net/go-pear.phar in your browser and save the output to a local file go-pear.php. You can then run
php go-pear.php
If that doesn't work start the shell with admin privileges (rightclick -> run as admin).
Reponse to the comment:
If pear tells you that it doesn't know about a channel like pear.symfony-project.com you need to run:
pear channel-discover pear.symfony-project.com
Go to C:\Users\nameuser\AppData\Local\Temp\pear\cache, where nameuser is your Windows username.
In this folder, delete all temporary lines and then try to update with the above steps.
I recently installed phpunit on my server via the pear installer.
When I go to run a test I get the following error:
PHP Warning: require_once(PHPUnit/Util/Filter.php): failed to open stream: No such file or directory in /usr/bin/phpunit on line 44
PHP Fatal error: require_once(): Failed opening required 'PHPUnit/Util/Filter.php' (include_path='.:/usr/bin/php') in /usr/bin/phpunit on line 44
After doing some searching, I tried making some modifications to the include_path in my php.ini file on the server. But that hasn't done a thing.
Any idea what might be causing this?
UPDATE: As of 2013 November and Ubuntu 12.04 these 2 commands should suffice:
sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit
The following is an older answer.
It's a known problem , although almost a year and a half had passed. Read about it here
The code coverage must be installed in order for phpunit to work properly
What you need to do is covered here:
code coverage installation through PEAR
Basically you have to type (with sudo if you don't have permissions, taken that phpunit is already installed):
pear channel-discover pear.phpunit.de
pear channel-discover components.ez.no
pear install phpunit/PHP_CodeCoverage
I had this problem on OS X. Fixed it with the following commands which force all the php dependencies to be reinstalled, which included a couple of packages from other channels that were not already configured:
sudo pear channel-discover pear.symfony-project.com
sudo pear channel-discover components.ez.no
sudo pear install --alldeps phpunit/PHPUnit
https://bugs.launchpad.net/ubuntu/+source/phpunit/+bug/701544
and specially this comment for ubuntu 11.04 and may be for some others too
even though i did ths steps as recommended above, i didn't get it to work but after i upgraded pear from 1.9.1 to 1.9.2 it's working perfectly just do this
speshu#speshu-laptop:~$ sudo pear upgrade pear
downloading PEAR-1.9.2.tgz ...
Starting to download PEAR-1.9.2.tgz (295,120 bytes)
.....................................................done: 295,120 bytes
upgrade ok: channel://pear.php.net/PEAR-1.9.2
PEAR: Optional feature webinstaller available (PEAR's web-based installer)
PEAR: Optional feature gtkinstaller available (PEAR's PHP-GTK-based installer)
PEAR: Optional feature gtk2installer available (PEAR's PHP-GTK2-based installer)
PEAR: To install optional features use "pear install pear/PEAR#featurename"
If it is the first time you are using PEAR, perhaps you have not configured the include path right. Take a look at the appropriate section in the PEAR manual.
https://github.com/sebastianbergmann/php-code-coverage
sb#ubuntu ~ % pear channel-discover pear.phpunit.de
Adding Channel "pear.phpunit.de" succeeded
Discovery of channel "pear.phpunit.de" succeeded
sb#ubuntu ~ % pear channel-discover components.ez.no
Adding Channel "components.ez.no" succeeded
Discovery of channel "components.ez.no" succeeded
sb#vmware ~ % pear install phpunit/PHP_CodeCoverage
downloading PHP_CodeCoverage-0.9.0.tgz ...
Starting to download PHP_CodeCoverage-0.9.0.tgz (108,376 bytes)
.........................done: 108,376 bytes
install ok: channel://pear.phpunit.de/PHP_CodeCoverage-0.9.0
(include_path='.:/usr/bin/php')
Are you sure you added it to the include_path?
It might also help if we saw your ini file, and the include_path snippet in it...
I found it!
Looks like PEAR installed PHPUnit in /usr/share/pear. Not sure why but that's where it is. Must be a (mt) thing.
Anyway, I'm all set. Thanks for the help.
This is also what happens if you have an out-of-date or incomplete PHPUnit install. Please be aware that after you set up PEAR, you must add the PHPUnit.de channel in order to get an up-to-date package.
In my case, I solved it by adding /usr/share/php/PEAR to the include_path.
I'm using Ubuntu 10.04.2.
If you have problems with accessing components try another way.
Install pear
sudo apt-get install php-pear
Install phpunit by using pear.
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit
Install phpunit/Selenium, but first you need to install curl module
sudo apt-get install php5-curl
pear install phpunit/PHPUnit_Selenium
I was having the same problem. Netbeans was reporting that the phpunit version was too old (which it wasn't). Running the phpunit script directly showed the above messages.
I solved it adding:
include_path=".:/usr/share/php"
To /etc/php5/cli/php.ini
Please NOTE that the php.ini file is the one for php CLI (command) not the php.ini used for apache!
My original problem was I could not get the command line version of php (yum install php or yum install php-cli) to upgrade to => php5.2.7 I was stuck on 5.1 version
I had already compiled php 5.3.3 for use with apache. So I setup a symbolic link from /usr/bin/php (the command line default) to my compiled version in /var/php5/bin/php to get the command line php reporting 5.3.3
Then I refollowed the pear install steps for phpunit
But it still needed the code coverage stuff when I ran phpunit.
So I hunted code coverage down under /var/php5/lib/php/PHP/CodeCoverage and added that to the include path in php.ini
include_path=".:/var/php5/lib/php/"
Make sure to add it to the include path without /PHP because phpunit starts at PHP/ (notice caps) looking for Code Coverage
Failed opening required 'PHP/CodeCoverage/Filter.php'
I had this problem . I was developing a zend framework site. Finally I manage to solve it by removing the zend installation and removing/commenting the include path in bath php.ini files in apache and cli. To develop site with zend we don't need to have zend installed. Insted we can copy the library to our site folder
For me dividing test's in multiple batches helped.
You can solve this issue by redefining the environment variables in PEAR.
This is how I solved the problem and I used Ubuntu 12.10
http://rkrants.blogspot.in/2013/01/installing-phpunitpear-in-ubuntu-1210.html
In short it defines the paths and then reinstalls phpunit
Ubuntu 12.04:
sudo pear channel-discover pear.symfony.com
sudo pear install --alldeps phpunit/PHPUnit
I had the same issue with Windows 8
Similar to the top answer, I needed to start the command line, however make sure to run cmd.exe as administrator. Then the two commands
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit