d2bc5b01512d86ab32ca4353411a504547952263
[yaffs-website] / web / modules / contrib / php / src / Tests / PhpUninstallTest.php
1 <?php
2
3 namespace Drupal\php\Tests;
4
5 use Drupal\simpletest\WebTestBase;
6
7 /**
8  * Test uninstall functionality of PHP module.
9  *
10  * @group PHP
11  */
12 class PhpUninstallTest extends WebTestBase {
13
14   /**
15    * Modules to enable.
16    *
17    * @var array
18    */
19   public static $modules = ['php'];
20
21   /**
22    * {@inheritdoc}
23    */
24   protected function setUp() {
25     parent::setUp();
26
27     $permissions = [
28       'access administration pages',
29       'administer modules',
30     ];
31
32     // User to set up php.
33     $this->admin_user = $this->drupalCreateUser($permissions);
34     $this->drupalLogin($this->admin_user);
35   }
36
37   /**
38    * Tests if the module cleans up the disk on uninstall.
39    */
40   public function testPhpUninstall() {
41     // If this request is missing the uninstall form shows "The form has become
42     // outdated. Copy any unsaved work in the form below and then reload this
43     // page." message for unknown reasons.
44     $this->drupalGet('admin/modules');
45
46     // Uninstall the module.
47     $edit = [];
48     $edit['uninstall[php]'] = TRUE;
49     $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
50     $this->assertText(t('Would you like to continue with uninstalling the above?'));
51     $this->drupalPostForm(NULL, [], t('Uninstall'));
52     $this->assertText(t('The selected modules have been uninstalled.'));
53   }
54
55 }