9 use \Magento\Framework\App\SetupInfo;
18 private static $fixture = [
'DOCUMENT_ROOT' =>
'/doc/root',
'SCRIPT_FILENAME' =>
'/doc/root/dir/file.php'];
27 $this->expectException(
'\InvalidArgumentException');
28 $this->expectExceptionMessage($expectedError);
37 $docRootErr =
'DOCUMENT_ROOT variable is unavailable.';
38 $projectRootErr =
'Project root cannot be automatically detected.';
41 [[
'DOCUMENT_ROOT' =>
''], $docRootErr],
42 [[
'DOCUMENT_ROOT' =>
'/foo'], $projectRootErr],
43 [[
'DOCUMENT_ROOT' =>
'/foo',
'SCRIPT_FILENAME' =>
''], $projectRootErr],
55 $this->assertEquals($expected,
$info->getUrl());
74 'http://example.com/',
87 $this->assertEquals($expected,
$info->getProjectUrl());
97 [self::$fixture + [
'HTTP_HOST' =>
''],
''],
99 [
'DOCUMENT_ROOT' =>
'/foo/bar',
'SCRIPT_FILENAME' =>
'/other/baz.php',
'HTTP_HOST' =>
'example.com'],
100 'http://example.com/' 102 [self::$fixture + [
'HTTP_HOST' =>
'example.com'],
'http://example.com/dir/'],
104 [
'DOCUMENT_ROOT' =>
'/foo/bar',
'SCRIPT_FILENAME' =>
'/foo/bar/baz.php',
'HTTP_HOST' =>
'example.com'],
105 'http://example.com/' 119 $this->assertEquals($expected,
$info->getDir($projectRoot));
154 $this->assertEquals($expected,
$info->isAvailable());
164 'root = doc root, but no "setup" sub-directory' => [
168 'root = doc root, nonexistent sub-directory' => [
172 'root = doc root, existent sub-directory' => [
176 'root within doc root, existent sub-directory' => [
178 'DOCUMENT_ROOT' => dirname(
__DIR__),
184 'root outside of doc root, existent sub-directory' => [
187 'SCRIPT_FILENAME' => dirname(dirname(
__DIR__)) .
'/foo.php',
192 'root within doc root, existent sub-directory, trailing slash' => [
194 'DOCUMENT_ROOT' => dirname(
__DIR__) . DIRECTORY_SEPARATOR,
200 'root within doc root + pub, existent sub-directory' => [
202 'DOCUMENT_ROOT' =>
__DIR__ .
'/_files/pub/',
203 'SCRIPT_FILENAME' =>
__DIR__ .
'/_files/pub/index.php',
testGetUrl($server, $expected)
isAvailableDataProvider()
defined('TESTS_BP')||define('TESTS_BP' __DIR__
constructorExceptionsDataProvider()
testIsAvailable($server, $expected)
defined('MTF_BOOT_FILE')||define('MTF_BOOT_FILE' __FILE__
testGetDir($server, $projectRoot, $expected)
getProjectUrlDataProvider()
const PARAM_NOT_INSTALLED_URL_PATH
testGetProjectUrl($server, $expected)
testConstructorExceptions($server, $expectedError)
const PARAM_NOT_INSTALLED_URL
foreach( $_productCollection as $_product)() ?>" class $info