function ClearCacheBlockTest::testCacheClearBlock

Tests block behavior and access based on permissions.

File

core/modules/system/tests/src/Functional/Block/ClearCacheBlockTest.php, line 54

Class

ClearCacheBlockTest
Tests clear cache block behavior.

Namespace

Drupal\Tests\system\Functional\Block

Code

public function testCacheClearBlock() : void {
    $this->drupalGet('<front>');
    $this->assertSession()
        ->pageTextContains('Clear cache block');
    $page = $this->getSession()
        ->getPage();
    $page->pressButton('Clear all caches');
    $this->assertSession()
        ->statusMessageContains('Caches cleared.');
    // Confirm that access is not allowed for non-authorized users.
    $this->drupalLogout();
    $this->drupalGet('<front>');
    $this->assertSession()
        ->pageTextNotContains('Clear cache block');
}

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