You are here

function dfpAdCategoriesTest::testEnableDisableAdCategories in Doubleclick for Publishers (DFP) 7.2

Same name and namespace in other branches
  1. 7 tests/dfp_ad_categories.test \dfpAdCategoriesTest::testEnableDisableAdCategories()

File

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

Class

dfpAdCategoriesTest

Code

function testEnableDisableAdCategories() {

  // Check that enabling DFP Ad Categories for the "tags" vocabulary works.
  $edit = array(
    'dfp_enable_ad_categories' => 1,
    'dfp_enable_ad_categories_bundles[tags]' => 'tags',
  );
  $this
    ->drupalPost('admin/structure/dfp_ads/settings', $edit, t('Save configuration'));
  $this
    ->drupalGet('admin/structure/taxonomy/tags/add');
  $this
    ->assertFieldByName('field_dfp_ad_categories[und]');

  // Check that disabling DFP Ad Categories vocabulary works even when a
  // bundle is selected.
  $edit = array(
    'dfp_enable_ad_categories' => 0,
  );
  $this
    ->drupalPost('admin/structure/dfp_ads/settings', $edit, t('Save configuration'));
  $this
    ->drupalGet('admin/structure/taxonomy/tags/add');
  $this
    ->assertNoFieldByName('field_dfp_ad_categories[und]');

  // Check that disabling DFP Ad Categories on a specific vocabulary works.
  // For this test to be valid, we first need to reenable DFP Ad Categories.
  $edit = array(
    'dfp_enable_ad_categories' => 1,
    'dfp_enable_ad_categories_bundles[tags]' => 'tags',
  );
  $this
    ->drupalPost('admin/structure/dfp_ads/settings', $edit, t('Save configuration'));
  $this
    ->drupalGet('admin/structure/taxonomy/tags/add');
  $edit = array(
    'dfp_enable_ad_categories_bundles[tags]' => 0,
  );
  $this
    ->drupalPost('admin/structure/dfp_ads/settings', $edit, t('Save configuration'));
  $this
    ->drupalGet('admin/structure/taxonomy/tags/add');
  $this
    ->assertNoFieldByName('field_dfp_ad_categories[und]');
}