You are here

function FacebookTrackingPixelTestCaseUser::setUp in Facebook Tracking Pixel 8

Same name and namespace in other branches
  1. 7 tests/facebook_tracking_pixel.user.test \FacebookTrackingPixelTestCaseUser::setUp()

Overrides FacebookTrackingPixelTestCase::setUp

File

tests/facebook_tracking_pixel.user.test, line 45
Contains tests for the Facebook Tracking Pixel module.

Class

FacebookTrackingPixelTestCaseUser

Code

function setUp() {
  parent::setUp();

  // Enable all roles for tracking.
  $fbHelper = new facebookTrackingPixel\FacebookTrackingPixelTestHelper();
  $fbHelper
    ->enable_tracking_all_roles();

  // Create a non-global base code to test with user tracking.
  // Test Basecode ID.
  db_insert('facebook_tracking_pixel_base_codes')
    ->fields([
    'base_code_name' => 'Test Basecode 2',
    'base_code_fbid' => $this->userBaseCodeFBID,
    'base_code_global' => 0,
    'weight' => 20,
  ])
    ->execute();

  // Retreieve the base id created.
  $this->userBaseCodeID = db_select('facebook_tracking_pixel_base_codes', 'c')
    ->fields('c', [
    'base_code_id',
  ])
    ->condition('base_code_fbid', $this->userBaseCodeFBID, '=')
    ->execute()
    ->fetchField();
}