You are here

public function PageProcessorTest::testProcess in Mini site 8

Test process() method.

@dataProvider dataProviderProcess @covers \Drupal\minisite\PageProcessor::process

File

tests/src/Kernel/PageProcessorTest.php, line 29

Class

PageProcessorTest
Class PageProcessorTest.

Namespace

Drupal\Tests\minisite\Kernel

Code

public function testProcess($base_url, $uri, $alias, $href, $expected) {
  $content = '<!doctype html><html lang="en"><head></head><body><a href="' . $href . '">Test link</a></body></html>';
  $bag = new UrlBag($uri, $base_url);
  $bag
    ->setParentAlias($alias);
  $processor = new PageProcessor($content, $bag);
  $processor
    ->process();
  $actual = $this
    ->getTagAttribute($processor
    ->content(), 'a', 'href');
  $this
    ->assertEquals($expected, $actual);
}