SimplenewsUninstallTest.php in Simplenews 8.2
File
tests/src/Functional/SimplenewsUninstallTest.php
View source
<?php
namespace Drupal\Tests\simplenews\Functional;
class SimplenewsUninstallTest extends SimplenewsTestBase {
protected function setUp() {
parent::setUp();
\Drupal::service('module_installer')
->uninstall([
'simplenews_test',
]);
$admin_user = $this
->drupalCreateUser([
'administer nodes',
'administer simplenews settings',
'administer simplenews subscriptions',
'create simplenews_issue content',
'administer modules',
]);
$this
->drupalLogin($admin_user);
$this
->setUpSubscribers(1);
}
public function testUninstall() {
$this
->drupalCreateNode([
'type' => 'simplenews_issue',
'label' => $this
->randomMachineName(),
])
->save();
$this
->drupalPostForm('admin/config/services/simplenews/settings/uninstall', [], t('Delete Simplenews data'));
$this
->assertText(t('Simplenews data has been deleted.'));
$this
->drupalPostForm('admin/modules/uninstall', [
'uninstall[simplenews]' => TRUE,
], t('Uninstall'));
$this
->drupalPostForm(NULL, [], t('Uninstall'));
$this
->assertText(t('The selected modules have been uninstalled.'));
$this
->assertNoText(t('Simplenews'));
$this
->drupalPostForm('admin/modules', [
'modules[simplenews][enable]' => TRUE,
], t('Install'));
$this
->assertText('Module Simplenews has been enabled.');
}
}