You are here

function dfpDisplayTagTest::testBackfill in Doubleclick for Publishers (DFP) 7.2

Same name and namespace in other branches
  1. 7 tests/dfp_display_tag.test \dfpDisplayTagTest::testBackfill()

File

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

Class

dfpDisplayTagTest

Code

function testBackfill() {
  $edit = $this
    ->dfpBasicTagEditValues();

  // Create a tag with backfill settings.
  $colors = array(
    'background',
    'border',
    'link',
    'text',
    'url',
  );
  $types = array(
    'text',
    'image',
    'text_image',
  );
  shuffle($types);
  $edit['settings[adsense_ad_types]'] = array_pop($types);
  $edit['settings[adsense_channel_ids]'] = $this
    ->randomName(8);
  foreach ($colors as $color) {
    $edit['settings[adsense_colors][' . $color . ']'] = drupal_strtoupper($this
      ->randomName(8));
  }
  $tag = $this
    ->createTag($edit);
  $this
    ->assertPropertySet('', 'adsense_ad_types', $edit['settings[adsense_ad_types]']);
  $this
    ->assertPropertySet('', 'adsense_channel_ids', $edit['settings[adsense_channel_ids]']);
  foreach ($colors as $color) {
    $this
      ->assertPropertySet('', 'adsense_' . $color . '_color', $edit['settings[adsense_colors][' . $color . ']']);
  }
}