You are here

protected function GTMTestBase::verifyNoScriptSnippet in GoogleTagManager 8

Verify the snippet cache contents.

File

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

Class

GTMTestBase
Tests the Google Tag Manager.

Namespace

Drupal\Tests\google_tag\Functional

Code

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