You are here

protected function DfpTestBase::dfpCreateTag in Doubleclick for Publishers (DFP) 8

Creates a basic dfp ad tag.

Parameters

array $edit: An array of values for the DFP tag form.

Return value

\Drupal\dfp\Entity\Tag The created DFP tag.

6 calls to DfpTestBase::dfpCreateTag()
DisplayTagTest::testBackfill in tests/src/Functional/DisplayTagTest.php
Tests Adsense backfill settings.
DisplayTagTest::testDisplayTag in tests/src/Functional/DisplayTagTest.php
Tests display a DFP tag in a block.
DisplayTagTest::testDisplayTagWithMapping in tests/src/Functional/DisplayTagTest.php
Tests breakpoint mappings.
DisplayTagTest::testSlug in tests/src/Functional/DisplayTagTest.php
Tests slug display.
DisplayTagTest::testTargeting in tests/src/Functional/DisplayTagTest.php
Tests targeting display.

... See full list

File

tests/src/Functional/DfpTestBase.php, line 64
Contains \Drupal\Tests\dfp\Functional\DfpTestBase.

Class

DfpTestBase
An abstract class to build DFP tests from.

Namespace

Drupal\Tests\dfp\Functional

Code

protected function dfpCreateTag($edit = []) {

  // Create a new tag.
  $edit += $this
    ->dfpBasicTagEditValues();
  $this
    ->drupalPostForm('admin/structure/dfp/tags/add', $edit, t('Save'));

  // Load the tag object.
  $tag = Tag::load($edit['id']);
  $this
    ->assertTrue(is_object($tag) && $tag
    ->id() == $edit['id'], 'The new DFP tag was saved correctly.');

  // Display the new tag.
  $this
    ->drupalPlaceBlock('dfp_ad:' . $tag
    ->uuid());
  return $tag;
}