5 * Run the functional tests:
7 export SIMPLETEST_DB='mysql://root@localhost/dev_d8'
8 export SIMPLETEST_BASE_URL='http://d8.dev'
9 ./vendor/bin/phpunit -c core --testsuite functional
12 Note: functional tests have to be invoked with a user in the same group as the
13 web server user. You can either configure Apache (or nginx) to run as your own
14 system user or run tests as a privileged user instead.
16 To develop locally, a straightforward - but also less secure - approach is to
17 run tests as your own system user. To achieve that, change the default Apache
18 user to run as your system user. Typically, you'd need to modify
19 `/etc/apache2/envvars` on Linux or `/etc/apache2/httpd.conf` on Mac.
24 export APACHE_RUN_USER=<your-user>
25 export APACHE_RUN_GROUP=<your-group>
35 ## Functional javascript tests
37 Javascript tests use the Selenium2Driver which allows you to control a
38 big range of browsers. By default Drupal uses chromedriver to run tests.
39 For help installing and starting selenium, see http://mink.behat.org/en/latest/drivers/selenium2.html
41 * Make sure you have a recent version of chrome installed
43 * Install selenium-server-standalone and chromedriver
48 brew install selenium-server-standalone
49 brew install chromedriver
52 * Before running tests make sure that selenium-server is running
54 selenium-server -port 4444
57 * Set the correct driver args and run the tests:
59 export MINK_DRIVER_ARGS_WEBDRIVER='["chrome", null, "http://localhost:4444/wd/hub"]'
60 ./vendor/bin/phpunit -c core --testsuite functional-javascript
63 * It is possible to use alternate browsers if the required dependencies are
64 installed. For example to use Firefox:
67 export MINK_DRIVER_ARGS_WEBDRIVER='["firefox", null, "http://localhost:4444/wd/hub"]'
68 ./vendor/bin/phpunit -c core --testsuite functional-javascript
71 * To force all BrowserTestBase (including legacy JavascriptTestBase) tests to use
75 export MINK_DRIVER_CLASS='Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver'
76 ./vendor/bin/phpunit -c core --testsuite functional-javascript
79 ## Running legacy javascript tests
81 Older javascript test may use the PhantomJSDriver. To run these tests you will
82 have to install and start PhantomJS.
86 phantomjs --ssl-protocol=any --ignore-ssl-errors=true ./vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 >> /dev/null &
89 * Then you can run the test:
91 ./vendor/bin/phpunit -c core --testsuite functional-javascript
94 ## Running tests with a different user
96 If the default user is e.g. `www-data`, the above functional tests will have to
97 be invoked with sudo instead:
100 export SIMPLETEST_DB='mysql://root@localhost/dev_d8'
101 export SIMPLETEST_BASE_URL='http://d8.dev'
102 sudo -u www-data -E ./vendor/bin/phpunit -c core --testsuite functional
103 sudo -u www-data -E ./vendor/bin/phpunit -c core --testsuite functional-javascript