You are here

protected function GTMRealmTestCase::checkSnippetFiles in GoogleTagManager 7.2

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

@todo Revise this to loop on $this->variables for code reuse. This can be done in base test class.

Overrides GTMBaseTestCase::checkSnippetFiles

File

tests/google_tag.realm.test, line 81

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/{$key_name}/google_tag.{$type}.js";
        $contents = @file_get_contents($url);
        $function = "verify{$type}Snippet";
        $this
          ->{$function}($contents, $this->variables[$key_name]);
      }
    }
  }
}