diff --git a/cli/Valet/PhpFpm.php b/cli/Valet/PhpFpm.php index 62ea8b4e0..e13530bcf 100644 --- a/cli/Valet/PhpFpm.php +++ b/cli/Valet/PhpFpm.php @@ -61,6 +61,7 @@ public function updateConfiguration() $contents = preg_replace('/^user = .+$/m', 'user = '.user(), $contents); $contents = preg_replace('/^group = .+$/m', 'group = staff', $contents); + $contents = preg_replace('/^listen = .+$/m', 'listen = 127.0.0.1:9000', $contents); $this->files->put($this->fpmConfigPath(), $contents); } diff --git a/tests/PhpFpmTest.php b/tests/PhpFpmTest.php index 108f0bd52..f16c728ba 100644 --- a/tests/PhpFpmTest.php +++ b/tests/PhpFpmTest.php @@ -22,14 +22,14 @@ public function tearDown() Mockery::close(); } - - public function test_update_configuration_replaces_user_and_group_in_config_file() + public function test_fpm_is_configured_with_the_correct_user_group_and_port() { copy(__DIR__.'/files/fpm.conf', __DIR__.'/output/fpm.conf'); resolve(StubForUpdatingFpmConfigFiles::class)->updateConfiguration(); $contents = file_get_contents(__DIR__.'/output/fpm.conf'); - $this->assertTrue(strpos($contents, 'user = '.user()) !== false); - $this->assertTrue(strpos($contents, 'group = staff') !== false); + $this->assertTrue(strpos($contents, sprintf("\nuser = %s", user())) !== false); + $this->assertTrue(strpos($contents, "\ngroup = staff") !== false); + $this->assertTrue(strpos($contents, "\nlisten = 127.0.0.1:9000") !== false); } } diff --git a/tests/files/fpm.conf b/tests/files/fpm.conf index 23c2f0f69..09129029f 100644 --- a/tests/files/fpm.conf +++ b/tests/files/fpm.conf @@ -2,5 +2,6 @@ Test contents user = something group = something-else +listen = /potentially/some.socket more contents