You are here

public function HttpPurgerConfigFormTestBase::testFieldExistence in Generic HTTP Purger 8

Verify that the form contains all fields we require.

File

tests/src/Functional/HttpPurgerConfigFormTestBase.php, line 34

Class

HttpPurgerConfigFormTestBase
Testbase for testing \Drupal\purge_purger_http\Form\HttpPurgerFormBase.

Namespace

Drupal\Tests\purge_purger_http\Functional

Code

public function testFieldExistence() : void {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet($this
    ->getPath());
  $fields = [
    'edit-name' => '',
    'edit-invalidationtype' => 'tag',
    'edit-hostname' => 'localhost',
    'edit-port' => 80,
    'edit-path' => '/',
    'edit-request-method' => 0,
    'edit-scheme' => 0,
    'edit-verify' => TRUE,
    'edit-headers-0-field' => '',
    'edit-headers-0-value' => '',
    'edit-show-body-form' => '',
    'edit-body-content-type' => 'text/plain',
    'edit-body' => '',
    'edit-runtime-measurement' => '1',
    'edit-timeout' => 1.0,
    'edit-connect-timeout' => 1.0,
    'edit-cooldown-time' => 0.0,
    'edit-http-errors' => '1',
    'edit-max-requests' => 100,
  ];
  foreach ($fields as $field => $default_value) {
    $this
      ->assertSession()
      ->fieldValueEquals($field, $default_value);
  }
}