Commit 319cc36 1 parent 1067705 commit 319cc36 Copy full SHA for 319cc36
File tree 2 files changed +40
-2
lines changed
2 files changed +40
-2
lines changed Original file line number Diff line number Diff line change @@ -44,11 +44,11 @@ class JobStatus extends Enum implements JobStatusContract
44
44
45
45
public function isActive (): bool
46
46
{
47
- return $ this ->isAnyOf ( self ::QUEUED (), self ::PROCESSING () );
47
+ return in_array ( $ this ->value (), [ static ::QUEUED , static ::PROCESSING ] );
48
48
}
49
49
50
50
public function hasEnded (): bool
51
51
{
52
- return $ this ->isAnyOf ( self ::COMPLETED (), self ::FAILED () );
52
+ return in_array ( $ this ->value (), [ static ::COMPLETED , static ::FAILED ] );
53
53
}
54
54
}
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ declare (strict_types=1 );
4
+
5
+ namespace Konekt \History \Tests ;
6
+
7
+ use Konekt \History \Models \JobStatus ;
8
+
9
+ class JobStatusTest extends TestCase
10
+ {
11
+ /** @test */
12
+ public function it_can_tell_whether_it_has_ended ()
13
+ {
14
+ $ completed = JobStatus::COMPLETED ();
15
+ $ failed = JobStatus::FAILED ();
16
+ $ queued = JobStatus::QUEUED ();
17
+ $ processing = JobStatus::PROCESSING ();
18
+
19
+ $ this ->assertTrue ($ completed ->hasEnded ());
20
+ $ this ->assertTrue ($ failed ->hasEnded ());
21
+ $ this ->assertFalse ($ queued ->hasEnded ());
22
+ $ this ->assertFalse ($ processing ->hasEnded ());
23
+ }
24
+
25
+ /** @test */
26
+ public function it_can_tell_whether_it_is_active ()
27
+ {
28
+ $ queued = JobStatus::QUEUED ();
29
+ $ processing = JobStatus::PROCESSING ();
30
+ $ completed = JobStatus::COMPLETED ();
31
+ $ failed = JobStatus::FAILED ();
32
+
33
+ $ this ->assertTrue ($ queued ->isActive ());
34
+ $ this ->assertTrue ($ processing ->isActive ());
35
+ $ this ->assertFalse ($ completed ->isActive ());
36
+ $ this ->assertFalse ($ failed ->isActive ());
37
+ }
38
+ }
You can’t perform that action at this time.
0 commit comments