function BuildTestBase::visit
Same name in other branches
- 9 core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::visit()
- 8.9.x core/tests/Drupal/BuildTests/Framework/BuildTestBase.php \Drupal\BuildTests\Framework\BuildTestBase::visit()
- 10 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.
6 calls to BuildTestBase::visit()
- GenerateThemeTest::test in core/
tests/ Drupal/ Tests/ Core/ Command/ GenerateThemeTest.php - Tests the generate-theme command.
- GenerateThemeTest::test in core/
tests/ Drupal/ BuildTests/ Command/ GenerateThemeTest.php - Tests the generate-theme command.
- HtRouterTest::testHtRouter in core/
tests/ Drupal/ BuildTests/ Framework/ Tests/ HtRouterTest.php - @covers ::instantiateServer
- InstallTest::testInstall in core/
tests/ Drupal/ BuildTests/ TestSiteApplication/ InstallTest.php - QuickStartTestBase::formLogin in core/
tests/ Drupal/ BuildTests/ QuickStart/ QuickStartTestBase.php - Helper that uses Drupal's user/login form to log in.
1 method overrides BuildTestBase::visit()
- TemplateProjectTestBase::visit in core/
modules/ package_manager/ tests/ src/ Build/ TemplateProjectTestBase.php
File
-
core/
tests/ Drupal/ BuildTests/ Framework/ BuildTestBase.php, line 361
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.