function ActionUninstallTest::testActionUninstall

Same name in other branches
  1. 9 core/modules/action/tests/src/Functional/ActionUninstallTest.php \Drupal\Tests\action\Functional\ActionUninstallTest::testActionUninstall()
  2. 8.9.x core/modules/action/tests/src/Functional/ActionUninstallTest.php \Drupal\Tests\action\Functional\ActionUninstallTest::testActionUninstall()
  3. 11.x core/modules/action/tests/src/Functional/ActionUninstallTest.php \Drupal\Tests\action\Functional\ActionUninstallTest::testActionUninstall()

Tests Actions UI uninstall.

File

core/modules/action/tests/src/Functional/ActionUninstallTest.php, line 34

Class

ActionUninstallTest
Tests that uninstalling Actions UI does not remove other modules' actions.

Namespace

Drupal\Tests\action\Functional

Code

public function testActionUninstall() : void {
    \Drupal::service('module_installer')->uninstall([
        'action',
    ]);
    $storage = $this->container
        ->get('entity_type.manager')
        ->getStorage('action');
    $storage->resetCache([
        'user_block_user_action',
    ]);
    $this->assertNotEmpty($storage->load('user_block_user_action'), 'Configuration entity \'user_block_user_action\' still exists after uninstalling action module.');
    $admin_user = $this->drupalCreateUser([
        'administer users',
    ]);
    $this->drupalLogin($admin_user);
    $this->drupalGet('admin/people');
    // Ensure we have the user_block_user_action listed.
    $this->assertSession()
        ->responseContains('<option value="user_block_user_action">Block the selected user(s)</option>');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.