Skip to content

Instantly share code, notes, and snippets.

@juampynr
Created May 31, 2016 09:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save juampynr/36499985530b435a40de2d3464a631ea to your computer and use it in GitHub Desktop.
Save juampynr/36499985530b435a40de2d3464a631ea to your computer and use it in GitHub Desktop.
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 https://www.drupal.org/node/1543858.

# Next, download core and run web tests.
wget -q -O - http://ftp.drupal.org/files/projects/drupal-8.1.x-dev.tar.gz | 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/run-tests.sh --sqlite /tmp/test.sqlite --dburl mysql://user:pass@localhost/db_name --url http://localhost:9000 --module my_module
@juampynr
Copy link
Author

I think that there is still something in core that requires it. It is explained at https://www.drupal.org/node/645286#d8-no-install.

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