Drupal testing with Vagrant as a development environment
At DrupalCon I was sprinting on tests with cossovich and Pat Redmond I was having awful trouble to get any test at all to run. There were a number of things that could have caused this as I had to go up to Precise (Ubuntu 12.0.4LTS) to get PHP5.3.3 which Drupal 8 requires.
After some hours (!?!) of trying to find out what causes a
simplexml_import_dom(Object) Drupal\simpletest\WebTestBase->parse() Drupal\simpletest\WebTestBase->drupalPost('user', Array, 'Log in')
simplexml_import_dom(): Invalid Nodetype to import
I realised that PHP's Curl was trying to use my VM host's concept of the URI (http://local.example.com:7841) which simply didn't exist inside the VM client. I imagine that an .htaccess with Authorisation might cause the same symptom.
curl http://local.example.com:7841/user
curl: (7) couldn't connect to host
The fix.
echo "127.0.0.1 local.example.com"
So now this should work (note the missing port).
curl http://local.example.com/user
[...]
Then add the port configuration to Apache.
grep 7841 /etc/apache2/ports.conf
Listen 7841
grep -ni 7841 /etc/apache2/sites-enabled/25-local.example.com.conf
7:NameVirtualHost *:7841
9:<VirtualHost *:80 *:7841>
After that Curl starts working and Drupal stops failing on $this->drupalGet() every time.