Skip to content

Instantly share code, notes, and snippets.

Created May 31, 2016 09:35
What would you like to do?
Run Drupal 8 web tests without installing Drupal
  1. Create a MySQL database.
  2. Create a user that has access to that database.
  3. Make sure that you have the PDO_MySQL PHP library (otherwise you will get an error because it is missing).
  4. Run the following script.
  5. Once tests complete, we need to stop PHP's web server.

Note: there seem to be some issues with PHP's built-in web server. Please report them here

# Next, download core and run web tests.
wget -q -O - | tar xz
mv my_module drupal-8.1.x-dev/modules/
cd drupal-8.1.x-dev
# You need to download the module's dependencies. Perhaps Composer can do this?
drush dl ctools
# Start PHP's built-in web server in the background.
nohup php -S localhost:9000 > phpd.log 2>&1 &
# Run tests.
php ./core/scripts/ --sqlite /tmp/test.sqlite --dburl mysql://user:pass@localhost/db_name --url http://localhost:9000 --module my_module
Copy link

Nice! Why do you need mysql at all if you're using --sqlite?

Copy link

I think that there is still something in core that requires it. It is explained at

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment