You are here

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

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

File

tests/dfp_globals.test, line 20
Globals test file for DFP module.

Class

dfpGlobalsTest
@file Globals test file for DFP module.

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 targeting values appear correctly in javascript.');
}