You are here

protected function GTMBaseTestCase::verifyScriptTag in GoogleTagManager 7.2

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

Verify the tag in page response.

File

tests/google_tag.base.test, line 249

Class

GTMBaseTestCase
Tests the Google Tag Manager.

Code

protected function verifyScriptTag($realpath) {
  $string = variable_get('css_js_query_string', '');
  $text = "src=\"{$realpath}?{$string}\"";
  $message = 'Found script source string in page response';
  $this
    ->assertRaw($text, $message, $this->group);
  $xpath = "//script[@src=\"{$realpath}?{$string}\"]";
  $elements = $this
    ->xpath($xpath);
  $status = !empty($elements);
  $message = 'Found script tag in page response';
  $this
    ->assert($status, $message, $this->group);
}