protected function GTMTestBase::verifyScriptTag in GoogleTagManager 8
Verify the tag in page response.
File
- tests/
src/ Functional/ GTMTestBase.php, line 291
Class
- GTMTestBase
- Tests the Google Tag Manager.
Namespace
Drupal\Tests\google_tag\FunctionalCode
protected function verifyScriptTag($realpath) {
$query_string = $this->container
->get('state')
->get('system.css_js_query_string') ?: '0';
$text = "src=\"{$realpath}?{$query_string}\"";
$this
->assertSession()
->responseContains($text);
$xpath = "//script[@src=\"{$realpath}?{$query_string}\"]";
$elements = $this
->xpath($xpath);
$status = !empty($elements);
$message = 'Found script tag in page response';
parent::assertTrue($status, $message);
}