How do I set up Netbeans to work with Phpunit in a virtualized environment?

Asked

Viewed 2,094 times

4

I use Netbeans 7.4 for programming on my Mac. And to not have to install PHP and Phpunit, I would like to run Phpunit installed on a virtual machine that has an entire integration environment already configured. This practice has been widely used, and indicated on sites like PHP The Right Way.

To use Phpunit integrated with the Netbeans IDE, you need to indicate a file that will be used to execute Phpunit commands, either the Phpunit executable itself or a script. To indicate the file, you need it to be on the same machine where Netbeans is installed in order for it to be able to access it.

So, how do I configure Netbeans to run Phpunit that is installed on the virtual machine?

Searching, I found some tutorials that show scripts that run Phpunit on the virtual machine using SSH or the Virtual Box virtual machine control tool.

This apparently it would work, but it is for Windows and requires a specific path from a test folder. I own several projects in Netbeans, if I fixed a test folder in this script, I could use Phpunit for just one project.

Another problem I have when creating a script for Netbeans to run Phpunit is that the local paths are different from the virtualized server. I found other solutions using SSH, but the connection via SSH requires password, which makes it difficult to use the SSH command.

The environment of development

  • Macbook with Mavericks OS X 10.9.1
  • Virtualized Server in Virtual Box 4.3.6 with Ubuntu Server 12 using Bridge Adapter
  • Apache, PHP and Mysql, Xdebug, Phpunit and other continuous integration tools installed on the virtualized server
  • The "~/Sites" folder is shared with the virtual machine and mounted in "/var/www". So what I change in the folder "~/Sites" and the changes are available for the virtual machine to run.
  • 1

    Hello. Could you explain your problem better? What does not work in the tutorial?

  • The tutorial is for windows, and the bat file has the fixed configuration of the project, indicating the bootstrap file and test path. This prevents me from testing more than one open project in my netbeans using the same script.

  • 2

    First of all, you need to tell your post what the problem is, because you just say you’re trying to set up the environment to run Phpunit using Netbeans (you didn’t report version), and a virtual machine that does PHP work. Perhaps it is more interesting to use the apache+php server that already comes with OSX, I do this myself is not difficult. Everything is in /private/etc/apache2 and in /private/etc you find a php.ini.default file just make a copy to the same location without the . default that you can use for php.ini settings.

  • 1

    The use of the virtual machine has several advantages as you can read on this link http://eltonminetto.net/blog/2012/04/02/usando-o-vagrant-para-cria-maquinas-virtuais-para-development -e-testing/ .

  • 1

    That’s exactly what I described. In google searches if you search "netbeans virtualbox Xdebug" you will find a lot, or even looking for Vagrant. What I don’t want is to have to install php on my machine just to run phpunit. In the virtual machine already has an integration server continues all configured.

  • This question is being discussed at the goal: http://meta.pt.stackoverflow.com/questions/719/o-que-fazer-quando-questiona-e-posta-suspensao-por-usuarios-que-nao-possue.

  • 1

    If you have the public key of your machine on the virtual server, you can use SSH without having to enter the password, see http://www.vivaolinux.com.br/dica/SH-password

Show 2 more comments

1 answer

3

You need to configure the file well phpunit-remote.sh and the network/network of the virtual machine.

The virtual machine network is in NAT or Bridge Adapter?

I recommend using Bridged Adapter for the machine to have a ip own within the network.

Then it is to know which is the ip of the machine on the network with ifconfig

And configure in the file .sh

[email protected]

more I don’t know.

  • is in bridge, but ssh can not pass the direct connection password via command line. or has?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.