public function UrlTransformRelativeTest::testFileUrlTransformRelative in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/File/UrlTransformRelativeTest.php \Drupal\KernelTests\Core\File\UrlTransformRelativeTest::testFileUrlTransformRelative()
- 10 core/tests/Drupal/KernelTests/Core/File/UrlTransformRelativeTest.php \Drupal\KernelTests\Core\File\UrlTransformRelativeTest::testFileUrlTransformRelative()
Tests file_url_transform_relative function.
@dataProvider providerFileUrlTransformRelative
File
- core/
tests/ Drupal/ KernelTests/ Core/ File/ UrlTransformRelativeTest.php, line 22
Class
- UrlTransformRelativeTest
- Tests url transform to relative.
Namespace
Drupal\KernelTests\Core\FileCode
public function testFileUrlTransformRelative($host, $port, $https, $url, $expected) {
$_SERVER['REMOTE_ADDR'] = '127.0.0.1';
$_SERVER['SERVER_ADDR'] = '127.0.0.1';
$_SERVER['SERVER_PORT'] = $port;
$_SERVER['SERVER_SOFTWARE'] = NULL;
$_SERVER['SERVER_NAME'] = $host;
$_SERVER['REQUEST_URI'] = '/';
$_SERVER['REQUEST_METHOD'] = 'GET';
$_SERVER['SCRIPT_NAME'] = '/index.php';
$_SERVER['SCRIPT_FILENAME'] = '/index.php';
$_SERVER['PHP_SELF'] = '/index.php';
$_SERVER['HTTP_USER_AGENT'] = 'Drupal command line';
$_SERVER['HTTPS'] = $https;
$request = Request::createFromGlobals();
\Drupal::requestStack()
->push($request);
$this
->assertSame($expected, file_url_transform_relative($url));
}