LingotekModuleUninstallWith8x1xDataTest.php in Lingotek Translation 8.2
File
tests/src/Functional/Update/LingotekModuleUninstallWith8x1xDataTest.php
View source
<?php
namespace Drupal\Tests\lingotek\Functional\Update;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
class LingotekModuleUninstallWith8x1xDataTest extends UpdatePathTestBase {
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../fixtures/update/drupal-8.lingotek.standard.pre8213.php.gz',
];
}
public function testUninstallModule() {
$this
->runUpdates();
$this
->drupalLogin($this->rootUser);
$this
->drupalGet('/admin/modules');
$this
->assertSession()
->checkboxChecked('edit-modules-lingotek-enable');
$this
->clickLink('Uninstall');
$this
->assertSession()
->fieldDisabled('edit-uninstall-lingotek');
$this
->assertText('The following reason prevents Lingotek Translation from being uninstalled:');
$this
->assertText('There is content for the entity type: Lingotek Content Metadata');
$this
->assertLink('Remove lingotek content metadata entities');
$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 15 lingotek content metadata entities.');
$this
->drupalPostForm(NULL, [], 'Delete all lingotek content metadata entities');
$this
->assertFalse($this
->getSession()
->getPage()
->findField('edit-uninstall-lingotek')
->hasAttribute('disabled'));
$edit = [
'uninstall[lingotek]' => '1',
];
$this
->drupalPostForm(NULL, $edit, 'Uninstall');
$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.');
}
}