Ok. So I found out that the problem relates to that I'm running the tests on my localhost while the webserver runs in a vagrant box. I found out by changing the call to the URI like this instead:
public function testThatModuleApiEndpointExists()
{
$response = $this->call('GET', '/modules');
var_dump($response);
}
which gave me the clue on:
Starting test 'ModulesTest::testThatModuleApiEndpointExists'.
object(Dingo\Api\Http\Response)#350 (9) {
["binding":protected]=>
NULL
["original"]=>
array(4) {
["message"]=>
string(41) "SQLSTATE[HY000] [2002] Connection refused"
["code"]=>
int(2002)
["status_code"]=>
int(500)
["debug"]=>
array(4) {
["line"]=>
int(55)
["file"]=>
string(112) "/Users/developer/www/gar.dev/api/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php"
["class"]=>
string(12) "PDOException"
["trace"]=>
array(68) {
[0]=>
string(189) "#0 /Users/developer/www/gar.dev/api/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php(55): PDO->__construct('mysql:host=127....', 'homestead', 'secret', Array)"
[1]=>
After updating the .env to DB_HOST=192.168.10.10 all is good.
Hope that can help someone else...