public function SimplenewsUninstallTest::testUninstall in Simplenews 3.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/SimplenewsUninstallTest.php \Drupal\Tests\simplenews\Functional\SimplenewsUninstallTest::testUninstall()
Tests that Simplenews module can be uninstalled.
File
- tests/
src/ Functional/ SimplenewsUninstallTest.php, line 36
Class
- SimplenewsUninstallTest
- Tests that Simplenews module can be uninstalled.
Namespace
Drupal\Tests\simplenews\FunctionalCode
public function testUninstall() {
// Add a newsletter issue.
$this
->drupalCreateNode([
'type' => 'simplenews_issue',
'label' => $this
->randomMachineName(),
])
->save();
// Delete Simplenews data.
$this
->drupalGet('admin/config/services/simplenews/settings/uninstall');
$this
->submitForm([], 'Delete Simplenews data');
$this
->assertText(t('Simplenews data has been deleted.'));
// Uninstall the module.
$this
->drupalGet('admin/modules/uninstall');
$this
->submitForm([
'uninstall[simplenews]' => TRUE,
], 'Uninstall');
$this
->submitForm([], t('Uninstall'));
$this
->assertText(t('The selected modules have been uninstalled.'));
$this
->assertNoText(t('Simplenews'));
// Make sure that the module can be installed again.
$this
->drupalGet('admin/modules');
$this
->submitForm([
'modules[simplenews][enable]' => TRUE,
], 'Install');
$this
->assertText('Module Simplenews has been enabled.');
}