public function LingotekModuleUninstallationWithDataTest::testUninstallModule in Lingotek Translation 3.7.x
Same name and namespace in other branches
- 8.2 tests/src/Functional/LingotekModuleUninstallationWithDataTest.php \Drupal\Tests\lingotek\Functional\LingotekModuleUninstallationWithDataTest::testUninstallModule()
- 4.0.x tests/src/Functional/LingotekModuleUninstallationWithDataTest.php \Drupal\Tests\lingotek\Functional\LingotekModuleUninstallationWithDataTest::testUninstallModule()
- 3.0.x tests/src/Functional/LingotekModuleUninstallationWithDataTest.php \Drupal\Tests\lingotek\Functional\LingotekModuleUninstallationWithDataTest::testUninstallModule()
- 3.1.x tests/src/Functional/LingotekModuleUninstallationWithDataTest.php \Drupal\Tests\lingotek\Functional\LingotekModuleUninstallationWithDataTest::testUninstallModule()
- 3.2.x tests/src/Functional/LingotekModuleUninstallationWithDataTest.php \Drupal\Tests\lingotek\Functional\LingotekModuleUninstallationWithDataTest::testUninstallModule()
- 3.3.x tests/src/Functional/LingotekModuleUninstallationWithDataTest.php \Drupal\Tests\lingotek\Functional\LingotekModuleUninstallationWithDataTest::testUninstallModule()
- 3.4.x tests/src/Functional/LingotekModuleUninstallationWithDataTest.php \Drupal\Tests\lingotek\Functional\LingotekModuleUninstallationWithDataTest::testUninstallModule()
- 3.5.x tests/src/Functional/LingotekModuleUninstallationWithDataTest.php \Drupal\Tests\lingotek\Functional\LingotekModuleUninstallationWithDataTest::testUninstallModule()
- 3.6.x tests/src/Functional/LingotekModuleUninstallationWithDataTest.php \Drupal\Tests\lingotek\Functional\LingotekModuleUninstallationWithDataTest::testUninstallModule()
- 3.8.x tests/src/Functional/LingotekModuleUninstallationWithDataTest.php \Drupal\Tests\lingotek\Functional\LingotekModuleUninstallationWithDataTest::testUninstallModule()
Tests that the module can be uninstalled.
File
- tests/
src/ Functional/ LingotekModuleUninstallationWithDataTest.php, line 54
Class
- LingotekModuleUninstallationWithDataTest
- Tests that the module can be uninstalled when there is Lingotek metadata.
Namespace
Drupal\Tests\lingotek\FunctionalCode
public function testUninstallModule() {
$assert_session = $this
->assertSession();
// Login as admin.
$this
->drupalLogin($this->rootUser);
$this
->createAndDownloadANodeTranslation();
// Navigate to the Extend page.
$this
->drupalGet('/admin/modules');
// Ensure the module is not enabled yet.
$this
->assertSession()
->checkboxChecked('edit-modules-lingotek-enable');
$this
->clickLink('Uninstall');
$this
->assertSession()
->fieldDisabled('edit-uninstall-lingotek');
// Plural reasons.
$this
->assertText('The following reasons prevent Lingotek Translation from being uninstalled:');
// Post the form uninstalling the lingotek_test module.
$edit = [
'uninstall[lingotek_test]' => '1',
];
$this
->drupalPostForm(NULL, $edit, 'Uninstall');
$this
->drupalPostForm(NULL, [], 'Uninstall');
$this
->assertText('The selected modules have been uninstalled.');
// Singular reason.
$this
->assertText('The following reason prevents Lingotek Translation from being uninstalled:');
$this
->assertText('There is content for the entity type: Lingotek Content Metadata');
$assert_session
->linkExists('Remove lingotek content metadata entities');
$this
->assertSession()
->fieldDisabled('edit-uninstall-lingotek');
$this
->clickLink('Remove lingotek content metadata entities');
$this
->assertText('Are you sure you want to delete all lingotek content metadata entities?');
$this
->assertText('This will delete 1 lingotek content metadata.');
$this
->drupalPostForm(NULL, [], 'Delete all lingotek content metadata entities');
$this
->assertFalse($this
->getSession()
->getPage()
->findField('edit-uninstall-lingotek')
->hasAttribute('disabled'));
// Post the form uninstalling the lingotek module.
$edit = [
'uninstall[lingotek]' => '1',
];
$this
->drupalPostForm(NULL, $edit, 'Uninstall');
// We get an advice and we can confirm.
$this
->assertText('The following modules will be completely uninstalled from your site, and all data from these modules will be lost!');
$this
->assertText('The listed configuration will be deleted.');
$this
->assertText('Lingotek Profile');
$this
->drupalPostForm(NULL, [], 'Uninstall');
$this
->assertText('The selected modules have been uninstalled.');
}