You are here

public function ViewportResolverTest::testIsPathSelectedDetectsFrontPage in Viewport 8

Tests isPathSelected matches frontpage paths not explicitly configured.

Code smell?: This test is not really reliable. As it stands it relies on the "<front>" translation to the current frontpage path being done by the PathMatcher class. The mocks in this test overwrite the getFrontPagePath method to return the one desired, but that wouldn't ensure correct behavior if the current path stack service in Drupal changed to a different class.

File

tests/src/Unit/ViewportResolverTest.php, line 110

Class

ViewportResolverTest
@coversDefaultClass \Drupal\viewport\ViewportResolver @group viewport

Namespace

Drupal\Tests\viewport\Unit

Code

public function testIsPathSelectedDetectsFrontPage() {
  $this
    ->assertTrue($this->viewportResolver
    ->isPathSelected('/frontpage-path'), 'Check non-configured path as front page path.');
}