Skip to content

Commit

Permalink
Explicitly set PHP FPM port on install
Browse files Browse the repository at this point in the history
  • Loading branch information
adamwathan committed Sep 23, 2016
1 parent 5e7a27e commit 8831cfe
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions cli/Valet/PhpFpm.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/PhpFpmTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
1 change: 1 addition & 0 deletions tests/files/fpm.conf
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ Test contents

user = something
group = something-else
listen = /potentially/some.socket

more contents

0 comments on commit 8831cfe

Please sign in to comment.