You are here

public function VarnishPurgerFormTestBase::testFieldExistence in Varnish purger 8

Same name and namespace in other branches
  1. 8.2 src/Tests/VarnishPurgerFormTestBase.php \Drupal\varnish_purger\Tests\VarnishPurgerFormTestBase::testFieldExistence()

Verify that the form contains all fields we require.

File

src/Tests/VarnishPurgerFormTestBase.php, line 22

Class

VarnishPurgerFormTestBase
Testbase for testing \Drupal\varnish_purger\Form\VarnishPurgerFormBase.

Namespace

Drupal\varnish_purger\Tests

Code

public function testFieldExistence() {
  $this
    ->drupalLogin($this->admin_user);
  $this
    ->drupalGet($this->route);
  $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-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
      ->assertFieldById($field, $default_value);
  }
}