File tree 5 files changed +18
-51
lines changed
5 files changed +18
-51
lines changed Original file line number Diff line number Diff line change 4
4
push :
5
5
branches :
6
6
- master
7
+ - ' test-improvements'
7
8
- ' *.x'
8
9
pull_request :
9
10
schedule :
56
57
57
58
- name : Install dependencies
58
59
run : |
59
- composer require "illuminate/contracts=^${{ matrix.laravel }}" --dev --no-update
60
- composer update --prefer-dist --no-interaction --no-progress
60
+ composer update --prefer-dist --no-interaction --no-progress --with="illuminate/contracts:^${{ matrix.laravel }}"
61
61
62
62
- name : Execute tests
63
63
run : vendor/bin/phpunit
Original file line number Diff line number Diff line change 11
11
use Laravel \Horizon \Listeners \MarkJobAsComplete ;
12
12
use Laravel \Horizon \Tests \IntegrationTest ;
13
13
use Mockery as m ;
14
+ use Orchestra \Testbench \Attributes \WithConfig ;
14
15
16
+ #[WithConfig('horizon.silenced ' , ['App \\Jobs \\ConfigJob ' ])]
15
17
class MarkJobAsCompleteTest extends IntegrationTest
16
18
{
17
- protected function tearDown (): void
18
- {
19
- parent ::tearDown ();
20
-
21
- m::close ();
22
- }
23
-
24
- protected function getEnvironmentSetUp ($ app ): void
25
- {
26
- parent ::getEnvironmentSetUp ($ app );
27
-
28
- $ app ['config ' ]->set ('horizon.silenced ' , [
29
- 'App \\Jobs \\ConfigJob ' ,
30
- ]);
31
- }
32
-
33
19
public function test_it_can_mark_a_job_as_complete (): void
34
20
{
35
21
$ this ->runScenario ('App \\Jobs \\TestJob ' , false );
Original file line number Diff line number Diff line change @@ -49,6 +49,7 @@ protected function tearDown(): void
49
49
parent ::tearDown ();
50
50
}
51
51
52
+ /** @requires extension redis */
52
53
public function test_supervisor_can_start_worker_process_with_given_options ()
53
54
{
54
55
Queue::push (new Jobs \BasicJob );
@@ -260,6 +261,7 @@ public function test_supervisor_can_restart_processes()
260
261
$ this ->assertNotEquals ($ pid , $ supervisor ->processes ()[0 ]->getPid ());
261
262
}
262
263
264
+ /** @requires extension redis */
263
265
public function test_processes_can_be_paused_and_continued ()
264
266
{
265
267
$ options = $ this ->supervisorOptions ();
Original file line number Diff line number Diff line change @@ -20,24 +20,18 @@ abstract class IntegrationTest extends TestCase
20
20
*/
21
21
protected function setUp (): void
22
22
{
23
- parent ::setUp ();
24
-
25
- Redis::flushall ();
26
- }
23
+ $ this ->afterApplicationCreated (function () {
24
+ Redis::flushall ();
25
+ });
27
26
28
- /**
29
- * Tear down the test case.
30
- *
31
- * @return void
32
- */
33
- protected function tearDown (): void
34
- {
35
- parent ::tearDown ();
27
+ $ this ->beforeApplicationDestroyed (function () {
28
+ Redis::flushall ();
29
+ WorkerCommandString::reset ();
30
+ SupervisorCommandString::reset ();
31
+ Horizon::$ authUsing = null ;
32
+ });
36
33
37
- Redis::flushall ();
38
- WorkerCommandString::reset ();
39
- SupervisorCommandString::reset ();
40
- Horizon::$ authUsing = null ;
34
+ parent ::setUp ();
41
35
}
42
36
43
37
/**
Original file line number Diff line number Diff line change 7
7
use Illuminate \Queue \QueueManager ;
8
8
use Illuminate \Queue \Worker ;
9
9
use Illuminate \Queue \WorkerOptions ;
10
- use Orchestra \Testbench \Concerns \CreatesApplication ;
11
10
12
- $ appLoader = new class
13
- {
14
- use CreatesApplication;
15
-
16
- /**
17
- * Define environment setup.
18
- *
19
- * @param \Illuminate\Foundation\Application $app
20
- * @return void
21
- */
22
- protected function getEnvironmentSetUp ($ app )
23
- {
24
- // Define your environment setup.
25
- }
26
- };
11
+ use function Orchestra \Testbench \container ;
27
12
28
13
// Configure the application...
29
- $ app = $ appLoader ->createApplication ();
14
+ $ app = container () ->createApplication ();
30
15
$ app ->register (Laravel \Horizon \HorizonServiceProvider::class);
31
16
$ app ->make ('config ' )->set ('queue.default ' , 'redis ' );
32
17
You can’t perform that action at this time.
0 commit comments