Skip to content

Commit

Permalink
Fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelovani committed Apr 19, 2017
1 parent 4257154 commit bd02e5a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dfp.module
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ function _dfp_js_global_settings() {
$js = 'googletag.cmd.push(function() {' . "\n";
}
else {
$js .= ' googletag.pubads().enableSyncRendering();' . "\n";
$js = 'googletag.pubads().enableSyncRendering();' . "\n";
}
if (variable_get('dfp_single_request', 1)) {
$js .= ' googletag.pubads().enableSingleRequest();' . "\n";
Expand Down
6 changes: 5 additions & 1 deletion tests/dfp.test
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ class dfpGlobalsTest extends dfpBaseTest {

function testGlobalSettingsOn() {
$injected_js = $this->randomName(32);
$injected_js2 = $this->randomName(32);
$target = array(
'target' => $this->randomName(8),
'value' => $this->randomName(8),
Expand All @@ -473,12 +474,14 @@ class dfpGlobalsTest extends dfpBaseTest {
variable_set('dfp_single_request', '1');
variable_set('dfp_collapse_empty_divs', '1');
variable_set('dfp_injected_js', $injected_js);
variable_set('dfp_injected_js2', $injected_js2);
variable_set('dfp_targeting', array($target));
$this->drupalGet('/');
$this->assertRaw('googletag.pubads().enableAsyncRendering();', 'Asyncronous rendering is turned on.');
$this->assertRaw('googletag.cmd.push(function() {', '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($injected_js2, 'Injected javascript 2 correctly appears on the page.');
$this->assertRaw('googletag.pubads().setTargeting("' . $target['target'] . '", "' . $target['value'] . '");', 'Global targetting values appear correclty in javascript.');
}

Expand All @@ -487,6 +490,7 @@ class dfpGlobalsTest extends dfpBaseTest {
variable_set('dfp_single_request', '0');
variable_set('dfp_collapse_empty_divs', '0');
$this->drupalGet('/');
$this->assertRaw('googletag.pubads().enableSyncRendering();', 'Syncronous rendering is turned on.');
$this->assertNoRaw('googletag.pubads().enableAsyncRendering();', 'Asyncronous rendering is turned off.');
$this->assertNoRaw('googletag.pubads().enableSingleRequest();', 'Single request is turned off.');
$this->assertNoRaw('googletag.pubads().collapseEmptyDivs();', 'Collapse empty divs is turned off.');
Expand Down

0 comments on commit bd02e5a

Please sign in to comment.