Hi there,
I'm not experienced with Behat but am trying to follow the Quick start instructions in the Acceptance testing article in the dev docs as best I can.
I first tried to run through these steps using AMPPS on my Mac but ran into the dbconnectionfailed error I'll describe in a moment, so to exclude anything related to my confuguration, I opened up a VM running a fresh install of OS X 10.9.4 and did the following:
- Installed Firefox
- Installed JDK 8u82
- Installed Moodle4Mac 3.0.3
- Launched MAMP and logged into Moodle to confirm the installation was working
- Followed the Quick start instructions from dev docs
- Opened a CLI
- cd /Applications/MAMP/htdocs/moodle30
- Added these lines to config.php:
$CFG->behat_prefix = 'b_';
$CFG->behat_dataroot = '/Applications/MAMP/data/behat30';
$CFG->behat_wwwroot = 'http://127.0.0.1:8888/moodle30'; // must be different from wwwroot - Skipped step 4 as it seemed appropriate according to danpoltawski's simplified instructions
- php admin/tool/behat/cli/init.php
This went through the process of installing everything, an OS X update prompt came up to install command line tools which I accepted
Then, I get the same dbconnectionfailed error I received in my earlier testing. I ran the init.php command again and this is the full output including the error:
Joshuas-MacBook-Pro:moodle30 jtc$ php admin/tool/behat/cli/init.php You are already using composer version 1.0.3 (stable channel). Loading composer repositories with package information Installing dependencies (including require-dev) from lock file Nothing to install or update Generating autoload files Default exception handler: <p>Error: Database connection failed</p> <p>It is possible that the database is overloaded or otherwise not running properly.</p> <p>The site administrator should also check that the database details have been correctly specified in config.php</p> Debug: No such file or directory Error code: dbconnectionfailed * line 449 of /lib/dml/mysqli_native_moodle_database.php: dml_connection_exception thrown * line 344 of /lib/dmllib.php: call to mysqli_native_moodle_database->connect() * line 615 of /lib/setup.php: call to setup_DB() * line 112 of /admin/tool/behat/cli/util_single_run.php: call to require() !!! <p>Error: Database connection failed</p> <p>It is possible that the database is overloaded or otherwise not running properly.</p> <p>The site administrator should also check that the database details have been correctly specified in config.php</p> !!! Debug info: No such file or directory Error code: dbconnectionfailed Stack trace: * line 449 of /lib/dml/mysqli_native_moodle_database.php: dml_connection_exception thrown * line 344 of /lib/dmllib.php: call to mysqli_native_moodle_database->connect() * line 615 of /lib/setup.php: call to setup_DB() * line 112 of /admin/tool/behat/cli/util_single_run.php: call to require()
The actual Moodle installation has no issues with the database as evidenced by the fact I can login, see my user details, etc without throwing an error.
Any guidance on where to start troubleshooting this would be much appreciated! Thanks.