8000 [5.x] Merge develop (#1369) · laravel/horizon@b348621 · GitHub 8000
[go: up one dir, main page]

Skip to content

Commit b348621

Browse files
authored
[5.x] Merge develop (#1369)
* [develop] Adds L11 support (#1352) * Adds L11 support * Fixes service provider installation * Fixes service provider installation * Fixes service provider installation * Fixes static analysis * Improves test suite organization * Test without `runInSeparateProcess` * Adjusts installation process (#1353)
1 parent 22408b6 commit b348621

File tree

9 files changed

+47
-30
lines changed

9 files changed

+47
-30
lines changed

.github/workflows/tests.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,26 @@ jobs:
2424
fail-fast: true
2525
matrix:
2626
php: [7.3, 7.4, '8.0', 8.1, 8.2, 8.3]
27-
laravel: [8, 9, 10]
27+
laravel: [8, 9, 10, 11]
2828
exclude:
2929
- php: 7.3
3030
laravel: 9
3131
- php: 7.3
3232
laravel: 10
33+
- php: 7.3
34+
laravel: 11
3335
- php: 7.4
3436
laravel: 9
3537
- php: 7.4
3638
laravel: 10
39+
- php: 7.4
40+
laravel: 11
3741
- php: '8.0'
3842
laravel: 10
43+
- php: '8.0'
44+
laravel: 11
45+
- php: 8.1
46+
laravel: 11
3947
- php: 8.2
4048
laravel: 8
4149
- php: 8.3

composer.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,19 @@
1414
"ext-json": "*",
1515
"ext-pcntl": "*",
1616
"ext-posix": "*",
17-
"illuminate/contracts": "^8.17|^9.0|^10.0",
18-
"illuminate/queue": "^8.17|^9.0|^10.0",
19-
"illuminate/support": "^8.17|^9.0|^10.0",
17+
"illuminate/contracts": "^8.17|^9.0|^10.0|^11.0",
18+
"illuminate/queue": "^8.17|^9.0|^10.0|^11.0",
19+
"illuminate/support": "^8.17|^9.0|^10.0|^11.0",
2020
"nesbot/carbon": "^2.17",
2121
"ramsey/uuid": "^4.0",
22-
"symfony/process": "^5.0|^6.0",
23-
"symfony/error-handler": "^5.0|^6.0"
22+
"symfony/process": "^5.0|^6.0|^7.0",
23+
"symfony/error-handler": "^5.0|^6.0|^7.0"
2424
},
2525
"require-dev": {
2626
"mockery/mockery": "^1.0",
27-
"orchestra/testbench": "^6.0|^7.0|^8.0",
27+
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0",
2828
"phpstan/phpstan": "^1.10",
29-
"phpunit/phpunit": "^9.0",
29+
"phpunit/phpunit": "^9.0|^10.4",
3030
"predis/predis": "^1.1|^2.0"
3131
},
3232
"suggest": {

phpunit.xml.dist

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,14 @@
1616
verbose="true"
1717
>
1818
<testsuites>
19-
<testsuite name="Laravel Horizon Test Suite">
20-
<directory suffix="Test.php">./tests</directory>
19+
<testsuite name="Unit">
20+
<directory suffix="Test.php">./tests/Unit</directory>
21+
</testsuite>
22+
<testsuite name="Feature">
23+
<directory suffix="Test.php">./tests/Feature</directory>
24+
</testsuite>
25+
<testsuite name="Controller">
26+
<directory suffix="Test.php">./tests/Controller</directory>
2127
</testsuite>
2228
</testsuites>
2329
<php>

src/Console/InstallCommand.php

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Laravel\Horizon\Console;
44

55
use Illuminate\Console\Command;
6+
use Illuminate\Support\ServiceProvider;
67
use Illuminate\Support\Str;
78

89
class InstallCommand extends Command
@@ -51,17 +52,22 @@ protected function registerHorizonServiceProvider()
5152
{
5253
$namespace = Str::replaceLast('\\', '', $this->laravel->getNamespace());
5354

54-
$appConfig = file_get_contents(config_path('app.php'));
55+
if (file_exists($this->laravel->bootstrapPath('providers.php'))) {
56+
// @phpstan-ignore-next-line
57+
ServiceProvider::addProviderToBootstrapFile("{$namespace}\\Providers\\HorizonServiceProvider");
58+
} else {
59+
$appConfig = file_get_contents(config_path('app.php'));
5560

56-
if (Str::contains($appConfig, $namespace.'\\Providers\\HorizonServiceProvider::class')) {
57-
return;
58-
}
61+
if (Str::contains($appConfig, $namespace.'\\Providers\\HorizonServiceProvider::class')) {
62+
return;
63+
}
5964

60-
file_put_contents(config_path('app.php'), str_replace(
61-
"{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL,
62-
"{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL." {$namespace}\Providers\HorizonServiceProvider::class,".PHP_EOL,
63-
$appConfig
64-
));
65+
file_put_contents(config_path('app.php'), str_replace(
66+
"{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL,
67+
"{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL." {$namespace}\Providers\HorizonServiceProvider::class,".PHP_EOL,
68+
$appConfig
69+
));
70+
}
6571

6672
file_put_contents(app_path('Providers/HorizonServiceProvider.php'), str_replace(
6773
"namespace App\Providers;",

tests/Controller/DashboardStatsControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@
66
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
77
use Laravel\Horizon\Contracts\MetricsRepository;
88
use Laravel\Horizon\Contracts\SupervisorRepository;
9+
use Laravel\Horizon\Tests\ControllerTest;
910
use Laravel\Horizon\WaitTimeCalculator;
1011
use Mockery;
1112

12-
class DashboardStatsControllerTest extends AbstractControllerTest
13+
class DashboardStatsControllerTest extends ControllerTest
1314
{
1415
public function test_all_stats_are_correctly_returned()
1516
{

tests/Controller/MasterSupervisorControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
use Laravel\Horizon\MasterSupervisor;
88
use Laravel\Horizon\Supervisor;
99
use Laravel\Horizon\SupervisorOptions;
10+
use Laravel\Horizon\Tests\ControllerTest;
1011

11-
class MasterSupervisorControllerTest extends AbstractControllerTest
12+
class MasterSupervisorControllerTest extends ControllerTest
1213
{
1314
public function test_master_supervisor_listing_without_supervisors()
1415
{

tests/Controller/MonitoringControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
use Laravel\Horizon\Contracts\JobRepository;
66
use Laravel\Horizon\Contracts\TagRepository;
77
use Laravel\Horizon\JobPayload;
8+
use Laravel\Horizon\Tests\ControllerTest;
89
use Mockery;
910

10-
class MonitoringControllerTest extends AbstractControllerTest
11+
class MonitoringControllerTest extends ControllerTest
1112
{
1213
public function test_monitored_tags_and_job_counts_are_returned()
1314
{

tests/Controller/AbstractControllerTest.php renamed to tests/ControllerTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
<?php
22

3-
namespace Laravel\Horizon\Tests\Controller;
3+
namespace Laravel\Horizon\Tests;
44

55
use Laravel\Horizon\Horizon;
6-
use Laravel\Horizon\Tests\IntegrationTest;
76

8-
abstract class AbstractControllerTest extends IntegrationTest
7+
abstract class ControllerTest extends IntegrationTest
98
{
109
protected function setUp(): void
1110
{

tests/Feature/SupervisorCommandTest.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,6 @@ public function test_supervisor_command_can_start_paused_supervisors()
2525
$this->assertFalse($factory->supervisor->working);
2626
}
2727

28-
/**
29-
* @runInSeparateProcess
30-
*
31-
* @preserveGlobalState disabled
32-
*/
3328
public function test_supervisor_command_can_set_process_niceness()
3429
{
3530
$this->app->instance(SupervisorFactory::class, $factory = new FakeSupervisorFactory);

0 commit comments

Comments
 (0)
0