public function PatchInfoTest::testModuleExclusion in PatchInfo 8.2
Tests exclusion of modules from update check.
File
- tests/
src/ Functional/ PatchInfoTest.php, line 138
Class
- PatchInfoTest
- Tests functionality of PatchInfo module.
Namespace
Drupal\Tests\patchinfo\FunctionalCode
public function testModuleExclusion() {
$this
->installTestThemes();
$this
->exposeTestExtensions();
// Assert all modules listed and not excluded.
$this
->drupalLogin($this->users['patchinfo']);
$this
->drupalGet('admin/reports/updates');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('test_composer_source');
$this
->assertSession()
->pageTextContains('test_info_source');
$this
->assertSession()
->pageTextContains('test_mixed_sources');
$this
->assertSession()
->pageTextContains('test_theme_composer_source');
$this
->assertSession()
->pageTextContains('test_theme_info_source');
$this
->assertSession()
->pageTextContains('test_theme_mixed_sources');
$this
->assertModuleNotExcluded('test_composer_source');
$this
->assertModuleNotExcluded('test_info_source');
$this
->assertModuleNotExcluded('test_mixed_sources');
$this
->assertModuleNotExcluded('test_theme_composer_source');
$this
->assertModuleNotExcluded('test_theme_info_source');
$this
->assertModuleNotExcluded('test_theme_mixed_sources');
$this
->assertModuleListed('test_composer_source', '8.x-1.0');
$this
->assertModuleListed('test_info_source', '8.x-1.0');
$this
->assertModuleListed('test_mixed_sources', '8.x-1.0');
$this
->assertModuleListed('test_theme_composer_source', '8.x-1.0');
$this
->assertModuleListed('test_theme_info_source', '8.x-1.0');
$this
->assertModuleListed('test_theme_mixed_sources', '8.x-1.0');
// Assert form field to exclude modules is available.
$this
->drupalGet('/admin/reports/updates/settings');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('Exclude modules from update check');
$this
->assertSession()
->pageTextContains('Modules, which should be excluded from the update check, can be listed here. Each entry should use the machine readable name of the module and go on a separate line.');
// Exclude modules.
$edit['patchinfo_exclude_from_update_check'] = 'test_info_source' . "\r\n" . 'test_theme_mixed_sources' . "\r\n" . 'test_composer_source';
$this
->drupalPostForm('admin/reports/updates/settings', $edit, t('Save configuration'));
$this
->assertResponse(200);
$this
->assertSession()
->pageTextContains('test_info_source');
$this
->assertSession()
->pageTextContains('test_composer_source');
$this
->assertSession()
->pageTextContains('test_theme_mixed_sources');
// Assert excluded modules listed as excluded.
$this
->drupalGet('admin/reports/updates');
$this
->assertSession()
->statusCodeEquals(200);
$this
->clickLink('Check manually');
$this
->checkForMetaRefresh();
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('test_composer_source');
$this
->assertSession()
->pageTextContains('test_info_source');
$this
->assertSession()
->pageTextContains('test_mixed_sources');
$this
->assertSession()
->pageTextContains('test_theme_composer_source');
$this
->assertSession()
->pageTextContains('test_theme_info_source');
$this
->assertSession()
->pageTextContains('test_theme_mixed_sources');
$this
->assertModuleExcluded('test_composer_source');
$this
->assertModuleExcluded('test_info_source');
$this
->assertModuleExcluded('test_theme_mixed_sources');
$this
->assertModuleNotExcluded('test_mixed_sources');
$this
->assertModuleNotExcluded('test_theme_composer_source');
$this
->assertModuleNotExcluded('test_theme_info_source');
$this
->assertModuleNotListed('test_composer_source', '8.x-1.0');
$this
->assertModuleNotListed('test_info_source', '8.x-1.0');
$this
->assertModuleNotListed('test_theme_mixed_sources', '8.x-1.0');
$this
->assertModuleListed('test_mixed_sources', '8.x-1.0');
$this
->assertModuleListed('test_theme_info_source', '8.x-1.0');
$this
->assertModuleListed('test_theme_composer_source', '8.x-1.0');
// Exclude no modules.
$edit['patchinfo_exclude_from_update_check'] = NULL;
$this
->drupalPostForm('admin/reports/updates/settings', $edit, t('Save configuration'));
$this
->assertResponse(200);
$this
->assertSession()
->pageTextNotContains('test_info_source');
$this
->assertSession()
->pageTextNotContains('test_composer_source');
$this
->assertSession()
->pageTextNotContains('test_theme_mixed_sources');
// Assert all modules listed and not excluded.
$this
->drupalGet('admin/reports/updates');
$this
->assertSession()
->statusCodeEquals(200);
$this
->clickLink('Check manually');
$this
->checkForMetaRefresh();
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->pageTextContains('test_composer_source');
$this
->assertSession()
->pageTextContains('test_info_source');
$this
->assertSession()
->pageTextContains('test_mixed_sources');
$this
->assertSession()
->pageTextContains('test_theme_composer_source');
$this
->assertSession()
->pageTextContains('test_theme_info_source');
$this
->assertSession()
->pageTextContains('test_theme_mixed_sources');
$this
->assertModuleNotExcluded('test_composer_source');
$this
->assertModuleNotExcluded('test_info_source');
$this
->assertModuleNotExcluded('test_mixed_sources');
$this
->assertModuleNotExcluded('test_theme_composer_source');
$this
->assertModuleNotExcluded('test_theme_info_source');
$this
->assertModuleNotExcluded('test_theme_mixed_sources');
$this
->assertModuleListed('test_composer_source', '8.x-1.0');
$this
->assertModuleListed('test_info_source', '8.x-1.0');
$this
->assertModuleListed('test_mixed_sources', '8.x-1.0');
$this
->assertModuleListed('test_theme_composer_source', '8.x-1.0');
$this
->assertModuleListed('test_theme_info_source', '8.x-1.0');
$this
->assertModuleListed('test_theme_mixed_sources', '8.x-1.0');
}