I'm attempting to debug a unit test for a WordPress plugin. The unit test uses wordpress-test (and PHPUnit). However, wordpress-test:
- calls
system(php ...)
- the new external PHP process attempts to connect to the same debugger,
- but the debugger is already busy
- so both PHP processes hang.
— How can I prevent this?
Details / clarifications:
Initially, when I debug my unit test (like so:$ phpunit --verbose --debug
), then phpunit connects to Netbeans on port 9000 and everything works fine. After a while, however, wordpress-test runs a certain bin/install.php
in order to setup a fresh WordPress database for the "unit" tests to use.
But wordpress-test runs bin/install.php
via a system("php ...")
call. And then the external php process attempts to connect to the Netbeans debugger again! This blocks, because the debugger is already busy — the first PHP process is open in the debugger, running the system(...)
call.
Issue 1
Why does the second PHP process attempt to connect to the debugger, although I've specified no debug flags? The process is created via this PHP call and there are no debug flags, here is the argument to the system
call:
php '/var/www/wordpress/wp-content/plugins/my-plugin/wordpress-tests/bin/install.php' '/var/www/wordpress/wp-content/plugins/my-plugin/wordpress-tests/unittests-config.php'
Issue 2
How can I stop the external PHP process from connecting to the debugger?
(Removing the external system call completely, and including /bin/install.php
directly instead, seems complicated — there are errors like Cannot redeclare [some-function])
(By the way, if you'd like to use wordpress-test, then see this SO answer.)