Skip to content

Commit

Permalink
Merge pull request #26 from laravel/feat/php-8.1
Browse files Browse the repository at this point in the history
Adds PHP 8.1 support
  • Loading branch information
nunomaduro authored Oct 11, 2021
2 parents d134774 + 284f468 commit 34e986d
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 21 deletions.
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

0 comments on commit 34e986d

Please sign in to comment.