protected function FormTestBase::getBuiltForm in Purge 8.3
Fetch a built form array fetched via its controller.
This helper exists because several purge_ui forms rely route argument which are hard to inject programmatically in a generic way from this FormTestBase, so we're asking the controller to do it. This comes with the extra benefit that we can test the integration of the controller as well.
Parameters
array $route_parameters: (optional) An associative array of route parameter names and values.
array $options: See \Drupal\Core\Url::fromUri() for details.
Return value
array The form array.
See also
\Drupal\Core\Form\FormBuilderInterface::getForm()
2 calls to FormTestBase::getBuiltForm()
- AjaxFormTestBase::testAjaxDialog in modules/
purge_ui/ tests/ src/ Functional/ Form/ AjaxFormTestBase.php - Tests that forms have the Ajax dialog library loaded.
- FormTestBase::testFormBuilds in modules/
purge_ui/ tests/ src/ Functional/ Form/ FormTestBase.php - Assert that basic form building succeeds without issues.
File
- modules/
purge_ui/ tests/ src/ Functional/ Form/ FormTestBase.php, line 150
Class
- FormTestBase
- Testbase for purge_ui forms.
Namespace
Drupal\Tests\purge_ui\Functional\FormCode
protected function getBuiltForm(array $route_parameters = [], array $options = []) : array {
$path = $this
->getPath($route_parameters, $options);
$request = Request::create($path);
$match = $this->container
->get('router')
->matchRequest($request);
$controller = $this->container
->get('controller_resolver')
->getControllerFromDefinition($match['_controller']);
$arguments = $this->container
->get('http_kernel.controller.argument_resolver')
->getArguments($request, $controller);
return call_user_func_array($controller, $arguments);
}