You are here

function dfpGlobalsTest::testGlobalSettingsOn in Doubleclick for Publishers (DFP) 7.2

Same name and namespace in other branches
  1. 7 tests/dfp_globals.test \dfpGlobalsTest::testGlobalSettingsOn()

File

tests/dfp.test, line 465
Test file for DFP module.

Class

dfpGlobalsTest

Code

function testGlobalSettingsOn() {
  $injected_js = $this
    ->randomName(32);
  $target = array(
    'target' => $this
      ->randomName(8),
    'value' => $this
      ->randomName(8),
  );
  variable_set('dfp_async_rendering', '1');
  variable_set('dfp_single_request', '1');
  variable_set('dfp_collapse_empty_divs', '1');
  variable_set('dfp_injected_js', $injected_js);
  variable_set('dfp_targeting', array(
    $target,
  ));
  $this
    ->drupalGet('/');
  $this
    ->assertRaw('googletag.pubads().enableAsyncRendering();', 'Asyncronous rendering is turned on.');
  $this
    ->assertRaw('googletag.pubads().enableSingleRequest();', 'Single request is turned on.');
  $this
    ->assertRaw('googletag.pubads().collapseEmptyDivs();', 'Collapse empty divs is turned on.');
  $this
    ->assertRaw($injected_js, 'Injected javascript correctly appears on the page.');
  $this
    ->assertRaw('googletag.pubads().setTargeting("' . $target['target'] . '", "' . $target['value'] . '");', 'Global targetting values appear correclty in javascript.');
}