You are here

public function DataLayerFunctionalTest::testAdminSettingsForm in dataLayer 8

Tests basic admin form functionality.

File

tests/src/Functional/DataLayerFunctionalTest.php, line 70

Class

DataLayerFunctionalTest
Functional test cases for datalayer module.

Namespace

Drupal\Tests\datalayer\Functional

Code

public function testAdminSettingsForm() {

  // Check default form field values.
  $assert = $this
    ->assertSession();
  $this
    ->drupalGet('admin/config/search/datalayer');
  $assert
    ->pageTextContains('Include "data layer helper" library');
  $this
    ->assertNoFieldChecked('lib_helper');
  $assert
    ->pageTextNotContains('Data Layer Helper Library is enabled but the library is not installed at /libraries/data-layer-helper/dist/data-layer-helper.js. See: data-layer-helper on GitHub.');

  // Update form field to ensure config value changes.
  $this
    ->drupalPostForm(NULL, [
    'lib_helper' => '1',
  ], 'Save configuration');
  $this
    ->assertFieldChecked('lib_helper');
  $assert
    ->pageTextContains('Data Layer Helper Library is enabled but the library is not installed at /libraries/data-layer-helper/dist/data-layer-helper.js. See: data-layer-helper on GitHub.');
}