You are here

public function PageLoadProgressAdminSettingsFormTest::testPageLoadProgressSettingsPost in Page Load Progress 8

Test posting data to the page_load_progress settings form.

File

tests/src/Functional/PageLoadProgressAdminSettingsFormTest.php, line 91

Class

PageLoadProgressAdminSettingsFormTest
Tests for the page_load_progress module.

Namespace

Drupal\Tests\page_load_progress\Functional

Code

public function testPageLoadProgressSettingsPost() {

  // Post form with new values.
  $edit = [
    'page_load_progress_time' => 5000,
    'page_load_progress_request_path' => '<front>',
    'page_load_progress_request_path_negate_condition' => 0,
    'page_load_progress_internal_links' => TRUE,
    'page_load_progress_esc_key' => FALSE,
  ];
  $this
    ->drupalPostForm(Url::fromRoute('page_load_progress.admin_settings'), $edit, 'Save configuration');

  // Load settings form page and test for new values.
  $this
    ->drupalGet(Url::fromRoute('page_load_progress.admin_settings'));
  $this
    ->assertSession()
    ->fieldValueEquals('edit-page-load-progress-time', $edit['page_load_progress_time']);
  $this
    ->assertSession()
    ->fieldValueEquals('edit-page-load-progress-request-path', $edit['page_load_progress_request_path']);
  $this
    ->assertSession()
    ->fieldValueEquals('page_load_progress_request_path_negate_condition', $edit['page_load_progress_request_path_negate_condition']);
  $this
    ->assertSession()
    ->fieldValueEquals('edit-page-load-progress-internal-links', $edit['page_load_progress_internal_links']);
  $this
    ->assertSession()
    ->fieldValueEquals('edit-page-load-progress-esc-key', $edit['page_load_progress_esc_key']);
}