PHP Unit Skeleton Generator not working - phpunit

I am trying to install PhpUnit skeleton generator. I am also using PhpStorm 5.0.
I get the feeling that it does not install itself properly because when I try to run the skeleton generator it gives me an error saying:
'phpunit-skelgen.bat' not found at...
Also, it seems that pear does install it in my pear folder under the SebastianBergmann\PHPUnit\SkeletonGenerator folder, which seems odd since I would have expected it in the main pear folder.
Any ideas?

Problem solved.
That's because the phpunit-skelgen.bat file is actually installed in the php folder, not in pear. So just search for it in the root of the php installation folder.

Related

PhpStorm with PHPUnit: PHP_CodeCoverage_Filter not found

I am trying to use PHPUnit in PhpStorm (on a Mac). Therefore I tried adding the pear path and phpunit path to the include path of PhpStorm (the ones I found through which pear on the command line) - it tells me that phpunit was not found.
I also tried to use PHPUnit with the custom autoloader generated by composer (the phpunit package is installed), I then receive another error:
Fatal error: Class 'PHP_CodeCoverage_Filter' not found
If I run phpunit on the console normally everything works:
phpunit --bootstrap vendor/autoload.php tests/*Test.php
What am I doing wrong?
The problem was that I used the default php interpreter which phpStorm suggested to me. This was version PHP 5.5 though and not the 5.6 version in my terminal.
After changing the interpreter to an up-to-date php version (5.6 or 7.0) it worked with the PHAR Option.

How to install libraries with pear when no release is available

This is not the first time I experience something like that. This time it was with PHPunit.
I wanted to install the library using pear..
pear config-set auto_discover 1
pear install pear.phpunit.de/PHPUnit
The installation fails saying :
No releases available for package "pear.phpunit.de/PHPUnit"
What can I do ?
Thank you
Note :
pear upgrade says that I have the latest version
pear update-channels says that I am up to date
Note2 : I am at work so behing a proxy
Note3: using windows OS
In Windows Explorer, go to your WAMP PHP installation folder (default will be C:\wamp\bin\php\php[version]).
Create a new directory called “PEAR” here.
Download the PEAR phar installer https://phar.phpunit.de/phpunit.phar and place it in the new directory above.
Fire up a cmd window (Start and search for “cmd”) as administrator
Change to your new directory
(default command will be “cd C:\wamp\bin\php\php[version]\PEAR”)
Run the following command: “php go-pear.phar”.
The first thing that the installer will ask is whether you are installing a system wide copy of PEAR. Since you are probably working on a development machine, either is fine. Just press enter to install system wide.
Next, the installer will show you a bunch of paths that it automatically calculated by using it’s current location on your disc.
You mentioned you are behind a proxy, you may then need to set it explicitly, with something like the following:
$ pear config-set http_proxy http://username:password#proxy.example.com:80
I found it in another post. the cache has to be cleared.
pear clear-cache

Running PHPUnit from CMD in Windows

I've installed PHPUnit and everything seems to be working fine as when I run phpunit from the root php directory C:\wamp\bin\php\php5.4.16 it runs as expected.
However, the problem I am having is running PHPUnit from elsewhere within the command line, so I cannot run any tests because of this. I get the error
phpunit' is not recognized as an internal or external
command, operable program or batch file.
My path is set correctly C:\wamp\bin\php\php5.4.16 which is where php.exe is installed.
I have also tried re-installing, and am running version 3.7.24.
Anyone have any tips on what I may be doing wrong?
PHPUnit is not set in the PATH global variable. Try installing PHPUnit using PEAR. For win7 use this tutorial: http://designbyjeeba.blogspot.ro/2012/12/easy-way-to-install-pear-and-phpunit-in.html
If PEAR doesn't find any package to install (when trying to install anything using it) clear PEAR's cache:
pear clear-cache
I dont know the way you installed it, but i did it this way and it works fine for me.
Also i recommend installing DBUnit and PHPUnit selenium. Use the following commands:
pear install phpunit/PHPUnit_Selenium
pear install phpunit/DbUnit
For Linux use the commands given by PHP at the following link:
http://phpunit.de/manual/3.7/en/installation.html

Phpunit 3.6 does not find the unit test

I get Cannot open file "FooTest.php"
I am using PHP 5.4.0 and PHPUnit 3.6 on Windows
I have traced the issue back to PHPUnit\Util\Filesystem.php when it calls get_include_path which contains "." and the location to pear.
For some reason it doesn't resolve . to where the tests are as it resolves it locally to the PHPUnit location.
How do I get phpunit to recognise the location of the tests.
First make also sure your PHPUnit installation and all dependencies are up-to-date:
pear upgrade phpunit/PHPUnit --alldeps
In case your pear installation is messed up you can also obtain it from the github repository.
Depending on how your project and enviroment is set up make sure your current directory is your projects directory.
cd /your/projects/home/directory/
The common syntax to invoke phpunit is either
phpunit [switches] <your_unit_test.php>
or
phpunit [switches] <directory>
So, basically in case your tests are stored within directory YourUnitTests the easiest way to start it would be just to use
phpunit YourUnitTests

Symfony 2.0 bundle installation

So I am a new to doctrine, but I am not able to install a bundle at all. I am following the guide, but the "error" which I am getting is very unusual.
Anyhow, I add this lines into deps file:
[FOSRestBundle]
git=http://github.com/FriendsOfSymfony/FOSRestBundle.git
target=bundles/FOS/RestBundle
Then I do:
./bin/vendors install
And I get:
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/20090626+lfs/sqlite.so' - /usr/lib/php5/20090626+lfs/sqlite.so: cannot open shared object file: No such file or directory in Unknown on line 0
Your project seems to be based on a Standard Edition that includes vendors.
Try to run ./bin/vendors install --reinstall
So on this standard way I am not able to install it at all. Can somebody explain me what is the problem, because to me it looks like, the symfony vendors script doesnt recognize changes in deps file at all.
This happens when you've downloaded the Symfony2 Standard Edition from the website. The vendor install script checks to see if the vendor directories are git repositories, and if not, will throw this error. You can fix the situation in one of two ways:
you can either run the command that it suggests: php bin/vendors install --reinstall
or, you can remove the vendors directory, then run php bin/vendors install, which amounts to about the same thing
No need to install that. Just follow the steps in the url : http://mmoreramerino.github.com/GearmanBundle/installation.html

Resources