function BuildTestBase::standUpServer

Same name and namespace in other branches
  1. 9 core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::standUpServer()
  2. 8.9.x core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::standUpServer()
  3. 11.x core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::standUpServer()

Makes a local test server using PHP's internal HTTP server.

Test authors should call visit() or assertVisit() instead.

Parameters

string|null $working_dir: (optional) Server docroot relative to the workspace file system. Defaults to the workspace directory.

3 calls to BuildTestBase::standUpServer()
BuildTestBase::visit in core/tests/Drupal/BuildTests/Framework/BuildTestBase.php
Visit a URI on the HTTP server.
BuildTestTest::testStandUpServer in core/tests/Drupal/BuildTests/Framework/Tests/BuildTestTest.php
@covers ::standUpServer[[api-linebreak]]
InstallTest::testInstall in core/tests/Drupal/BuildTests/TestSiteApplication/InstallTest.php

File

core/tests/Drupal/BuildTests/Framework/BuildTestBase.php, line 384

Class

BuildTestBase
Provides a workspace to test build processes.

Namespace

Drupal\BuildTests\Framework

Code

protected function standUpServer($working_dir = NULL) {
  // If the user wants to test a new docroot, we have to shut down the old
  // server process and generate a new port number.
  if ($working_dir !== $this->serverDocroot && !empty($this->serverProcess)) {
    $this->stopServer();
  }
  // If there's not a server at this point, make one.
  if (!$this->serverProcess || $this->serverProcess
    ->isTerminated()) {
    $this->serverProcess = $this->instantiateServer($this->getPortNumber(), $working_dir);
    if ($this->serverProcess) {
      $this->serverDocroot = $working_dir;
    }
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.