You are here

public function TourTest::testHasMatchingRoute in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/tour/tests/src/Unit/Entity/TourTest.php \Drupal\Tests\tour\Unit\Entity\TourTest::testHasMatchingRoute()

Tests \Drupal\tour\Entity\Tour::hasMatchingRoute().

@covers ::hasMatchingRoute

@dataProvider routeProvider

Parameters

array $routes: Array of routes as per the Tour::routes property.

string $route_name: The route name to match.

array $route_params: Array of route params.

bool $result: Expected result.

File

core/modules/tour/tests/src/Unit/Entity/TourTest.php, line 29

Class

TourTest
@coversDefaultClass \Drupal\tour\Entity\Tour @group tour

Namespace

Drupal\Tests\tour\Unit\Entity

Code

public function testHasMatchingRoute($routes, $route_name, $route_params, $result) {
  $tour = $this
    ->getMockBuilder('\\Drupal\\tour\\Entity\\Tour')
    ->disableOriginalConstructor()
    ->setMethods([
    'getRoutes',
  ])
    ->getMock();
  $tour
    ->expects($this
    ->any())
    ->method('getRoutes')
    ->will($this
    ->returnValue($routes));
  $this
    ->assertSame($result, $tour
    ->hasMatchingRoute($route_name, $route_params));
  $tour
    ->resetKeyedRoutes();
}