0

Current State:

I'm currently working on running PHPUnit Browser tests in Drupal, and I've successfully configured my phpunit.xml file with these environment variables:

<env name="SIMPLETEST_BASE_URL" value="https://site1.com"/>
<env name="SIMPLETEST_DB" value="mysql://db_sitte1:db_sitte1@db_sitte1"/>

These settings work well when I run my phpunit.

Problem:

Now, I'm working on a multisite project involving multiple sites (site1, site2, site3, site4), and I need to test the functionality on all four of these sites.

Question:

How can I dynamically change these two variables in my phpunit.xml file according to the testing code to accommodate a multisite project? like this:

<env name="SIMPLETEST_BASE_URL" value="{DYNAMIC_URL}"/>
<env name="SIMPLETEST_DB" value="{DYNAMIC_DB_CREDENTIALS}"/>

Or is there a way to alter this 2 varaible : SIMPLETEST_BASE_URL and SIMPLETEST_DB insidethe setup() method ?

1 Answer 1

0
  1. Create a separate phpunit.xml file for each site.
  2. Use phpunit's --configuration flag to specify a configuration file at runtime.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.