You are here

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

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

File

tests/dfp_display_tag.test, line 81
Display tag test file for DFP module.

Class

dfpDisplayTagTest
@file Display tag test file for DFP module.

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.');
}