1
0
mirror of https://github.com/laravel/valet.git synced 2026-02-08 01:10:08 +01:00

Set HTTP_HOST in BaseDriverTest

This commit is contained in:
Matt Stauffer
2022-12-11 13:04:36 -05:00
parent 0c27c62cec
commit f49b1b0e8a
9 changed files with 5 additions and 34 deletions

View File

@@ -2,6 +2,11 @@
class BaseDriverTestCase extends Yoast\PHPUnitPolyfills\TestCases\TestCase
{
public function set_up(): void
{
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
}
public function projects(): array
{
return Filesystem::scanDir(__DIR__.'/projects');

View File

@@ -18,8 +18,6 @@ public function test_it_serves_php_files_from_root()
$projectPath = $this->projectDir('basic-no-public');
$driver = new BasicValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$this->assertEquals(
$projectPath.'/file-in-root.php',
$driver->frontControllerPath($projectPath, 'my-site', '/file-in-root.php')
@@ -31,8 +29,6 @@ public function test_it_serves_directory_with_index_php()
$projectPath = $this->projectDir('basic-no-public');
$driver = new BasicValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$this->assertEquals(
$projectPath.'/about/index.php',
$driver->frontControllerPath($projectPath, 'my-site', '/about')
@@ -44,8 +40,6 @@ public function test_it_routes_to_index_if_404()
$projectPath = $this->projectDir('basic-no-public');
$driver = new BasicValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$this->assertEquals(
$projectPath.'/index.php',
$driver->frontControllerPath($projectPath, 'my-site', '/not-a-real-url')
@@ -57,8 +51,6 @@ public function test_it_serves_directory_with_index_html()
$projectPath = $this->projectDir('basic-no-public');
$driver = new BasicValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$this->assertEquals(
$projectPath.'/team/index.html',
$driver->isStaticFile($projectPath, 'my-site', '/team')
@@ -70,8 +62,6 @@ public function test_it_serves_static_files()
$projectPath = $this->projectDir('basic-no-public');
$driver = new BasicValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$this->assertEquals(
$projectPath.'/assets/document.txt',
$driver->isStaticFile($projectPath, 'my-site', '/assets/document.txt')

View File

@@ -23,8 +23,6 @@ public function test_it_serves_php_files_from_public()
$projectPath = $this->projectDir('public-with-index-non-laravel');
$driver = new BasicWithPublicValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$this->assertEquals(
$projectPath.'/public/file-in-public.php',
$driver->frontControllerPath($projectPath, 'my-site', '/file-in-public.php')
@@ -36,8 +34,6 @@ public function test_it_doesnt_serve_php_files_from_root()
$projectPath = $this->projectDir('public-with-index-non-laravel');
$driver = new BasicWithPublicValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$this->assertEquals(
$projectPath.'/public/index.php',
$driver->frontControllerPath($projectPath, 'my-site', '/file-in-root.php')
@@ -49,8 +45,6 @@ public function test_it_serves_directory_with_index_php()
$projectPath = $this->projectDir('public-with-index-non-laravel');
$driver = new BasicWithPublicValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$this->assertEquals(
$projectPath.'/public/about/index.php',
$driver->frontControllerPath($projectPath, 'my-site', '/about')
@@ -62,8 +56,6 @@ public function test_it_route_to_public_index_if_404()
$projectPath = $this->projectDir('public-with-index-non-laravel');
$driver = new BasicWithPublicValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$this->assertEquals(
$projectPath.'/public/index.php',
$driver->frontControllerPath($projectPath, 'my-site', '/not-a-real-url')
@@ -75,8 +67,6 @@ public function test_it_serves_directory_with_index_html()
$projectPath = $this->projectDir('public-with-index-non-laravel');
$driver = new BasicWithPublicValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$this->assertEquals(
$projectPath.'/public/team/index.html',
$driver->isStaticFile($projectPath, 'my-site', '/team')
@@ -88,8 +78,6 @@ public function test_it_serves_static_files()
$projectPath = $this->projectDir('public-with-index-non-laravel');
$driver = new BasicWithPublicValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$this->assertEquals(
$projectPath.'/public/assets/document.txt',
$driver->isStaticFile($projectPath, 'my-site', '/assets/document.txt')

View File

@@ -22,8 +22,6 @@ public function test_it_gets_front_controller()
{
$driver = new BedrockValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$projectPath = $this->projectDir('bedrock');
$this->assertEquals($projectPath.'/web/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
}

View File

@@ -22,8 +22,6 @@ public function test_it_gets_front_controller()
{
$driver = new CraftValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$projectPath = $this->projectDir('craft');
$this->assertEquals($projectPath.'/public/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
}

View File

@@ -22,8 +22,6 @@ public function test_it_gets_front_controller()
{
$driver = new DrupalValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$projectPath = $this->projectDir('drupal');
$this->assertEquals($projectPath.'/public/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
}

View File

@@ -22,8 +22,6 @@ public function test_it_gets_front_controller()
{
$driver = new JoomlaValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$projectPath = $this->projectDir('joomla');
$this->assertEquals($projectPath.'/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
}

View File

@@ -22,8 +22,6 @@ public function test_it_gets_front_controller()
{
$driver = new KirbyValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$projectPath = $this->projectDir('kirby');
$this->assertEquals($projectPath.'/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
}

View File

@@ -22,8 +22,6 @@ public function test_it_gets_front_controller()
{
$driver = new WordPressValetDriver();
$_SERVER['HTTP_HOST'] = 'this is set in Valet requests but not phpunit';
$projectPath = $this->projectDir('wordpress');
$this->assertEquals($projectPath.'/index.php', $driver->frontControllerPath($projectPath, 'my-site', '/'));
}