You are here

public function GAPushUnitTestCase::testGaPushMethodAnalyticsJSPushScriptEvent in GA Push 8

Same name and namespace in other branches
  1. 7 test/ga_push.test \GAPushUnitTestCase::testGaPushMethodAnalyticsJSPushScriptEvent()

Unit test for ga_push_method_analytics_js_push_script(): Event.

File

test/ga_push.test, line 88
Test case for testing the GA Push module.

Class

GAPushUnitTestCase
Functional tests for the GA Push module.

Code

public function testGaPushMethodAnalyticsJSPushScriptEvent() {
  $type = GA_PUSH_TYPE_EVENT;

  // Load library:
  module_load_include('inc', 'ga_push', 'inc/ga_push.analytics_js');
  $push = $this->pushes[$type]['calv'];
  $script = ga_push_method_analytics_js_push_script($push, $type);
  $expected = 'ga(\'send\', {"eventCategory":"Videos","eventAction":"Play","eventLabel":"Gone With the Wind","eventValue":1,"hitType":"event"});' . "\n";
  $this
    ->assertTrue($expected === $script, 'GA Push Analytics js: event (calv)');
  $push = $this->pushes[$type]['calvn'];
  $script = ga_push_method_analytics_js_push_script($push, $type);
  $expected = 'ga(\'send\', {"eventCategory":"Videos","eventAction":"Play","eventLabel":"Gone With the Wind","eventValue":1,"nonInteraction":true,"hitType":"event"});' . "\n";
  $this
    ->assertTrue($expected === $script, 'GA Push Analytics js: event (calvn)');
  $push = $this->pushes[$type]['ca'];
  $script = ga_push_method_analytics_js_push_script($push, $type);
  $expected = 'ga(\'send\', {"eventCategory":"Videos","eventAction":"Play","eventValue":1,"hitType":"event"});' . "\n";
  $this
    ->assertTrue($expected === $script, 'GA Push Analytics js: event (ca)');
}