DashboardTestBase.php in Purge 8.3
File
modules/purge_ui/tests/src/Functional/DashboardTestBase.php
View source
<?php
namespace Drupal\Tests\purge_ui\Functional;
use Drupal\Core\Url;
use Drupal\Tests\purge\Functional\BrowserTestBase;
abstract class DashboardTestBase extends BrowserTestBase {
protected $adminUser;
protected $route = 'purge_ui.dashboard';
public static $modules = [
'purge_ui',
];
public function setUp($switch_to_memory_queue = TRUE) : void {
parent::setUp($switch_to_memory_queue);
$this->adminUser = $this
->drupalCreateUser([
'administer site configuration',
]);
if (is_string($this->route)) {
$this->route = Url::fromRoute($this->route);
}
}
public function testFormAccess() : void {
$this
->drupalGet($this->route);
$this
->assertSession()
->statusCodeEquals(403);
$this
->drupalLogin($this->adminUser);
$this
->drupalGet($this->route);
$this
->assertSession()
->responseContains('When content on your website changes, your purge setup will take care of refreshing external caching systems and CDNs.');
$this
->assertSession()
->statusCodeEquals(200);
}
}