function dfpAdCategoriesTest::testEnableDisableAdCategories in Doubleclick for Publishers (DFP) 7
Same name and namespace in other branches
- 7.2 tests/dfp.test \dfpAdCategoriesTest::testEnableDisableAdCategories()
File
- tests/
dfp_ad_categories.test, line 20 - Ad Categories test file for DFP module.
Class
- dfpAdCategoriesTest
- @file Ad Categories test file for DFP module.
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 re-enable 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]');
}