My sites directory looks like this:
default, site1, site2, site3.
The default directory is empty. I want to run tests against my site1 database. So I have put its details in phpunit.xml
Here is my phpunit.xml set up.
<php> <!-- Set error reporting to E_ALL. --> <ini name="error_reporting" value="32767"/> <!-- Do not limit the amount of memory tests take to run. --> <ini name="memory_limit" value="-1"/> <!-- Example SIMPLETEST_BASE_URL value: http://localhost --> <env name="SIMPLETEST_BASE_URL" value="http://d8.site1.dev"/> <!-- Example SIMPLETEST_DB value: mysql://username:password@localhost/databasename#table_prefix --> <env name="SIMPLETEST_DB" value="mysql://site1:site1@localhost/site1"/> <!-- Example BROWSERTEST_OUTPUT_DIRECTORY value: /path/to/webroot/sites/simpletest/browser_output --> <env name="BROWSERTEST_OUTPUT_DIRECTORY" value=""/> </php>
And then my actual test:
<?php namespace DrupalTestsmy_moduleFunctional; use DrupalCoreUrl; use DrupalTestsBrowserTestBase; /** * Simple test to ensure that main page loads with module enabled. * * @group my_module_tests */ class LoadTest extends BrowserTestBase { /** * Modules to enable. * * @var array */ public static $modules = ['my_module']; /** * A user with permission to administer site configuration. * * @var DrupaluserUserInterface */ protected $user; /** * {@inheritdoc} */ protected function setUp() { parent::setUp(); $this->user = $this->drupalCreateUser(['administer site configuration']); $this->drupalLogin($this->user); } /** * Tests that the home page loads with a 200 response. */ public function testLoad() { $this->drupalGet('node/add/product_list_page'); $this->assertResponse(200); } }
Then from the core directory of Drupal I run:
../../vendor/bin/phpunit --group my_module_group
Then I get this error:
1) DrupalTestsmy_moduleFunctionalLoadTest::testLoad copy(/var/www/site/docroot/sites/default/default.settings.php): failed to open stream: No such file or directory
Why is it looking in my empty default directory and not site1 for this file?
Sponsored by SupremePR