File tree Expand file tree Collapse file tree 3 files changed +105
-0
lines changed Expand file tree Collapse file tree 3 files changed +105
-0
lines changed Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <phpunit bootstrap =" vendor/autoload.php"
3
+ backupGlobals =" false"
4
+ backupStaticAttributes =" false"
5
+ colors =" true"
6
+ verbose =" true"
7
+ convertErrorsToExceptions =" true"
8
+ convertNoticesToExceptions =" true"
9
+ convertWarningsToExceptions =" true"
10
+ processIsolation =" false"
11
+ stopOnFailure =" false" >
12
+ <testsuites >
13
+ <testsuite name =" Unit Tests" >
14
+ <directory >tests</directory >
15
+ </testsuite >
16
+ </testsuites >
17
+ <filter >
18
+ <whitelist >
19
+ <directory suffix =" .php" >src/</directory >
20
+ </whitelist >
21
+ </filter >
22
+ </phpunit >
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Ilzrv \LaravelQueueSize \Tests ;
4
+
5
+ use Illuminate \Bus \Queueable ;
6
+ use Illuminate \Contracts \Queue \ShouldQueue ;
7
+ use Illuminate \Support \Facades \Artisan ;
8
+ use Illuminate \Support \Facades \Queue ;
9
+
10
+ class QueueSizeTest extends TestCase
11
+ {
12
+ /** @test */
13
+ public function the_command_is_correct ()
14
+ {
15
+ $ this
16
+ ->artisan ('queue:size ' )
17
+ ->expectsOutput (0 );
18
+ }
19
+
20
+ /** @test */
21
+ public function the_command_correct_counts ()
22
+ {
23
+ Queue::fake ();
24
+
25
+ dispatch (new TestJob1 );
26
+ dispatch (new TestJob1 );
27
+
28
+ $ this
29
+ ->artisan ('queue:size ' )
30
+ ->expectsOutput (2 );
31
+ }
32
+
33
+ /** @test */
34
+ public function the_command_counts_its_queue ()
35
+ {
36
+ Queue::fake ();
37
+
38
+ dispatch (new TestJob1 );
39
+ dispatch (new TestJob2 );
40
+
41
+ $ this
42
+ ->artisan ('queue:size ' , [
43
+ '--queue ' => 'another-queue '
44
+ ])
45
+ ->expectsOutput (1 );
46
+ }
47
+ }
48
+
49
+ class TestJob1 implements ShouldQueue
50
+ {
51
+ use Queueable;
52
+
53
+ public function __construct ()
54
+ {
55
+ $ this ->onQueue ('default ' );
56
+ }
57
+ }
58
+
59
+ class TestJob2 implements ShouldQueue
60
+ {
61
+ use Queueable;
62
+
63
+ public function __construct ()
64
+ {
65
+ $ this ->onQueue ('another-queue ' );
66
+ }
67
+ }
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace Ilzrv \LaravelQueueSize \Tests ;
4
+
5
+ use Ilzrv \LaravelQueueSize \ServiceProvider ;
6
+ use Orchestra \Testbench \TestCase as Orchestra ;
7
+
8
+ abstract class TestCase extends Orchestra
9
+ {
10
+ protected function getPackageProviders ($ app )
11
+ {
12
+ return [
13
+ ServiceProvider::class,
14
+ ];
15
+ }
16
+ }
You can’t perform that action at this time.
0 commit comments