You are here

EntityUpdateInstallUninstallTest.php in Entity Update 8

File

modules/entity_update_tests/src/Tests/EntityUpdateInstallUninstallTest.php
View source
<?php

namespace Drupal\entity_update_tests\Tests;

use Drupal\simpletest\WebTestBase;

/**
 * Test install and uninstall Entity Update module.
 *
 * @group Entity Update
 */
class EntityUpdateInstallUninstallTest extends WebTestBase {

  /**
   * Modules to enable.
   *
   * @var array
   */
  public static $modules = [
    'entity_update',
    'entity_update_tests',
  ];

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
    $permissions = [
      'access administration pages',
      'administer modules',
    ];

    // User to set up entity_update.
    $this->admin_user = $this
      ->drupalCreateUser($permissions);
    $this
      ->drupalLogin($this->admin_user);
  }

  /**
   * Tests if the module cleans up the disk on uninstall.
   */
  public function testEntityUpdateUninstall() {

    // Uninstall the module entity_update_tests.
    $edit = [];
    $edit['uninstall[entity_update_tests]'] = TRUE;
    $this
      ->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
    $this
      ->assertText(\Drupal::translation()
      ->translate('Configuration deletions'), 'Configuration deletions listed on the module install confirmation page.');
    $this
      ->drupalPostForm(NULL, NULL, t('Uninstall'));
    $this
      ->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');

    // Uninstall the module entity_update.
    $edit = [];
    $edit['uninstall[entity_update]'] = TRUE;
    $this
      ->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
    $this
      ->assertNoText(\Drupal::translation()
      ->translate('Configuration deletions'), 'No configuration deletions listed on the module install confirmation page.');
    $this
      ->drupalPostForm(NULL, NULL, t('Uninstall'));
    $this
      ->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
  }

}

Classes

Namesort descending Description
EntityUpdateInstallUninstallTest Test install and uninstall Entity Update module.