You are here

private function EntityAccessCheckTest::createRouteMatchForObject in Drupal 9

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php \Drupal\Tests\Core\Entity\EntityAccessCheckTest::createRouteMatchForObject()
  2. 10 core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php \Drupal\Tests\Core\Entity\EntityAccessCheckTest::createRouteMatchForObject()

Wrap any object with a route match, and return that.

Parameters

object $object: Any object, including prophesized mocks based on interfaces.

Return value

\Drupal\Core\Routing\RouteMatchInterface A prophesized RouteMatchInterface.

2 calls to EntityAccessCheckTest::createRouteMatchForObject()
EntityAccessCheckTest::testAccessWithDifferentRouteParameters in core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php
@covers ::access
EntityAccessCheckTest::testAccessWithTypePlaceholder in core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php
@covers ::access

File

core/tests/Drupal/Tests/Core/Entity/EntityAccessCheckTest.php, line 119

Class

EntityAccessCheckTest
Unit test of entity access checking system.

Namespace

Drupal\Tests\Core\Entity

Code

private function createRouteMatchForObject(\stdClass $object) {
  $route_match = $this
    ->prophesize(RouteMatchInterface::class);
  $route_match
    ->getRawParameters()
    ->willReturn(new ParameterBag([
    'entity_type' => 'node',
    'var_name' => 1,
  ]));
  $route_match
    ->getParameters()
    ->willReturn(new ParameterBag([
    'entity_type' => 'node',
    'var_name' => $object,
  ]));
  return $route_match
    ->reveal();
}