public function BuildTestBase::visit in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::visit()
Visit a URI on the HTTP server.
The concept here is that there could be multiple potential docroots in the workspace, so you can use whichever ones you want.
Parameters
string $request_uri: (optional) The non-host part of the URL. Example: /some/path?foo=bar. Defaults to visiting the homepage.
string $working_dir: (optional) Relative path within the test workspace file system that will be the docroot for the request. Defaults to the workspace directory.
Return value
\Behat\Mink\Mink The Mink object. Perform assertions against this.
Throws
\InvalidArgumentException Thrown when $request_uri does not start with a slash.
3 calls to BuildTestBase::visit()
- GenerateThemeTest::test in core/
tests/ Drupal/ Tests/ Core/ Command/ GenerateThemeTest.php - Tests the generate-theme command.
- HtRouterTest::testHtRouter in core/
tests/ Drupal/ BuildTests/ Framework/ Tests/ HtRouterTest.php - @covers ::instantiateServer
- QuickStartTestBase::formLogin in core/
tests/ Drupal/ BuildTests/ QuickStart/ QuickStartTestBase.php - Helper that uses Drupal's user/login form to log in.
File
- core/
tests/ Drupal/ BuildTests/ Framework/ BuildTestBase.php, line 353
Class
- BuildTestBase
- Provides a workspace to test build processes.
Namespace
Drupal\BuildTests\FrameworkCode
public function visit($request_uri = '/', $working_dir = NULL) {
if ($request_uri[0] !== '/') {
throw new \InvalidArgumentException('URI: ' . $request_uri . ' must be relative. Example: /some/path?foo=bar');
}
// Try to make a server.
$this
->standUpServer($working_dir);
$request = 'http://localhost:' . $this
->getPortNumber() . $request_uri;
$this->mink
->getSession()
->visit($request);
return $this->mink;
}