public function SettingsTest::testInstallModule in Search Autocomplete 8
Same name and namespace in other branches
- 2.x src/Tests/SettingsTest.php \Drupal\search_autocomplete\Tests\SettingsTest::testInstallModule()
Check that Search Autocomplete module installs properly.
1) Check the default settings value : configs are activated, admin_helper is FALSE
2) Desactivate all available configurations and reverse settings.
3) Check that all default configurations are desactivate, and settings are toogled.
File
- src/
Tests/ SettingsTest.php, line 46
Class
- SettingsTest
- Test search_autocomplete settings.
Namespace
Drupal\search_autocomplete\TestsCode
public function testInstallModule() {
// Open admin UI.
$this
->drupalGet('/admin/config/search/search_autocomplete');
// ----------------------------------------------------------------------
// 1) Check the default settings value : configs are activated,
// admin_helper is FALSE.
$this
->assertFieldChecked('edit-configs-search-block-enabled', 'Default config search_block is activated.');
$this
->assertNoFieldChecked('edit-admin-helper', 'Admin helper tool is disabled.');
// ----------------------------------------------------------------------
// 2) Desactivate all available configurations and reverse settings.
$edit = [
'configs[search_block][enabled]' => FALSE,
'admin_helper' => TRUE,
];
$this
->drupalPostForm(NULL, $edit, 'Save changes');
// 3) Check that all default configurations are desactivate,
// and settings are toogled.
$this
->assertNoFieldChecked('edit-configs-search-block-enabled', 'Default config search_block is disabled.');
$this
->assertFieldChecked('edit-admin-helper', 'Admin helper tool is activated.');
}