public function GAPushUnitTestCase::setUp in GA Push 7
Same name and namespace in other branches
- 8 test/ga_push.test \GAPushUnitTestCase::setUp()
Sets up unit test environment.
Unlike DrupalWebTestCase::setUp(), DrupalUnitTestCase::setUp() does not install modules because tests are performed without accessing the database. Any required files must be explicitly included by the child class setUp() method.
Overrides DrupalUnitTestCase::setUp
File
- test/ga_push.test, line 31 
- Test case for testing the GA Push module.
Class
- GAPushUnitTestCase
- Functional tests for the GA Push module.
Code
public function setUp() {
  parent::setUp('ga_push', 'googleanalytics');
  // $ua_code = 'UA-123456-1';
  // variable_set('googleanalytics_account', $ua_code);
  // Get defined vars:
  module_load_include('module', 'ga_push');
  // Common pushes:
  $this->pushes = array();
  // Events:
  $this->pushes[GA_PUSH_TYPE_EVENT]['calv'] = array(
    'eventCategory' => 'Videos',
    'eventAction' => 'Play',
    'eventLabel' => 'Gone With the Wind',
    'eventValue' => 1,
    'nonInteraction' => FALSE,
  );
  $this->pushes[GA_PUSH_TYPE_EVENT]['calvn'] = array(
    'eventCategory' => 'Videos',
    'eventAction' => 'Play',
    'eventLabel' => 'Gone With the Wind',
    'eventValue' => 1,
    'nonInteraction' => TRUE,
  );
  $this->pushes[GA_PUSH_TYPE_EVENT]['ca'] = array(
    'eventCategory' => 'Videos',
    'eventAction' => 'Play',
  );
  // Social:
  $this->pushes[GA_PUSH_TYPE_SOCIAL]['nat'] = array(
    'socialNetwork' => 'facebook',
    'socialAction' => 'like',
    'socialTarget' => 'http://mycoolpage.com',
  );
  $this->pushes[GA_PUSH_TYPE_SOCIAL]['n'] = array(
    'socialNetwork' => 'facebook',
  );
}