function TourTest::testHasMatchingRoute

Same name in other branches
  1. 8.9.x core/modules/tour/tests/src/Unit/Entity/TourTest.php \Drupal\Tests\tour\Unit\Entity\TourTest::testHasMatchingRoute()
  2. 10 core/modules/tour/tests/src/Unit/Entity/TourTest.php \Drupal\Tests\tour\Unit\Entity\TourTest::testHasMatchingRoute()
  3. 11.x 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()
        ->onlyMethods([
        'getRoutes',
    ])
        ->getMock();
    $tour->expects($this->any())
        ->method('getRoutes')
        ->willReturn($routes);
    $this->assertSame($result, $tour->hasMatchingRoute($route_name, $route_params));
    $tour->resetKeyedRoutes();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.