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

[5.x] Merge develop #1369

Merged
merged 3 commits into from
Jan 15, 2024
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
10 changes: 9 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,26 @@ jobs:
fail-fast: true
matrix:
php: [7.3, 7.4, '8.0', 8.1, 8.2, 8.3]
laravel: [8, 9, 10]
laravel: [8, 9, 10, 11]
exclude:
- php: 7.3
laravel: 9
- php: 7.3
laravel: 10
- php: 7.3
laravel: 11
- php: 7.4
laravel: 9
- php: 7.4
laravel: 10
- php: 7.4
laravel: 11
- php: '8.0'
laravel: 10
- php: '8.0'
laravel: 11
- php: 8.1
laravel: 11
- php: 8.2
laravel: 8
- php: 8.3
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
"ext-json": "*",
"ext-pcntl": "*",
"ext-posix": "*",
"illuminate/contracts": "^8.17|^9.0|^10.0",
"illuminate/queue": "^8.17|^9.0|^10.0",
"illuminate/support": "^8.17|^9.0|^10.0",
"illuminate/contracts": "^8.17|^9.0|^10.0|^11.0",
"illuminate/queue": "^8.17|^9.0|^10.0|^11.0",
"illuminate/support": "^8.17|^9.0|^10.0|^11.0",
"nesbot/carbon": "^2.17",
"ramsey/uuid": "^4.0",
"symfony/process": "^5.0|^6.0",
"symfony/error-handler": "^5.0|^6.0"
"symfony/process": "^5.0|^6.0|^7.0",
"symfony/error-handler": "^5.0|^6.0|^7.0"
},
"require-dev": {
"mockery/mockery": "^1.0",
"orchestra/testbench": "^6.0|^7.0|^8.0",
"orchestra/testbench": "^6.0|^7.0|^8.0|^9.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^9.0",
"phpunit/phpunit": "^9.0|^10.4",
"predis/predis": "^1.1|^2.0"
},
"suggest": {
Expand Down
10 changes: 8 additions & 2 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,14 @@
verbose="true"
>
<testsuites>
<testsuite name="Laravel Horizon Test Suite">
<directory suffix="Test.php">./tests</directory>
<testsuite name="Unit">
<directory suffix="Test.php">./tests/Unit</directory>
</testsuite>
<testsuite name="Feature">
<directory suffix="Test.php">./tests/Feature</directory>
</testsuite>
<testsuite name="Controller">
<directory suffix="Test.php">./tests/Controller</directory>
</testsuite>
</testsuites>
<php>
Expand Down
24 changes: 15 additions & 9 deletions src/Console/InstallCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Laravel\Horizon\Console;

use Illuminate\Console\Command;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Str;

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

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

if (Str::contains($appConfig, $namespace.'\\Providers\\HorizonServiceProvider::class')) {
return;
}
if (Str::contains($appConfig, $namespace.'\\Providers\\HorizonServiceProvider::class')) {
return;
}

file_put_contents(config_path('app.php'), str_replace(
"{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL,
"{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL." {$namespace}\Providers\HorizonServiceProvider::class,".PHP_EOL,
$appConfig
));
file_put_contents(config_path('app.php'), str_replace(
"{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL,
"{$namespace}\\Providers\EventServiceProvider::class,".PHP_EOL." {$namespace}\Providers\HorizonServiceProvider::class,".PHP_EOL,
$appConfig
));
}

file_put_contents(app_path('Providers/HorizonServiceProvider.php'), str_replace(
"namespace App\Providers;",
Expand Down
3 changes: 2 additions & 1 deletion tests/Controller/DashboardStatsControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
use Laravel\Horizon\Contracts\MetricsRepository;
use Laravel\Horizon\Contracts\SupervisorRepository;
use Laravel\Horizon\Tests\ControllerTest;
use Laravel\Horizon\WaitTimeCalculator;
use Mockery;

class DashboardStatsControllerTest extends AbstractControllerTest
class DashboardStatsControllerTest extends ControllerTest
{
public function test_all_stats_are_correctly_returned()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Controller/MasterSupervisorControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
use Laravel\Horizon\MasterSupervisor;
use Laravel\Horizon\Supervisor;
use Laravel\Horizon\SupervisorOptions;
use Laravel\Horizon\Tests\ControllerTest;

class MasterSupervisorControllerTest extends AbstractControllerTest
class MasterSupervisorControllerTest extends ControllerTest
{
public function test_master_supervisor_listing_without_supervisors()
{
Expand Down
3 changes: 2 additions & 1 deletion tests/Controller/MonitoringControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
use Laravel\Horizon\Contracts\JobRepository;
use Laravel\Horizon\Contracts\TagRepository;
use Laravel\Horizon\JobPayload;
use Laravel\Horizon\Tests\ControllerTest;
use Mockery;

class MonitoringControllerTest extends AbstractControllerTest
class MonitoringControllerTest extends ControllerTest
{
public function test_monitored_tags_and_job_counts_are_returned()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<?php

namespace Laravel\Horizon\Tests\Controller;
namespace Laravel\Horizon\Tests;

use Laravel\Horizon\Horizon;
use Laravel\Horizon\Tests\IntegrationTest;

abstract class AbstractControllerTest extends IntegrationTest
abstract class ControllerTest extends IntegrationTest
{
protected function setUp(): void
{
Expand Down
5 changes: 0 additions & 5 deletions tests/Feature/SupervisorCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,6 @@ public function test_supervisor_command_can_start_paused_supervisors()
$this->assertFalse($factory->supervisor->working);
}

/**
* @runInSeparateProcess
*
* @preserveGlobalState disabled
*/
public function test_supervisor_command_can_set_process_niceness()
{
$this->app->instance(SupervisorFactory::class, $factory = new FakeSupervisorFactory);
Expand Down