You are here

public function SystemPerformanceFormTest::testFormIsAltered in Purge 8.3

Verify that our alterations are rendered.

File

modules/purge_ui/tests/src/Functional/Form/SystemPerformanceFormTest.php, line 45

Class

SystemPerformanceFormTest
Tests purge_ui_form_system_performance_settings_alter().

Namespace

Drupal\Tests\purge_ui\Functional\Form

Code

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);
}