From 39d47ac7f78e3a8e0ade573550b19e60d38b5b09 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Tue, 31 Aug 2021 14:47:07 +0100 Subject: [PATCH 1/5] Adds PHP 8.1 support --- app/Commands/PhpLogsCommand.php | 2 +- app/Commands/PhpRestartCommand.php | 2 +- app/Commands/PhpStatusCommand.php | 2 +- tests/Feature/DaemonListCommandTest.php | 4 ++-- tests/Feature/DaemonLogsCommandTest.php | 10 +++++----- tests/Feature/DaemonRestartCommandTest.php | 8 ++++---- tests/Feature/PhpLogsTestCommandTest.php | 10 +++++----- tests/Feature/PhpRestartCommandTest.php | 2 +- tests/Feature/PhpStatusCommandTest.php | 2 +- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/app/Commands/PhpLogsCommand.php b/app/Commands/PhpLogsCommand.php index 3e6a538..88d62b0 100644 --- a/app/Commands/PhpLogsCommand.php +++ b/app/Commands/PhpLogsCommand.php @@ -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), diff --git a/app/Commands/PhpRestartCommand.php b/app/Commands/PhpRestartCommand.php index 0ecebed..3e6f012 100644 --- a/app/Commands/PhpRestartCommand.php +++ b/app/Commands/PhpRestartCommand.php @@ -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).'.'); diff --git a/app/Commands/PhpStatusCommand.php b/app/Commands/PhpStatusCommand.php index 94c13f8..94b8d31 100644 --- a/app/Commands/PhpStatusCommand.php +++ b/app/Commands/PhpStatusCommand.php @@ -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).'.'); diff --git a/tests/Feature/DaemonListCommandTest.php b/tests/Feature/DaemonListCommandTest.php index 450e0c4..6e35760 100644 --- a/tests/Feature/DaemonListCommandTest.php +++ b/tests/Feature/DaemonListCommandTest.php @@ -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'); }); diff --git a/tests/Feature/DaemonLogsCommandTest.php b/tests/Feature/DaemonLogsCommandTest.php index c8985fd..77b0ebb 100644 --- a/tests/Feature/DaemonLogsCommandTest.php +++ b/tests/Feature/DaemonLogsCommandTest.php @@ -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( @@ -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( @@ -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( @@ -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( @@ -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( diff --git a/tests/Feature/DaemonRestartCommandTest.php b/tests/Feature/DaemonRestartCommandTest.php index 0de321c..99518a5 100644 --- a/tests/Feature/DaemonRestartCommandTest.php +++ b/tests/Feature/DaemonRestartCommandTest.php @@ -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(); @@ -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') diff --git a/tests/Feature/PhpLogsTestCommandTest.php b/tests/Feature/PhpLogsTestCommandTest.php index b288c7b..2f1141d 100644 --- a/tests/Feature/PhpLogsTestCommandTest.php +++ b/tests/Feature/PhpLogsTestCommandTest.php @@ -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 () { @@ -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( diff --git a/tests/Feature/PhpRestartCommandTest.php b/tests/Feature/PhpRestartCommandTest.php index 60b832a..14a3d51 100644 --- a/tests/Feature/PhpRestartCommandTest.php +++ b/tests/Feature/PhpRestartCommandTest.php @@ -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( diff --git a/tests/Feature/PhpStatusCommandTest.php b/tests/Feature/PhpStatusCommandTest.php index 35c735e..9ef0751 100644 --- a/tests/Feature/PhpStatusCommandTest.php +++ b/tests/Feature/PhpStatusCommandTest.php @@ -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( From b09bfb3e20f852d0c666513df04e05d393b8fed3 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Tue, 31 Aug 2021 15:11:12 +0100 Subject: [PATCH 2/5] Adds PHP 8.1 testing on CI --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 61a62e8..59740f1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,6 +14,9 @@ jobs: fail-fast: true matrix: php: [7.3, 7.4, 8.0] + include: + - php: '8.1' + flags: "--ignore-platform-req=php" name: PHP ${{ matrix.php }} From f08b770a04139141c457708f2dd48a796d94d657 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Tue, 31 Aug 2021 15:26:43 +0100 Subject: [PATCH 3/5] Run static analysis only on PHP 8.0 --- .github/workflows/tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 59740f1..5f7e999 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,6 +38,7 @@ jobs: - name: Execute static analysis run: vendor/bin/phpstan + if: matrix.php === '8.0' - name: Execute unit/feature tests run: vendor/bin/pest From 2589e22add3b3a738c71c0993b5c65e57cfe65f0 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Tue, 31 Aug 2021 15:28:10 +0100 Subject: [PATCH 4/5] Fixes workflow --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 5f7e999..383de5e 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -38,7 +38,7 @@ jobs: - name: Execute static analysis run: vendor/bin/phpstan - if: matrix.php === '8.0' + if: matrix.php == '8.0' - name: Execute unit/feature tests run: vendor/bin/pest From 284f46821c040ce3cdd0164dd0329695766318cf Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 11 Oct 2021 15:22:51 +0100 Subject: [PATCH 5/5] No need to ignore platform on PHP 8.1 --- .github/workflows/tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 383de5e..7d0f0ff 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -14,9 +14,6 @@ jobs: fail-fast: true matrix: php: [7.3, 7.4, 8.0] - include: - - php: '8.1' - flags: "--ignore-platform-req=php" name: PHP ${{ matrix.php }}