You are here

protected function GTMTestBase::verifyScriptSnippet in GoogleTagManager 8

Verify the snippet file contents.

File

tests/src/Functional/GTMTestBase.php, line 244

Class

GTMTestBase
Tests the Google Tag Manager.

Namespace

Drupal\Tests\google_tag\Functional

Code

protected function verifyScriptSnippet($contents, $variables) {
  $status = strpos($contents, "'{$variables->container_id}'") !== FALSE;
  $message = 'Found in script snippet file: container_id';
  parent::assertTrue($status, $message);
  $status = strpos($contents, "gtm_preview={$variables->environment_id}") !== FALSE;
  $message = 'Found in script snippet file: environment_id';
  parent::assertTrue($status, $message);
  $status = strpos($contents, "gtm_auth={$variables->environment_token}") !== FALSE;
  $message = 'Found in script snippet file: environment_token';
  parent::assertTrue($status, $message);
}