Running Automated Tests¶
Some of islandora's dependencies include deprecated code. This will cause the tests to
fail when run through the GUI. To avoid this, use the command-line method with the
To run automated tests via a web browser, you can to Admin > Configuration > Testing (http://localhost:8000/admin/config/development/testing) in the admin toolbar. From there you can browse and search for tests, select the ones you'd like to run. Pressing the blue "Run Tests" button will execute all tests you've selected in a batch and then display the results.
Running tests from the command line utilizes the test runner script provided by Drupal core.
web directory, the full command to run is
vagrant@claw:/var/www/html/drupal/web$ sudo -u www-data php core/scripts/run-tests.sh \ --suppress-deprecations \ --url http://127.0.0.1:8000 \ --verbose \ --php `which php` \ --module "islandora"
Then wait - running these tests may take a while.
Let's unpack it:
- You need to run this as the apache user for filesystem access, hence
sudo -u www-data
- Despite having a
.shextension, you run the command with php:
--suppress-deprecationstells the script not to count deprecation warnings as test failures
--url http://127.0.0.1:8000tells the script what base url to use for functional tests. If you are using a port other than 8000, you'll need to make sure to update this accordingly
--verboseis optional, but useful if you want more feedback from failures
--php `which php`tells the script where to find the php executable to use
--module "islandora"tells the script to run all tests from the
If you want to run just a single class instead of a whole module's worth, you can use the
--class option instead of
--class option takes the fully namespaced class name as an argument. For example, to run just the
vagrant@claw:/var/www/html/drupal/web$ sudo -u www-data php core/scripts/run-tests.sh \ --suppress-deprecations \ --url http://127.0.0.1:8000 \ --verbose \ --php `which php` \ --class "Drupal\Tests\islandora\Functional\AddMediaToNodeTest"