SystemPerformanceFormTest.php in Purge 8.3
File
modules/purge_ui/tests/src/Functional/Form/SystemPerformanceFormTest.php
View source
<?php
namespace Drupal\Tests\purge_ui\Functional\Form;
use Drupal\Core\Url;
use Drupal\Tests\purge\Functional\BrowserTestBase;
class SystemPerformanceFormTest extends BrowserTestBase {
protected $adminUser;
protected $route = 'system.performance_settings';
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',
]);
}
public function testFormIsAltered() : void {
$this
->drupalLogin($this->adminUser);
$this
->drupalGet(Url::fromRoute($this->route));
$id = 'edit-page-cache-maximum-age';
$option_default = $this
->assertSession()
->optionExists($id, '0');
$option_1months = $this
->assertSession()
->optionExists($id, '2764800')
->getText();
$option_6months = $this
->assertSession()
->optionExists($id, '16588800')
->getText();
$option_week = $this
->assertSession()
->optionExists($id, '604800')
->getText();
$option_year = $this
->assertSession()
->optionExists($id, '31536000')
->getText();
$this
->assertTrue($option_default
->hasAttribute('selected'));
$this
->assertSame('1 month', $option_1months);
$this
->assertSame('6 months', $option_6months);
$this
->assertSame('1 week', $option_week);
$this
->assertSame('1 year (recommended for external cache invalidation)', $option_year);
}
}