I have tried to do a simple test of a module located on a sub site (Drupal multisite), but when the test looks for the module to activate it, it can not be found, if I move the module from the sub site to the modules folder that it is at the root of the installation if it finds it.
Is it possible to do the tests from the subsite? or do I necessarily have to move them to the root folder?
namespace Drupal\Tests\gonza_multiple\Functional;
use Drupal\Core\Url;
use Drupal\Tests\BrowserTestBase;
/**
* Simple test to ensure that main page loads with module enabled.
*
* @group gonza_multiple
*/
class LoadTest extends BrowserTestBase {
/**
* Modules to enable.
*
* @var array
*/
public static $modules = ['gonza_multiple'];
/**
* A user with permission to administer site configuration.
*
* @var \Drupal\user\UserInterface
*/
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(Url::fromRoute('<front>'));
$this->assertSession()->statusCodeEquals(200);
}
}
/modules
folder. Custom modules belong in the/modules/custom
folder. I rephrased your question's title. Please update it if it doesn't match your problem.modules/custom
folder (in the subsite), the question is how can I run functional tests from this folder that is inside the subsitemodules/custom
, since as I mentioned when I run the test it appears the message that the module was not found.webroot/sites/[domain OR default]/
. They always go underwebroot/modules
. See drupal.org/docs/8/understanding-drupal/directory-structure