protected function ModulesFormTest::assertModuleCheckboxState in farmOS 2.x
Helper function to assert the state of module checkboxes.
Parameters
string $type: The module type. Core or contrib.
string $module: The module name.
bool $checked: Boolean if the checkbox should be checked. Defaults to FALSE.
bool $disabled: Boolean if the checkbox should be disabled. Defaults to FALSE.
2 calls to ModulesFormTest::assertModuleCheckboxState()
- ModulesFormTest::installModules in modules/
core/ settings/ tests/ src/ Functional/ ModulesFormTest.php - Helper function to test installing a list of modules.
- ModulesFormTest::testInstallFunctionality in modules/
core/ settings/ tests/ src/ Functional/ ModulesFormTest.php - Tests the install functionality of the module settings form.
File
- modules/
core/ settings/ tests/ src/ Functional/ ModulesFormTest.php, line 93
Class
- ModulesFormTest
- Tests installing modules via the module settings form.
Namespace
Drupal\Tests\farm_settings\FunctionalCode
protected function assertModuleCheckboxState(string $type, string $module, bool $checked = FALSE, bool $disabled = FALSE) {
$page = $this
->getSession()
->getPage();
$field_name = $type . "[modules][{$module}]";
$checkbox = $page
->findField($field_name);
$this
->assertNotEmpty($checkbox, "The checkbox for {$module} exists.");
$this
->assertEquals($checked, $checkbox
->isChecked(), "The {$module} checkbox is " . $checked ? '' : 'not ' . 'checked.');
$this
->assertEquals($disabled, $checkbox
->hasAttribute('disabled'), "The {$module} checkbox is disabled: {$disabled}");
}