Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds PHP 8.1 support #26

Merged
merged 5 commits into from
Oct 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ jobs:
- name: Execute static analysis
run: vendor/bin/phpstan
if: matrix.php == '8.0'

- name: Execute unit/feature tests
run: vendor/bin/pest
2 changes: 1 addition & 1 deletion app/Commands/PhpLogsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function handle()
$this->ensurePhpExists();

$version = $this->argument('version');
$versions = ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0'];
$versions = ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'];

abort_if(
! is_null($version) && ! in_array($version, $versions),
Expand Down
2 changes: 1 addition & 1 deletion app/Commands/PhpRestartCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function handle()
$server = $this->currentServer();

$version = $this->argument('version');
$versions = ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0'];
$versions = ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'];

if (! is_null($version) && ! in_array($version, $versions)) {
abort(1, 'PHP version needs to be one of these values: '.implode(', ', $versions).'.');
Expand Down
2 changes: 1 addition & 1 deletion app/Commands/PhpStatusCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function handle()
$server = $this->currentServer();

$version = $this->argument('version');
$versions = ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0'];
$versions = ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1'];

if (! is_null($version) && ! in_array($version, $versions)) {
abort(1, 'PHP version needs to be one of these values: '.implode(', ', $versions).'.');
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/DaemonListCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

$this->client->shouldReceive('daemons')->andReturn([
(object) ['id' => 1, 'command' => 'php7.4 artisan websockets:serve', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.0 artisan queue:work', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.1 artisan queue:work', 'status' => 'installed'],
]);

$this->artisan('daemon:list')
->expectsTable([' ID', ' Command', ' Status'], [
['id' => ' 1', 'name' => ' php7.4 artisan websockets:serve', 'phpVersion' => ' Installed'],
['id' => ' 2', 'name' => ' php8.0 artisan queue:work', 'phpVersion' => ' Installed'],
['id' => ' 2', 'name' => ' php8.1 artisan queue:work', 'phpVersion' => ' Installed'],
], 'compact');
});
10 changes: 5 additions & 5 deletions tests/Feature/DaemonLogsCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

$this->client->shouldReceive('daemons')->andReturn([
(object) ['id' => 1, 'command' => 'php7.4 artisan websockets:serve', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.0 artisan queue:work', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.1 artisan queue:work', 'status' => 'installed'],
]);

$this->client->shouldReceive('daemon')->andReturn(
Expand All @@ -33,7 +33,7 @@

$this->client->shouldReceive('daemons')->andReturn([
(object) ['id' => 1, 'command' => 'php7.4 artisan websockets:serve', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.0 artisan queue:work', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.1 artisan queue:work', 'status' => 'installed'],
]);

$this->client->shouldReceive('daemon')->andReturn(
Expand All @@ -59,7 +59,7 @@

$this->client->shouldReceive('daemons')->andReturn([
(object) ['id' => 1, 'command' => 'php7.4 artisan websockets:serve', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.0 artisan queue:work', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.1 artisan queue:work', 'status' => 'installed'],
]);

$this->client->shouldReceive('daemon')->andReturn(
Expand All @@ -86,7 +86,7 @@

$this->client->shouldReceive('daemons')->andReturn([
(object) ['id' => 1, 'command' => 'php7.4 artisan websockets:serve', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.0 artisan queue:work', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.1 artisan queue:work', 'status' => 'installed'],
]);

$this->client->shouldReceive('daemon')->andReturn(
Expand All @@ -109,7 +109,7 @@

$this->client->shouldReceive('daemons')->andReturn([
(object) ['id' => 1, 'command' => 'php7.4 artisan websockets:serve', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.0 artisan queue:work', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.1 artisan queue:work', 'status' => 'installed'],
]);

$this->client->shouldReceive('daemon')->andReturn(
Expand Down
8 changes: 4 additions & 4 deletions tests/Feature/DaemonRestartCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@

$this->client->shouldReceive('daemons')->andReturn([
(object) ['id' => 1, 'command' => 'php7.4 artisan websockets:serve', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.0 artisan queue:work', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.1 artisan queue:work', 'status' => 'installed'],
]);

$this->client->shouldReceive('daemon')->with(1, 2)->once()->andReturn(
(object) ['id' => 2, 'command' => 'php8.0 artisan queue:work', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.1 artisan queue:work', 'status' => 'installed'],
);

$this->client->shouldReceive('restartDaemon')->with(1, 2, false)->once();
Expand All @@ -28,11 +28,11 @@

$this->client->shouldReceive('daemons')->andReturn([
(object) ['id' => 1, 'command' => 'php7.4 artisan websockets:serve', 'status' => 'restarting'],
(object) ['id' => 2, 'command' => 'php8.0 artisan queue:work', 'status' => 'installed'],
(object) ['id' => 2, 'command' => 'php8.1 artisan queue:work', 'status' => 'installed'],
]);

$this->client->shouldReceive('daemon')->with(1, 1)->once()->andReturn(
(object) ['id' => 2, 'command' => 'php8.0 artisan queue:work', 'status' => 'restarting'],
(object) ['id' => 2, 'command' => 'php8.1 artisan queue:work', 'status' => 'restarting'],
);

$this->artisan('daemon:restart')
Expand Down
10 changes: 5 additions & 5 deletions tests/Feature/PhpLogsTestCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
);

$this->client->shouldReceive('logs')
->with(Mockery::any(), 'php80')
->with(Mockery::any(), 'php81')
->andReturn((object) [
'content' => " tail: cannot open '/var/log/php8.0-fpm.log' for reading: No such file or directory\n ",
'content' => " tail: cannot open '/var/log/php8.1-fpm.log' for reading: No such file or directory\n ",
]);

$this->artisan('php:logs', ['version' => '8.0'])
->expectsOutput(" ▕ tail: cannot open '/var/log/php8.0-fpm.log' for reading: No such file or directory");
$this->artisan('php:logs', ['version' => '8.1'])
->expectsOutput(" ▕ tail: cannot open '/var/log/php8.1-fpm.log' for reading: No such file or directory");
});

it('can not retrieve logs when php version is incorrect', function () {
Expand All @@ -37,7 +37,7 @@
);

$this->artisan('php:logs', ['version' => '2.0']);
})->throws('PHP version needs to be one of these values: 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0.');
})->throws('PHP version needs to be one of these values: 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1.');

it('can not display the logs when there is no php', function () {
$this->client->shouldReceive('server')->andReturn(
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/PhpRestartCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
);

$this->artisan('php:restart', ['version' => '2.0']);
})->throws('PHP version needs to be one of these values: 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0.');
})->throws('PHP version needs to be one of these values: 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1.');

it('can not restart php when there is no php', function () {
$this->client->shouldReceive('server')->andReturn(
Expand Down
2 changes: 1 addition & 1 deletion tests/Feature/PhpStatusCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
);

$this->artisan('php:status', ['version' => '2.0']);
})->throws('PHP version needs to be one of these values: 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0.');
})->throws('PHP version needs to be one of these values: 5.6, 7.0, 7.1, 7.2, 7.3, 7.4, 8.0, 8.1.');

it('can not display the status when there is no php', function () {
$this->client->shouldReceive('server')->andReturn(
Expand Down