function ActionListTest::testEmptyActionList

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

Tests the behavior when there are no actions to list in the admin page.

File

core/modules/action/tests/src/Functional/ActionListTest.php, line 32

Class

ActionListTest
Test behaviors when visiting the action listing page.

Namespace

Drupal\Tests\action\Functional

Code

public function testEmptyActionList() : void {
  // Create a user with permission to view the actions administration pages.
  $this->drupalLogin($this->drupalCreateUser([
    'administer actions',
  ]));
  // Ensure the empty text appears on the action list page.
  /** @var \Drupal\Core\Entity\EntityStorageInterface $storage */
  $storage = $this->container
    ->get('entity_type.manager')
    ->getStorage('action');
  $actions = $storage->loadMultiple();
  $storage->delete($actions);
  $this->drupalGet('/admin/config/system/actions');
  $this->assertSession()
    ->pageTextContains('There are no actions yet.');
}

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