I have tried connecting to pear.phpunit.de and three other similar connections using PEAR, but could not due to connection timeout, after updating connection also in PEAR, no progress.
Also, I have tried installing PHPunit without PEAR by changing #PHPBIN# in phpunit.php file and renaming it, then cannot run it as an executable file in DOS (chmod does'nt work in DOS, was written in steps, which i followed)
Is there any other simple way to get PHPUnit working in Windows under Wamp server. Please respond, all things hanging on it presently.
Try:
pear clear-cache
pear update-channels
pear install --alldeps phpunit/PHPUnit
If PHPUnit installs, but you still can't run a unit test, you might have to move the phpunit file down one directory. So if your php.exe file is in C:\wamp\bin\php\php5.2.11\ you should have something like this:
C:\wamp\bin\php\php5.2.11\phpunit.bat
C:\wamp\bin\php\php5.2.11\phpunit
C:\wamp\bin\php\php5.2.11\PEAR\phpunits
pear config-set temp_dir D:\temp
the problem is that whitespaces in the path of the temp dir prevents pear from installing the package.
Also try to empty the pear cache directory (somewhere in %appdata% local temp).
As of December 31 2014 pear.phpunit.de will be shut down, so here is another way of configuring PHPUnit on your machine:
First, make sure that you are able to execute "php --version" from Command Prompt without getting an error. If you do get an error, add the path to "php.exe" to your PATH environment variable (mine is under "C:\xampp\php" for example)
Download "phpunit.phar" from https://phar.phpunit.de/phpunit.phar
Move this file to a folder in which you wish to keep the phpunit installation (I'll use "C:\phpunit" in this example)
Create a new text file under "C:\phpunit\" and rename it to "phpunit.cmd"
Right-click and open "phpunit.cmd" in edit mode, copy>paste the following line and save the file:
#php"%~dp0\phpunit.phar" %*
At this point you should have "phpunit.cmd" and "phpunit.phar" under "C:\phpunit"
Go to your system variables and edit your PATH variable
Add this line to the very beginning of your PATH variable and don't forget the semicolon:
C:\phpunit;
Click OK to save the edit, Open Command Prompt and type "phpunit --version"
Related
So i was trying to install the XP Pen Driver for my Deco 01 v2 graphics tablet on my Linux Mint 19.2 Tina when i came to encounter the following error:
./Pentablet_Driver: /usr/lib/x86_64-linux-gnu/libQt5Core.so.5: version `Qt_5.10' not found (required by ./Pentablet_Driver)
I went on to install qt 5.10, still the same error. Others suggested to just change the path wth sudo gedit /etc/ld.so.conf.d/randomLibs.conf which didn't change a thing.
Link to drivers:
https://www.xp-pen.com/download-440.html
The manufacturer has a page describing how to set up their software on Linux with pictures. However, when following them, you end up with a folder name somewhere along the line that has spaces in it, which causes issues.
So a modified set of instructions might look like this:
Connect your XP-Pen product to the computer.
Download the Linux Beta driver from XP-Pen official website.
When the download is complete, extract the compressed folder.
Rename the extracted folder to something without spaces.
Inside the renamed folder is another compressed folder which should be extracted.
Inside the final extracted folder, ensure "Pentablet_Driver.sh" has execution permissions by right clicking on it and going to "Properties->Permissions" and verifying that "Allow executing file as program" is checked.
Open the terminal. (CTRL+ALT+T)
Type "sudo ", then drag Pentablet_Driver.sh from the file browser onto the terminal.
Type the password to complete.
Make sure that you write exactly
sudo ./Pentablet_Driver.sh
instead
sudo ./Pentablet_Driver
I had the same error until I noticed that I forgot to add .sh at the end.
I have an install.bat file and a resource folder. so long as these two files are in the same directory, if you run install.bat, it will install a my lwjgl game. so what im trying to do is make a self extracting file that when completed runs the launch.bat file. I have tried using iexpress, and got it working for the most part. i have added in all my files and such so it will extract to some directory and then i can run the install.bat file to get my program to work. thing is though, i want the exe i created with iexpress to launch install.bat when its finished. so, i tried using the option in iexpress that says it will execute a command when finished the "installation" (using quotes because its not the actual installation, just extracting the files to some directory specified by the user). when i get to the step where it says what i would like to execute during and after the "installation". during the installation i left blank. after the installation i chose the install.bat file. when i try to click next though, it tells me i must choose something for the command during the extraction. I don't have anything specific to do during the installation so i just said "echo." (without quotes). after i was done i tried running the installer. before it even prompted me for a folder to extract to, it told me that echo. could not be executed. so i went back into my installation (via a .sed file) and changed the "echo." to "pause". that didn't work either. i then read on another website that in order to run a file the way i would like to, i put the file name in both the during and after installation boxes. i tried doing that and it didn't work either. can anyone please help me?
If I understood your question correctly you will need to specify what the iexpress must do at the post install command option provided so that cmd.exe is used instead of command.com, eg:
cmd.exe /c filethatyouwanttorun.bat
Refer to the question: Create Batch file for iexpress.
You can use the SED file and then modify the self extraction directive. This will run the batch file that you wanted to run and then install the application. (If you have chosen the option to extract and run an installation in iexpress, a temp folder will be used for the extraction I suppose.)
I'm not sure I understand your question exactly but perhaps a few points would help:
If you want a "do nothing" command, you can use something like:
cmd /c echo.
There is no "command during the extraction". There's only an install program and a post install command. Both of these execute after extraction. If you only need to execute one batch file, put it in the install program line and leave the post install command blank.
You can't ask the user for an extraction path and execute a file. You can only do one or the other. (The install program could prompt the user and copy the files there, though.)
when running
phpunit
I get error
Warning: require(PHPUnit/Autoload.php): failed to open stream: No such file or directory in /usr/local/bin/phpunit on line 42
Fatal error: require(): Failed opening required 'PHPUnit/Autoload.php' (include_path='.:') in /usr/local/bin/phpunit on line 42
/usr/local/bin/phpunit displays the following on line 42:
require 'PHPUnit/Autoload.php';
any suggestions how to fix this?
Update (1):
I was missing php.ini in /etc/, so I symlinked it to read the MAMP php.ini. Now I get
php -r 'foreach (explode(":", get_include_path()) as $path) echo $path . PHP_EOL;'
.
/Applications/MAMP/bin/php/php5.3.6/lib/php
/usr/local/bin/pear
/usr/local/share/pear/PHPUnit
running
phpunit
is running but provides no output.
Any suggestions what to check next?
Update (2):
probably the root cause of this issue is related to question
MAMP PEAR configuration is pointing to local directories.
I hit a similar issue on MAC OSX Lion. I installed phpunit with the PEAR package manager, and when I try to run it I got the error as described by udo. I was able to resolve it with the following simple steps:
Get the latest php archive of pear curl http://pear.php.net/go-pear.phar > go-pear.php
Install the archive with sudo php -q go-pear.php
During installation, it detects if the include_path in your php.ini does not contain the PEAR PHP directory. You can choose to let it fix it for you automatically when given the option.
I ran into this problem when I was running phpunit.phar from my local directory, but also has PHPUnit installed as a composer dependency. Removing the PHPUnit composer dependency fixed my problem.
You must have the folder that contains the PHPUnit source files on your PHP include path. Also, PHPUnit/Autoload.php was added in 3.6, and it's possible you have an older 3.5.x source folder instead. Check the folders listed using
php -r 'foreach (explode(':', get_include_path()) as $path) echo $path . PHP_EOL;'
(or on Windows)
php -r"foreach (explode(':', get_include_path()) as $path) echo $path . PHP_EOL;"
and make sure one of them contains a PHPUnit folder with Autoload.php.
Update: Regarding your update, you probably want to remove /usr/local/share/pear/PHPUnit from the include path because you're including PHPUnit/Autoload.php which should be located in /usr/local/share/pear which is already in the include path.
To make sure PHPUnit is working first run phpunit --version so you can see the installed version. PHPUnit instantiates all of the test cases it plans to run before outputting anything. If any of your test cases cause a fatal error while loading, sometimes no output is shown at all. This is very frustrating. Start by creating the simplest test case possible that doesn't use any of your code.
class MyTest extends PHPUnit_Framework_TestCase {
function testThatItWorks() {
self::assertTrue(true);
}
}
Running this test should produce a single passing test. Try it and paste what you see in your question.
To add to the previous answers: double-check with php.ini file is being loaded and make sure you edit THAT file with additional paths. I used the following to check the loaded php.ini
php -r 'phpinfo();'
Which told me that the loaded php.ini file was /private/etc/php.ini
Then I used "which" to tell me where phpunit had been installed:
which phpunit
Then I added that path to the php.ini file, so it ended up looking like this:
;***** Added by go-pear
include_path=".:/Users/admin/pear/share/pear:/php/includes:/usr/bin:/usr/lib/php/"
Only after I had done all that did the "phpunit --version" and other commands work as expected.
It should be noted that most users who face the problem faced here must be running the command
$ phpunit
from the command prompt. when they get the above error. What Most of us fail to understand about the real issue is that the PHP used on the command prompt will mostly be very different from the one running things for you in your webserver. Personally i use lampp and even though i had correctly installed phpunit using pear successfully,i failed to realised this essential part for hours.
Remedy
- for anytime you need to run a PHP script that requires resources in the include_path, make sure that php.ini for the respective PHP binary your using is adequately furnished. case and point in my ubuntu 12.04 installation with xampp my two php binaries include
the command line one i.e php5-cli found in /etc/php5/cli/ directory
the xampp one i.e php that is used by apache to serve my pages found in /opt/lampp/etc/php.ini
Both the php.ini files must have your desirable and correct include_path declaration for you to correctly bootstrap any command line scripts and serverside(apache served scripts).
Back to our matter at hand after correctly configuring the php.ini remember to
Restart Apache so that the web server pick your changes
Restart you terminal/commandline session so that the cli prompt picks your changes
Common Mistakes that get you problems when Changing Files in Linux/*nix Systems
remember to run chwon to own the php.ini file or else you wont even manage to edit them
remember to run chmod and change the values to allow you to save your changes after which you can return everything (access control on file i.e chwon and chmod to the previous state) to the way they were and it should be ok after restarting the terminal and apache.
Good Luck
The remark of Howard Lo on Mac OSX is very useful with the remark of Sebastian Perez. Because the remark is not that nice formatted, it maybe overlooked. After the Mavericks update of OSX I ran for the second time to this issue, U decided to create this full Apple OSX solution for this problem. I have to say I have also installed MAMP-PRO with several different version of php, so I need to be very accurate.
Check if you have an php.ini installed into /private/etc. If not issue the command:
$ sudo cp /private/etc/php.ini.default /private/etc/php.ini
Get the latest php archive of pear
$ curl http://pear.php.net/go-pear.phar > go-pear.php
Install the archive with
$ sudo php -q go-pear.php
During installation, it detects if the include_path in your php.ini does not contain the PEAR PHP directory. You can choose to let it fix it for you automatically when given the option.
After these steps I had to install phpunit again using the following commands:
$ sudo pear channel-discover pear.phpunit.de
$ sudo pear channel-discover components.ez.no
$ sudo pear channel-discover pear.symfony-project.com
$ sudo pear install phpunit/PHPUnit
Many thanks to Howard Lo and Sebastian Perez.
having problems here getting phpUnderControl running on my Windows 7 machine, been searching all over the net for answers but documentation to many of the problems is just really bad...
(a.) Cruise Control is installed as a Windows service and up & running
--> location: C:\Program Files (x86)\CruiseControl
(b.) phpUnderControl is installed via Pear
--> Pear location is C:\wamp\bin\php\PEAR
(c.) Configured CruiseControl for phpUnderControl
phpuc install "C:\Program Files (x86)\CruiseControl"
(d.) now when I try to create the phpUnderControl example via:
phpuc example "C:\Program Files (x86)\CruiseControl"
I get the following error message: Missing cli tool 'phpunit', check the PATH variable
Here's what I tried to solve this problem:
(1.) I included the path to the pear PHPUnit installation in the Windows SYSTEM path variable.
--> did not help
(2.) I thought maybe phpUnit was not properly installed, so I ran:
pear install -alldeps phpunit/PHPUnit
which gave me this error:
Console_Getopt: unrecognized option -- d
I tried to re-install Console_Getopt but it is correctly installed and the current version
Can anybody help me with this ?
I don't see any way to specify allowed options for Console_Getopt and I don't even know which php script it is running to set -- d as an allowed argument...
Btw, when I run the phpUnderControl example with the -n flag (no PHPUnit support), it is working, so there is a problem with PHPUnit.
This is in response to your comment, but it will be too long to put into a comment. It doesn't answer your original question.
We started with phpUnderControl a year ago. The biggest problem is that it merges files into Cruise Control which makes updating either difficult. And we had to fix a lot of the stylesheets for our setup which would make updating even worse. This worked well enough for the past year, though there were still bugs we didn't take time to fix. The most annoying is that when you clicked on a test failure on the summary page, it wouldn't take you to the correct failure on the long list of all tests.
Anyway, I finally had enough and pushed to be given the time to migrate to Jenkins. Luckily, Manuel Pichler (PHPMD, phpUnderControl) and Sebastian Bergmann (PHPUnit) had created Template for Jenkins Jobs for PHP Projects. I was able to use my highly customized Ant script from phpuc with a few modifications with Jenkins.
It works very well. The coolest part is that it tracks the detailed results from build to build, so you can see when a test started failing and for how long. It's just really awesome. :)
I believe you mistyped the command. Try:
pear install --alldeps phpunit/PHPUnit
I solved my original problem:
I had to clear my pear cache and then run the install command again to re-install PHPUnit.
Also, it is important to either set a Windows environment variable called PHPBIN (--> /path/to/php) or to make sure the pear configuration PHP settings are correct...
--> pear config-show
Otherwise (some) packages will install and HARDCODE an incorrect php bin path into the .bat file, and if it doesn't find the PHPBIN variable it will use that... and therefore not work...
Another way to deal with this is to configure pear settings correctly and then force re-install the package, e.g.:
pear install -f --alldeps
M
i have tried installing phpunit the install itself seems fine.
i can run "phpunit" but when i try to run a test "phpunit test.php" i get
'""C:\Program' is not recognized as an internal or external command,
operable program or batch file.
PHPUnit 3.3.17 by Sebastian Bergmann.
..
Time: 0 seconds
OK (2 tests, 2 assertions)
so as u can see, phpunit runs but with something wierd 1st. and in netbeans, i get "'""C:\Program' is not recognized as an internal or external command,
operable program or batch file." and it stops
When you installed PHPUnit, it made a phpunit.bat file in your PHP installation directory. For example, mine was at C:\PHP\phpunit.bat.
Open up that file in Notepad. At the bottom you'll see a line that looks something like
set PHPBIN=".\php.exe"
Edit that to a correct absolute path, such as
set PHPBIN="C:\php.exe"
If the path has a space in it, you need to escape it with double quotes, such as
set PHPBIN="""C:\some long path\php.exe"""
Hope that helps.
I had same problem and when run this command in:
phpunit -v
I saw following error :
'pupunit' is not recognized as an internal or external command,
operable program or batch file.
I copy the phpunit.bat in system32 folder( C:\Windows\System32 ) and it work.
This is a bug in PHPUnit. It was fixed in version 3.4.
Just upgrade to the newest version:
pear channel-update
pear install phpunit/PHPunit
and it should work correctly.
This looks like a DOS 8.3 notation error.
You should change the path-name in phpunit.bat to the shorthand notation.
You can find this notation by browsing in the DOS-prompt with the following command:
dir /o:e /p /x
(Or use the double quotes like Nicholas mentioned)
Here "C:\program.." is the issue. While running phpunit, it is not able to recognize it.
So You can refer the link Installing PHPUnit On Windows for cross checking PHPUnit installation.
It should help you.