You are here

protected function GTMBaseTestCase::verifyScriptSnippet in GoogleTagManager 7

Same name and namespace in other branches
  1. 7.2 tests/google_tag.base.test \GTMBaseTestCase::verifyScriptSnippet()

Verify the snippet file contents.

File

tests/google_tag.base.test, line 79

Class

GTMBaseTestCase
Tests the Google Tag Manager.

Code

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