Version 1
[yaffs-website] / web / modules / contrib / paragraphs / src / Tests / ParagraphsUninstallTest.php
1 <?php
2
3 namespace Drupal\paragraphs\Tests;
4
5 use Drupal\simpletest\WebTestBase;
6
7 /**
8  * Tests that Paragraphs module can be uninstalled.
9  *
10  * @group paragraphs
11  */
12 class ParagraphsUninstallTest extends WebTestBase {
13
14   /**
15    * Modules to enable.
16    *
17    * @var array
18    */
19   public static $modules = array('paragraphs_demo');
20
21   /**
22    * {@inheritdoc}
23    */
24   public function setUp() {
25     parent::setUp();
26
27     $admin_user = $this->drupalCreateUser(array(
28       'administer paragraphs types',
29       'administer modules',
30     ));
31     $this->drupalLogin($admin_user);
32   }
33
34   /**
35    * Tests that Paragraphs module can be uninstalled.
36    */
37   public function testUninstall() {
38
39     // Uninstall the module paragraphs_demo.
40     $this->drupalPostForm('admin/modules/uninstall', ['uninstall[paragraphs_demo]' => TRUE], t('Uninstall'));
41     $this->drupalPostForm(NULL, [], t('Uninstall'));
42
43     // Delete paragraphs data.
44     $this->clickLink('Remove paragraph entities');
45     $this->drupalPostForm(NULL, [], t('Delete all paragraph entities'));
46
47     // Uninstall the module paragraphs.
48     $this->drupalPostForm('admin/modules/uninstall', ['uninstall[paragraphs]' => TRUE], t('Uninstall'));
49     $this->drupalPostForm(NULL, [], t('Uninstall'));
50     $this->assertText(t('The selected modules have been uninstalled.'));
51     $this->assertNoText(t('Paragraphs demo'));
52     $this->assertNoText(t('Paragraphs'));
53   }
54
55 }