protected function RevisionUiAccessTest::createRequest in Group 8
Same name and namespace in other branches
- 2.0.x tests/src/Kernel/RevisionUiAccessTest.php \Drupal\Tests\group\Kernel\RevisionUiAccessTest::createRequest()
Creates a request for a specific route.
Parameters
string $route_name: The route name.
\Drupal\group\Entity\GroupInterface $group: The group.
\Drupal\group\Entity\GroupInterface|null $group_revision: (optional) The group revision.
Return value
\Symfony\Component\HttpFoundation\Request The request.
3 calls to RevisionUiAccessTest::createRequest()
- RevisionUiAccessTest::testOverviewAccess in tests/
src/ Kernel/ RevisionUiAccessTest.php - Tests access to the overview page.
- RevisionUiAccessTest::testUpdateDeleteAccess in tests/
src/ Kernel/ RevisionUiAccessTest.php - Tests access to the update (revert) or delete form.
- RevisionUiAccessTest::testViewAccess in tests/
src/ Kernel/ RevisionUiAccessTest.php - Tests access to the view page.
File
- tests/
src/ Kernel/ RevisionUiAccessTest.php, line 763
Class
- RevisionUiAccessTest
- Tests the revision UI access for groups.
Namespace
Drupal\Tests\group\KernelCode
protected function createRequest($route_name, GroupInterface $group, GroupInterface $group_revision = NULL) {
$params = [
'group' => $group
->id(),
];
$attributes = [
'group' => $group,
];
if ($group_revision) {
$params['group_revision'] = $group_revision
->getRevisionId();
$attributes['group_revision'] = $group_revision;
}
$attributes[RouteObjectInterface::ROUTE_OBJECT] = $this->routeProvider
->getRouteByName($route_name);
$request = Request::create(Url::fromRoute($route_name, $params)
->toString());
$request->attributes
->add($attributes);
// Push the request to the request stack so `current_route_match` works.
$this->container
->get('request_stack')
->push($request);
return $request;
}