You are here

protected function BreadcrumbsTest::setUp in GraphQL 8.3

Overrides GraphQLCoreTestBase::setUp

File

modules/graphql_core/tests/src/Kernel/Breadcrumbs/BreadcrumbsTest.php, line 28

Class

BreadcrumbsTest
Test entity query support in GraphQL.

Namespace

Drupal\Tests\graphql_core\Kernel\Breadcrumbs

Code

protected function setUp() {
  parent::setUp();
  $breadcrumbManager = $this
    ->prophesize('Drupal\\Core\\Breadcrumb\\BreadcrumbManager');
  $breadcrumbManager
    ->build(Argument::any())
    ->will(function ($args) {

    /** @var \Drupal\Core\Routing\RouteMatch $routeMatch */
    $routeMatch = $args[0];
    $breadcrumb = new Breadcrumb();
    if ($routeMatch
      ->getRouteName() == 'graphql_breadcrumbs_test.test') {
      $breadcrumb
        ->addLink(new Link('Test breadcrumb', Url::fromUserInput('/breadcrumbs-test')));
    }
    return $breadcrumb;
  });
  $this->container
    ->set('breadcrumb', $breadcrumbManager
    ->reveal());
}