From 8831cfe7ce84887a8e0ff6f7723e6a28d484d141 Mon Sep 17 00:00:00 2001 From: Adam Wathan Date: Fri, 23 Sep 2016 10:15:11 -0400 Subject: [PATCH] Explicitly set PHP FPM port on install --- cli/Valet/PhpFpm.php | 1 + tests/PhpFpmTest.php | 8 ++++---- tests/files/fpm.conf | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) 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