function TaxonomyDefaultArgumentTest::initViewWithRequest
Init view with a request by provided URL.
Parameters
string $request_url: The requested URL.
string $view_name: The name of the view.
Return value
\Drupal\views\ViewExecutable The initiated view.
Throws
\Exception
3 calls to TaxonomyDefaultArgumentTest::initViewWithRequest()
- TaxonomyDefaultArgumentTest::testNodePath in core/
modules/ taxonomy/ tests/ src/ Kernel/ Views/ TaxonomyDefaultArgumentTest.php  - Tests the relationship.
 - TaxonomyDefaultArgumentTest::testNodePathWithViewSelection in core/
modules/ taxonomy/ tests/ src/ Kernel/ Views/ TaxonomyDefaultArgumentTest.php  - TaxonomyDefaultArgumentTest::testTermPath in core/
modules/ taxonomy/ tests/ src/ Kernel/ Views/ TaxonomyDefaultArgumentTest.php  
File
- 
              core/
modules/ taxonomy/ tests/ src/ Kernel/ Views/ TaxonomyDefaultArgumentTest.php, line 39  
Class
- TaxonomyDefaultArgumentTest
 - Tests the representative node relationship for terms.
 
Namespace
Drupal\Tests\taxonomy\Kernel\ViewsCode
protected function initViewWithRequest($request_url, $view_name = 'taxonomy_default_argument_test') {
  $view = Views::getView($view_name);
  $request = Request::create($request_url);
  $request->server
    ->set('SCRIPT_NAME', $GLOBALS['base_path'] . 'index.php');
  $request->server
    ->set('SCRIPT_FILENAME', 'index.php');
  $response = $this->container
    ->get('http_kernel')
    ->handle($request, HttpKernelInterface::SUB_REQUEST);
  $view->setRequest($request);
  $view->setResponse($response);
  $view->initHandlers();
  return $view;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.