protected function InstallTestTrait::moduleInstall in Automatic Updates 8
Helper method that uses Drupal's module page to install a module.
2 calls to InstallTestTrait::moduleInstall()
- InPlaceUpdateTest::testContribUpdate in tests/
src/ Build/ InPlaceUpdateTest.php - @covers ::update @dataProvider contribProjectsProvider
- InstallTestTrait::themeInstall in tests/
src/ Traits/ InstallTestTrait.php - Helper method that uses Drupal's theme page to install a theme.
File
- tests/
src/ Traits/ InstallTestTrait.php, line 15
Class
- InstallTestTrait
- Provides common functionality for automatic update test classes.
Namespace
Drupal\Tests\automatic_updates\TraitsCode
protected function moduleInstall($module_name) {
$assert = $this
->visit('/admin/modules')
->assertSession();
$field = Html::getClass("edit-modules {$module_name} enable");
// No need to install a module if it is already install.
if ($this
->getMink()
->getSession()
->getPage()
->findField($field)
->isChecked()) {
return;
}
$assert
->fieldExists($field)
->check();
$session = $this
->getMink()
->getSession();
$session
->getPage()
->findButton('Install')
->submit();
$assert
->fieldExists($field)
->isChecked();
$assert
->statusCodeEquals(200);
}