You are here

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

@covers ::getSlug @dataProvider getSlugProvider

File

tests/src/Unit/View/TagViewTest.php, line 47
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 testGetSlug($tag_slug, $default_slug, $expected_slug) {
  $tag = $this
    ->prophesize(TagInterface::class);
  $tag
    ->slug()
    ->willReturn($tag_slug);
  $config_factory = $this
    ->getConfigFactoryStub([
    'dfp.settings' => [
      'default_slug' => $default_slug,
    ],
  ]);
  $token = $this
    ->prophesize(TokenInterface::class)
    ->reveal();
  $module_handler = $this
    ->prophesize(ModuleHandlerInterface::class)
    ->reveal();
  $tag_view = new TagView($tag
    ->reveal(), $config_factory
    ->get('dfp.settings'), $token, $module_handler);
  $this
    ->assertSame($expected_slug, $tag_view
    ->getSlug());
}