Configuration for functional tests

Before writing our functional tests we need to turn back to our phpunit.xml file and change some environment variables. Apart from the SIMPLETEST_DB variable we adjusted earlier, we also have the SIMPLETEST_BASE_URL and BROWSERTEST_OUTPUT_DIRECTORY. The first is used to know where can the application be accessed in the browser. The latter is the directory where output data can be saved by PHPUnit and needs to be an absolute local path (for example a folder in the local files folder):

/var/www/sites/default/files/browser-output 

Moreover, make sure the user running the test has permissions to write into the sites/simpletest folder as that is where the virtual file system is created for each test. The easiest ...

Get Drupal 8 Module Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.