class ParagraphsUninstallTest

Tests that Paragraphs module can be uninstalled.

@group paragraphs

Hierarchy

Expanded class hierarchy of ParagraphsUninstallTest

File

paragraphs/tests/src/Functional/ParagraphsUninstallTest.php, line 12

Namespace

Drupal\Tests\paragraphs\Functional
View source
class ParagraphsUninstallTest extends BrowserTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  protected static $modules = array(
    'paragraphs_demo',
  );

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * {@inheritdoc}
   */
  public function setUp() : void {
    parent::setUp();
    $admin_user = $this
      ->drupalCreateUser(array(
      'administer paragraphs types',
      'administer modules',
    ));
    $this
      ->drupalLogin($admin_user);
  }

  /**
   * Tests that Paragraphs module can be uninstalled.
   */
  public function testUninstall() {

    // Uninstall the module paragraphs_demo.
    $this
      ->drupalGet('admin/modules/uninstall');
    $this
      ->submitForm([
      'uninstall[paragraphs_demo]' => TRUE,
    ], 'Uninstall');
    $this
      ->submitForm([], 'Uninstall');

    // Delete library data.
    $this
      ->clickLink('Remove Paragraphs library items');
    $this
      ->submitForm([], 'Delete all Paragraphs library items');

    // Uninstall the library module.
    $this
      ->drupalGet('admin/modules/uninstall');
    $this
      ->submitForm([
      'uninstall[paragraphs_library]' => TRUE,
    ], 'Uninstall');
    $this
      ->submitForm([], 'Uninstall');

    // Delete paragraphs data.
    $this
      ->clickLink('Remove Paragraphs');
    $this
      ->submitForm([], 'Delete all Paragraphs');

    // Uninstall the module paragraphs.
    $this
      ->drupalGet('admin/modules/uninstall');
    $this
      ->submitForm([
      'uninstall[paragraphs]' => TRUE,
    ], 'Uninstall');
    $this
      ->submitForm([], 'Uninstall');
    $this
      ->assertSession()
      ->pageTextContains('The selected modules have been uninstalled.');
    $this
      ->assertSession()
      ->pageTextNotContains('Paragraphs demo');
    $this
      ->assertSession()
      ->pageTextNotContains('Paragraphs library');
    $this
      ->assertSession()
      ->pageTextNotContains('Paragraphs');
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ParagraphsUninstallTest::$defaultTheme protected property
ParagraphsUninstallTest::$modules protected static property Modules to enable.
ParagraphsUninstallTest::setUp public function
ParagraphsUninstallTest::testUninstall public function Tests that Paragraphs module can be uninstalled.