function WebTestBase::drupalGetWithFormat
Retrieves a Drupal path or an absolute path for a given format.
Parameters
\Drupal\Core\Url|string $path: Drupal path or URL to request given format from.
string $format: The wanted request format.
array $options: Array of URL options.
array $headers: Array of headers.
Return value
mixed The result of the request.
1 call to WebTestBase::drupalGetWithFormat()
- WebTestBase::drupalGetJSON in core/
modules/ simpletest/ src/ WebTestBase.php - Retrieves a Drupal path or an absolute path and JSON decodes the result.
File
-
core/
modules/ simpletest/ src/ WebTestBase.php, line 844
Class
- WebTestBase
- Test case for typical Drupal tests.
Namespace
Drupal\simpletestCode
protected function drupalGetWithFormat($path, $format, array $options = [], array $headers = []) {
$options = array_merge_recursive([
'query' => [
'_format' => $format,
],
], $options);
return $this->drupalGet($path, $options, $headers);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.