I am using Xdebug to remote-debug a Symfony application that is running in a VM. Xdebug works without any problems when debugging HTTP requests, but I am having a problem debugging PhpUnit tests. My CLI Xdebug configuration is:
# /etc/php5/cli/conf.d/20-xdebug.ini
zend_extension=xdebug.so
xdebug.remote_enable=1
xdebug.remote_autostart=1
xdebug.remote_host=10.0.2.2
xdebug.remote_log=/home/vagrant/xdebug-cli.log
When I run phpunit, the connection to my IDE (PhpStorm) is successfully created, and I can see that it stops on line 3 (the first executable line) of the PhpUnit PHAR, but the debugger never appears to enter my tests and does not stop on breakpoints that I place in them, even though my tests are in fact being run.
Related
I'm using PhpStorm and Vagrant to develop a Symfony project.
I configured PhpStorm to execute Behat tests with the Vagrant machine but when I try to run or debug them I got this error:
vagrant:///Users/jose/Documents/WWW/symfony_project/usr/bin/php /home/vagrant/.phpstorm_helpers/behat.php --format PhpStormBehatFormatter --config /var/www/symfony/behat.yml /var/www/symfony/features/api/brand/full_rest.feature:13
Testing started at 10:48 ...
0 scenario0 step0m0.05s (14.76Mb)
[Behat\Testwork\Tester\Exception\WrongPathsException]
No specifications found at path(s) `/var/www/symfony/features/api/brand/full_rest.feature:13`. This might be because of incorrect paths configuration in your `suites`.
Although if I execute it from the command line inside the Vagrant machine it works OK:
./vendor/bin/behat --config /var/www/symfony/behat.yml /var/www/symfony/features/api/brand/full_rest.feature:13
#brands #api
Feature: API to manage the brands
As a frontend app
.......
I've configured the PHP Interpreter with my Vagrant VM and I also think the Behat configuration is set OK: I see the Behat version, I've set the behat config path... I don't understand why the execution from PhpStorm fails.
Any ideas? Thanks in advance
This a bug in behat 3.4.0 breaks the ability to run individual tests
Try to switch back to "behat/behat": "3.3.1".
I followed the steps here (http://codeception.com/for/wordpress) and successfully installed Codeception. But when I enter codecept init wpbrowser into the terminal to get started with Codeception for Wordpress, I get the error: Command init not defined. How can I correct this?
That's the correct command, but unfortunately, even the init command won't set everything up. It's very difficult to get CodeCeption to run the first time. At WordPress-BDD.com, we have a project going to get a WP dev server going with CodeCeption via one command. This will get WordPress CodeCeption going on a clean Ubuntu machine):
Setup WordPress CodeCeption in the cloud
I have the latest PhpStorm (2016.2) and PHPUnit phar (5.5.4). For some reason when I run a PHPUnit test in my project in PhpStorm, it is adding on --teamcity to the run command, resulting in a failure:
Testing started at 12:52 PM ...
Unit test suite invoked with a path to a non-unit test: --teamcity
Process finished with exit code 1
I have no idea where this --teamcity option is coming from, it happens no matter what test I run, and even when starting from a blank configuration. I also do NOT have the TeamCity plugin installed, I don't even use TeamCity.
Here's what the full command appears as:
/usr/local/Cellar/php70/7.0.9/bin/php /Users/name/bin/phpunit-5.5.4.phar --configuration /path/to/config/my-phpunit.xml ClassNameTest /Users/name/PhpstormProjects/path/to/tests/unit/app/ClassNameTest.php --teamcity
(sensitive information swapped out)
All I want to do is get rid of this --teamcity option, everything works if I run in a separate terminal window without that option. This only recently started happening, maybe after a PhpStorm update.
tl;dr
I only could resolve this by removing the system installed phpunit instance from my system (Linux):
sudo apt remove phpunit-*
Details
Even if the setting in PhpStorm was to use composer autoloader:
for some reason it ended up using TeamCity from /usr/share/php/PHPUnit/Util/Log/TeamCity.php:
Project's local PHPUnit was 6.2 while the system default was 5.1 -> they're incompatible.
I spent half a day struggling with this. The underlying issue is switching between PHPUnit versions (6.x.x -> 4.x.x). (Happened to me by switching branches)
A click on the refresh button in the PHPUnit preferences fixes it.
(Languages & Frameworks > PHP > PHPUnit)
Make sure the version of PHPUnit it thinks you have matches the one it reports.
This --teamcity option is used by PHPStorm to output tests result.
What you're facing is an issue caused by PHP7 and an old version of PHPUnit.
Remove your PHPUnit 5 and install the latest one (currently 6.2) with composer and use PHPUnit namespaces instead.
More info on this bug: https://github.com/sebastianbergmann/phpunit/issues/2460
Problem was internal to the project. PHPUnit does not contain that error message. Sorry!
I am following the installation guidelines as described on mean.js.org Everything seemed to install fine. I have all prereqs installed. I ran npm install after cloning the github repo and then tried to run grunt and I didnt get any errors however It seems to just be stalling on the command line. Last message on the command line is the "debugger is running on port 5858" and then it just sits there.
After some time the message [nodemon] watching 51,839 files - this might cause high cpu usage. To reduce use "--watch" comes up. I am on windows 10 and have all the latest versions of node,npm,grunt and mean.js. I am running the command line as admin.
Mean.js should be running on localhost:3000 but it is not.
This is intended.
There is an application invoked by the grunt command and running in background, watching your files for changes. In default configuration: nodemon and grunt-watch.
This will execute specific tasks based on the files you edited, such as linting JS files or compiling LESS files.
The cmd will probably show something when you edit files in the projects directory.
I test my Symfony2 project with PHPUnit and behat/mink. This morning I added more behat tests to my project and all of a sudden random tests started failing. It seems like I hit a limit (memory? execution time? something else?) but I can't find anything.
Travis-ci does not fail on this http://travis-ci.org/#!/tvlooy/ReadingCorner/builds/383016
My local machine does fail (Lenovo R60, 2GB RAM, 2x 1.8Ghz CPU). I run Fedora 16 on x86, 32bit. PHP 5.3.8 (cli), with Xdebug v2.1.2, PHPUnit 3.6.2.
(edit: I just updated to PHPUnit 3.6.4 and removed Xdebug but the problem remains)
I run my Behat tests with:
$ app/console behat -e=test
=> random tests fail
When I run the tests like this:
$ for feature in 'find src/Ctors/ReadingCornerBundle/Features/ -name *.feature'; do app/console behat -e=test $feature; done
=> all tests pass
I already raised my memory_limit in php.ini to 768M but it didn't help.
I have 7 feature files with a total of 57 scenario's. Not much, nothing exotic. The files are in https://github.com/tvlooy/ReadingCorner/tree/master/src/Ctors/ReadingCornerBundle/Features
I need the tests to work on my local machine in one command because I generate code coverage from it with PHPUnit (wrapped behat features in PHPUnit).
Any clues?
#jakub_zalas blogged about a fix. See http://www.zalas.eu/fixing-failing-behat-scenarios-in-large-suites
Setting 1002: 'SET SESSION wait_timeout=30;' fixed it for me too.
Please, run your features with -v and gist the output