You are here

protected function GTMRealmTestCase::checkSnippetFiles in GoogleTagManager 7

Same name and namespace in other branches
  1. 7.2 tests/google_tag.realm.test \GTMRealmTestCase::checkSnippetFiles()

Inspect the snippet files.

Overrides GTMBaseTestCase::checkSnippetFiles

File

tests/google_tag.realm.test, line 108

Class

GTMRealmTestCase
Tests the Google Tag Manager for a site with realms.

Code

protected function checkSnippetFiles() {
  $realms = variable_realm_list();
  foreach ($realms as $realm_name => $realm_title) {
    $keys = variable_realm_keys($realm_name);
    foreach ($keys as $key_name => $key_title) {
      $message = format_string('realm:key = @realm:@key', array(
        '@realm' => $realm_name,
        '@key' => $key_name,
      ));
      $this
        ->pass($message, $this->group);
      foreach ($this->types as $type) {
        $url = "{$this->basePath}/google_tag/{$realm_name}/google_tag.{$key_name}.{$type}.js";
        $contents = @file_get_contents($url);
        $function = "verify{$type}Snippet";
        $this
          ->{$function}($contents, $this->variables[$key_name]);
      }
    }
  }
}