function UnroutedUrlAssemblerTest::setupRequestStack
Setups the request stack for a given subdir.
Parameters
bool $subdir: TRUE to use a subdir.
5 calls to UnroutedUrlAssemblerTest::setupRequestStack()
- UnroutedUrlAssemblerTest::testAssembleWithEnabledProcessing in core/tests/ Drupal/ Tests/ Core/ Utility/ UnroutedUrlAssemblerTest.php 
- @covers ::assemble[[api-linebreak]]
- UnroutedUrlAssemblerTest::testAssembleWithExternalUrl in core/tests/ Drupal/ Tests/ Core/ Utility/ UnroutedUrlAssemblerTest.php 
- @covers ::assemble[[api-linebreak]] @covers ::buildExternalUrl[[api-linebreak]]
- UnroutedUrlAssemblerTest::testAssembleWithLocalUri in core/tests/ Drupal/ Tests/ Core/ Utility/ UnroutedUrlAssemblerTest.php 
- @covers ::assemble[[api-linebreak]] @covers ::buildLocalUrl[[api-linebreak]]
- UnroutedUrlAssemblerTest::testAssembleWithNotEnabledProcessing in core/tests/ Drupal/ Tests/ Core/ Utility/ UnroutedUrlAssemblerTest.php 
- @covers ::assemble[[api-linebreak]]
- UnroutedUrlAssemblerTest::testAssembleWithStartingSlashEnabledProcessing in core/tests/ Drupal/ Tests/ Core/ Utility/ UnroutedUrlAssemblerTest.php 
- @covers ::assemble[[api-linebreak]]
File
- 
              core/tests/ Drupal/ Tests/ Core/ Utility/ UnroutedUrlAssemblerTest.php, line 203 
Class
- UnroutedUrlAssemblerTest
- @coversDefaultClass \Drupal\Core\Utility\UnroutedUrlAssembler[[api-linebreak]] @group Utility
Namespace
Drupal\Tests\Core\UtilityCode
protected function setupRequestStack($subdir) {
  $server = [];
  if ($subdir) {
    // Setup a fake request which looks like a Drupal installed under the
    // subdir "subdir" on the domain www.example.com.
    // To reproduce the values install Drupal like that and use a debugger.
    $server = [
      'SCRIPT_NAME' => '/subdir/index.php',
      'SCRIPT_FILENAME' => $this->root . '/index.php',
      'SERVER_NAME' => 'www.example.com',
    ];
    $request = Request::create('/subdir/');
  }
  else {
    $request = Request::create('/');
  }
  $request->server
    ->add($server);
  $this->requestStack
    ->push($request);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
