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

Drop space before colon in magic isolation string

This commit is contained in:
Matt Stauffer
2022-03-14 12:42:11 -04:00
parent 8f7ea041b6
commit 3cdb7c78f4
4 changed files with 17 additions and 17 deletions

View File

@@ -1104,6 +1104,6 @@ public function replaceSockFile($siteConf, $phpVersion)
$siteConf = preg_replace('/valet[0-9]*.sock/', $sockFile, $siteConf); $siteConf = preg_replace('/valet[0-9]*.sock/', $sockFile, $siteConf);
$siteConf = preg_replace('/# Valet isolated PHP version.*\n/', '', $siteConf); // Remove `Valet isolated PHP version` line from config $siteConf = preg_replace('/# Valet isolated PHP version.*\n/', '', $siteConf); // Remove `Valet isolated PHP version` line from config
return '# Valet isolated PHP version : '.$phpVersion.PHP_EOL.$siteConf; return '# Valet isolated PHP version: '.$phpVersion.PHP_EOL.$siteConf;
} }
} }

View File

@@ -1,4 +1,4 @@
# Valet isolated PHP version : VALET_ISOLATED_PHP_VERSION # Valet isolated PHP version: VALET_ISOLATED_PHP_VERSION
server { server {
listen 127.0.0.1:80; listen 127.0.0.1:80;
server_name VALET_SITE www.VALET_SITE *.VALET_SITE; server_name VALET_SITE www.VALET_SITE *.VALET_SITE;

View File

@@ -93,15 +93,15 @@ public function test_utilized_php_versions()
$sites = [ $sites = [
[ [
'site' => 'isolated-site-71.test', 'site' => 'isolated-site-71.test',
'conf' => '# Valet isolated PHP version : 71'.PHP_EOL.'valet71.sock', 'conf' => '# Valet isolated PHP version: 71'.PHP_EOL.'valet71.sock',
], ],
[ [
'site' => 'isolated-site-72.test', 'site' => 'isolated-site-72.test',
'conf' => '# Valet isolated PHP version : php@7.2'.PHP_EOL.'valet72.sock', 'conf' => '# Valet isolated PHP version: php@7.2'.PHP_EOL.'valet72.sock',
], ],
[ [
'site' => 'isolated-site-73.test', 'site' => 'isolated-site-73.test',
'conf' => '# Valet isolated PHP version : 73'.PHP_EOL.'valet.sock', 'conf' => '# Valet isolated PHP version: 73'.PHP_EOL.'valet.sock',
], ],
]; ];
@@ -135,11 +135,11 @@ public function test_it_lists_isolated_directories()
$sites = [ $sites = [
[ [
'site' => 'isolated-site-71.test', 'site' => 'isolated-site-71.test',
'conf' => '# Valet isolated PHP version : 71' . PHP_EOL . 'valet71.sock', 'conf' => '# Valet isolated PHP version: 71' . PHP_EOL . 'valet71.sock',
], ],
[ [
'site' => 'isolated-site-72.test', 'site' => 'isolated-site-72.test',
'conf' => '# Valet isolated PHP version : php@7.2' . PHP_EOL . 'valet72.sock', 'conf' => '# Valet isolated PHP version: php@7.2' . PHP_EOL . 'valet72.sock',
], ],
[ [
'site' => 'not-isolated-site.test', 'site' => 'not-isolated-site.test',

View File

@@ -659,13 +659,13 @@ public function test_can_install_nginx_site_config_for_specific_php_version()
$files->shouldReceive('get') $files->shouldReceive('get')
->once() ->once()
->with($siteMock->nginxPath('site1.test')) ->with($siteMock->nginxPath('site1.test'))
->andReturn('# Valet isolated PHP version : php@7.4'.PHP_EOL.'server { fastcgi_pass: valet74.sock }'); ->andReturn('# Valet isolated PHP version: php@7.4'.PHP_EOL.'server { fastcgi_pass: valet74.sock }');
$files->shouldReceive('putAsUser') $files->shouldReceive('putAsUser')
->once() ->once()
->withArgs([ ->withArgs([
$siteMock->nginxPath('site1.test'), $siteMock->nginxPath('site1.test'),
'# Valet isolated PHP version : php@8.0'.PHP_EOL.'server { fastcgi_pass: valet80.sock }', '# Valet isolated PHP version: php@8.0'.PHP_EOL.'server { fastcgi_pass: valet80.sock }',
]); ]);
$siteMock->isolate('site1.test', 'php@8.0'); $siteMock->isolate('site1.test', 'php@8.0');
@@ -682,7 +682,7 @@ public function test_can_install_nginx_site_config_for_specific_php_version()
->withArgs([ ->withArgs([
$siteMock->nginxPath('site2.test'), $siteMock->nginxPath('site2.test'),
Mockery::on(function ($argument) { Mockery::on(function ($argument) {
return preg_match('/^# Valet isolated PHP version : php@8.0/', $argument) return preg_match('/^# Valet isolated PHP version: php@8.0/', $argument)
&& preg_match('#fastcgi_pass "unix:.*/valet80.sock#', $argument) && preg_match('#fastcgi_pass "unix:.*/valet80.sock#', $argument)
&& strpos($argument, 'server_name site2.test www.site2.test *.site2.test;') !== false; && strpos($argument, 'server_name site2.test www.site2.test *.site2.test;') !== false;
}), }),
@@ -733,7 +733,7 @@ public function test_retrieves_custom_php_version_from_nginx_config()
$files->shouldReceive('get') $files->shouldReceive('get')
->once() ->once()
->with($siteMock->nginxPath('site1.test')) ->with($siteMock->nginxPath('site1.test'))
->andReturn('# Valet isolated PHP version : php@7.4'); ->andReturn('# Valet isolated PHP version: php@7.4');
$this->assertEquals('74', resolve(Site::class)->customPhpVersion('site1.test')); $this->assertEquals('74', resolve(Site::class)->customPhpVersion('site1.test'));
// Site without any custom nginx config // Site without any custom nginx config
@@ -757,28 +757,28 @@ public function test_replace_sock_file_in_nginx_config()
// When switching to php71, valet71.sock should be replaced with valet.sock; // When switching to php71, valet71.sock should be replaced with valet.sock;
// isolation header should be prepended // isolation header should be prepended
$this->assertEquals( $this->assertEquals(
'# Valet isolated PHP version : 71'.PHP_EOL.'server { fastcgi_pass: valet71.sock }', '# Valet isolated PHP version: 71'.PHP_EOL.'server { fastcgi_pass: valet71.sock }',
$site->replaceSockFile('server { fastcgi_pass: valet71.sock }', '71') $site->replaceSockFile('server { fastcgi_pass: valet71.sock }', '71')
); );
// When switching to php72, valet.sock should be replaced with valet72.sock // When switching to php72, valet.sock should be replaced with valet72.sock
$this->assertEquals( $this->assertEquals(
'# Valet isolated PHP version : 72'.PHP_EOL.'server { fastcgi_pass: valet72.sock }', '# Valet isolated PHP version: 72'.PHP_EOL.'server { fastcgi_pass: valet72.sock }',
$site->replaceSockFile('server { fastcgi_pass: valet.sock }', '72') $site->replaceSockFile('server { fastcgi_pass: valet.sock }', '72')
); );
// When switching to php73 from php72, valet72.sock should be replaced with valet73.sock; // When switching to php73 from php72, valet72.sock should be replaced with valet73.sock;
// isolation header should be updated to php@7.3 // isolation header should be updated to php@7.3
$this->assertEquals( $this->assertEquals(
'# Valet isolated PHP version : 73'.PHP_EOL.'server { fastcgi_pass: valet73.sock }', '# Valet isolated PHP version: 73'.PHP_EOL.'server { fastcgi_pass: valet73.sock }',
$site->replaceSockFile('# Valet isolated PHP version : 72'.PHP_EOL.'server { fastcgi_pass: valet72.sock }', '73') $site->replaceSockFile('# Valet isolated PHP version: 72'.PHP_EOL.'server { fastcgi_pass: valet72.sock }', '73')
); );
// When switching to php72 from php74, valet72.sock should be replaced with valet74.sock; // When switching to php72 from php74, valet72.sock should be replaced with valet74.sock;
// isolation header should be updated to php@7.4 // isolation header should be updated to php@7.4
$this->assertEquals( $this->assertEquals(
'# Valet isolated PHP version : php@7.4'.PHP_EOL.'server { fastcgi_pass: valet74.sock }', '# Valet isolated PHP version: php@7.4'.PHP_EOL.'server { fastcgi_pass: valet74.sock }',
$site->replaceSockFile('# Valet isolated PHP version : 72'.PHP_EOL.'server { fastcgi_pass: valet.sock }', 'php@7.4') $site->replaceSockFile('# Valet isolated PHP version: 72'.PHP_EOL.'server { fastcgi_pass: valet.sock }', 'php@7.4')
); );
} }