You are here

public function TagViewTest::testGetShortTagQueryString in Doubleclick for Publishers (DFP) 8

@covers ::getShortTagQueryString @dataProvider getShortTagQueryStringProvider

File

tests/src/Unit/View/TagViewTest.php, line 97
Contains \Drupal\Tests\dfp\Unit\View\TagViewTest.

Class

TagViewTest
@coversDefaultClass \Drupal\dfp\View\TagView @group dfp

Namespace

Drupal\Tests\dfp\Unit\View

Code

public function testGetShortTagQueryString($tag_ad_unit, $tag_sizes, $tag_targeting, $network_id, $regex) {
  $tag = $this
    ->prophesize(TagInterface::class);
  $tag
    ->adunit()
    ->willReturn($tag_ad_unit);
  $tag
    ->size()
    ->willReturn($tag_sizes);
  $tag
    ->targeting()
    ->willReturn($tag_targeting);
  $config_factory = $this
    ->getConfigFactoryStub([
    'dfp.settings' => [
      'adunit_pattern' => 'default_adunit',
      'network_id' => $network_id,
    ],
  ]);
  $token = $this
    ->createMock(TokenInterface::class);
  $token
    ->method('replace')
    ->willReturnArgument(0);
  $module_handler = $this
    ->prophesize(ModuleHandlerInterface::class)
    ->reveal();
  $tag_view = new TagView($tag
    ->reveal(), $config_factory
    ->get('dfp.settings'), $token, $module_handler);
  $this
    ->assertRegExp($regex, $tag_view
    ->getShortTagQueryString());
}