You are here

public function GAPushUnitTestCase::testGaPushMethodAnalyticsJSPushScriptSocial in GA Push 7

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

Unit test for ga_push_method_analytics_js_push_script(): Social.

File

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

Class

GAPushUnitTestCase
Functional tests for the GA Push module.

Code

public function testGaPushMethodAnalyticsJSPushScriptSocial() {
  $type = GA_PUSH_TYPE_SOCIAL;

  // Load library:
  module_load_include('inc', 'ga_push', 'inc/ga_push.analytics_js');
  $push = $this->pushes[$type]['nat'];
  $script = ga_push_method_analytics_js_push_script($push, $type);
  $expected = 'ga(\'send\', {"socialNetwork":"facebook","socialAction":"like","socialTarget":"http:\\/\\/mycoolpage.com","hitType":"social"});' . "\n";
  $this
    ->assertTrue($expected === $script, 'GA Push Analytics js: social (nat)');
  $push = $this->pushes[$type]['n'];
  $script = ga_push_method_analytics_js_push_script($push, $type);
  $expected = 'ga(\'send\', {"socialNetwork":"facebook","hitType":"social"});' . "\n";
  $this
    ->assertTrue($expected === $script, 'GA Push Analytics js: social (n)');
}