You are here

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

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

File

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

Class

dfpDisplayTagTest

Code

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

  // Create a tag without a slug, display it and ensure the default slug is
  // displayed.
  variable_set('dfp_default_slug', '<p>Global slug</p>');
  $edit['settings[slug]'] = '';
  $tag = $this
    ->createTag($edit);
  $this
    ->assertRaw('<div class="slug">' . check_plain(variable_get('dfp_default_slug', '')) . '</div>', 'The default slug is correctly used when no slug exists for an individual tag.');

  // Change the slug to <none> and ensure that no slug is displayed.
  $edit['settings[slug]'] = '<none>';
  $this
    ->editTag($tag->machinename, $edit);
  $this
    ->assertNoRaw('<div class="slug">', t('No slug is appearing when "@none" is used.', array(
    '@none' => '<none>',
  )));

  // Specify a slug and check that it shows instead of the default slug.
  $slug = '<p>Custom slug</p>';
  $edit['settings[slug]'] = $slug;
  $this
    ->editTag($tag->machinename, $edit);
  $this
    ->assertRaw('<div class="slug">' . check_plain($slug) . '</div>', 'The provided slug is correctly displayed with its tag.');
}