Custom PHPUnit script that enables NetBeans to run tests on a remote host. Mainly developed to make Vagrant environments more convenient to work with, but it can easily be extended to communicate with other remote hosts.
The package should be installed using composer:
compose require foogile/nb-remote-phpunit
Subsequent sections desribe more specific installations.
Default Vagrant test scripts can be installed using the following commands:
vagrant ssh;
cd /vagrant
compose require foogile/nb-remote-phpunit
See "Custom test runner".
Activate remote execution in NetBeans 8 as follows:
- Right click your project and click "Properties"
- Navigate to "Testing" > "PHPUnit"
- Check "Use Custom PHPUnit Script" and point "PHPUnit Script"
to
VAGRANT_PATH/vendor/foogile/nb-remote-phpunit/netbeans/phpunit-vagrant.php
, whereVAGRANT_PATH
is an absolute path to your vagrant folder. - Run tests as you would normally do
You can run tests on custom remote hosts by implementing a custom remote host and providing a custom NetBeans PHPUnit script.
For example:
class SSHRemoteHost implements RemoteHostInterface
{
public public put($localPath, $remotePath)
{
exec("scp $src myhost.com:$dst");
}
public function get($remotePath, $localpath)
{
exec("scp myhost.com:$remotePath $localPath");
}
public function delete($remotePath)
{
exec("ssh myhost.com 'rm $remotePath'");
}
public function exec($command)
{
exec("ssh myhost.com '$command'");
}
See netbeans/phpunit-vagrant.php
for an example of a custom NetBeans
PHPUnit script.
Pull requests are welcome :)
Based on the blog post Running PHPUnit tests on a VM, from NetBeans.