function dfpAdTestTest::testQueryString in Doubleclick for Publishers (DFP) 7
Same name and namespace in other branches
- 7.2 tests/dfp.test \dfpAdTestTest::testQueryString()
File
- tests/
dfp_ads.test, line 28 - Ads test file for DFP module.
Class
- dfpAdTestTest
- @file Ads test file for DFP module.
Code
function testQueryString() {
$tag = $this
->createTag();
$override = $this
->randomName(8);
variable_set('dfp_adtest_adunit', $override);
$this
->drupalGet('admin/structure/dfp_ads/test_page', array(
'query' => array(
'adtest' => 'true',
),
));
$this
->assertRaw('googletag.defineSlot("' . variable_get('dfp_network_id', '') . '/' . $override . '"', 'The Ad Unit Name was properly overridden using the adtest query string.');
// Check that nefarious override values are caught because security.
$nefarious_override = "<script>alert('not safe');</script>";
$this
->drupalGet('admin/structure/dfp_ads/test_page', array(
'query' => array(
'adunit_override' => $nefarious_override,
),
));
$this
->assertNoRaw($nefarious_override, 'Only strings without executable code can be used for the adunit_override query string.');
}