function AccessAnnouncementTest::testAnnounceFirstLogin

Same name in other branches
  1. 11.x core/modules/announcements_feed/tests/src/FunctionalJavascript/AccessAnnouncementTest.php \Drupal\Tests\announcements_feed\FunctionalJavascript\AccessAnnouncementTest::testAnnounceFirstLogin()

Test of viewing announcements by a user with appropriate permission.

File

core/modules/announcements_feed/tests/src/FunctionalJavascript/AccessAnnouncementTest.php, line 43

Class

AccessAnnouncementTest
Test the access announcement permissions to get access announcement icon.

Namespace

Drupal\Tests\announcements_feed\FunctionalJavascript

Code

public function testAnnounceFirstLogin() : void {
    $this->drupalLogin($this->drupalCreateUser([
        'access toolbar',
        'access announcements',
    ]));
    $this->drupalGet('<front>');
    // Check that the user can see the toolbar.
    $this->assertSession()
        ->elementExists('css', '#toolbar-bar');
    // And the announcements.
    $this->assertSession()
        ->elementExists('css', '.toolbar-icon-announce');
}

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