File tree Expand file tree Collapse file tree 4 files changed +33
-25
lines changed Expand file tree Collapse file tree 4 files changed +33
-25
lines changed Original file line number Diff line number Diff line change 14
14
use PHPUnit \Framework \TestCase ;
15
15
use stdClass ;
16
16
17
+ use function Orchestra \Testbench \phpunit_version_compare ;
18
+
17
19
class DatabaseEloquentCollectionTest extends TestCase
18
20
{
19
21
/**
@@ -702,7 +704,12 @@ public function testLoadExistsShouldCastBool()
702
704
$ user = EloquentTestUserModel::with ('articles ' )->first ();
703
705
$ user ->articles ->loadExists ('comments ' );
704
706
$ commentsExists = $ user ->articles ->pluck ('comments_exists ' )->toArray ();
705
- $ this ->assertContainsOnly ('bool ' , $ commentsExists );
707
+
708
+ if (phpunit_version_compare ('11.5.0 ' , '< ' )) {
709
+ $ this ->assertContainsOnly ('bool ' , $ commentsExists );
710
+ } else {
711
+ $ this ->assertContainsOnlyBool ($ commentsExists );
712
+ }
706
713
}
707
714
708
715
public function testWithNonScalarKey ()
Original file line number Diff line number Diff line change @@ -14,16 +14,15 @@ class Psr6RedisTest extends TestCase
14
14
15
15
protected function setUp (): void
16
16
{
17
- parent ::setUp ();
17
+ $ this ->afterApplicationCreated (function () {
18
+ $ this ->setUpRedis ();
19
+ });
18
20
19
- $ this ->setUpRedis ();
20
- }
21
+ $ this ->beforeApplicationDestroyed (function () {
22
+ $ this ->tearDownRedis ();
23
+ });
21
24
22
- protected function tearDown (): void
23
- {
24
- $ this ->tearDownRedis ();
25
-
26
- parent ::tearDown ();
25
+ parent ::setUp ();
27
26
}
28
27
29
28
#[DataProvider('redisClientDataProvider ' )]
Original file line number Diff line number Diff line change @@ -16,18 +16,19 @@ class RedisStoreTest extends TestCase
16
16
{
17
17
use InteractsWithRedis;
18
18
19
+ /** {@inheritdoc} */
20
+ #[\Override]
19
21
protected function setUp (): void
20
22
{
21
- parent ::setUp ();
23
+ $ this ->afterApplicationCreated (function () {
24
+ $ this ->setUpRedis ();
25
+ });
22
26
23
- $ this ->setUpRedis ();
24
- }
27
+ $ this ->beforeApplicationDestroyed (function () {
28
+ $ this ->tearDownRedis ();
29
+ });
25
30
26
- protected function tearDown (): void
27
- {
28
- $ this ->tearDownRedis ();
29
-
30
- parent ::tearDown ();
31
+ parent ::setUp ();
31
32
}
32
33
33
34
public function testCacheTtl (): void
Original file line number Diff line number Diff line change @@ -31,18 +31,19 @@ class RedisQueueTest extends TestCase
31
31
*/
32
32
private $ container ;
33
33
34
+ /** {@inheritdoc} */
35
+ #[\Override]
34
36
protected function setUp (): void
35
37
{
36
- parent ::setUp ();
37
-
38
- $ this ->setUpRedis ();
39
- }
38
+ $ this ->afterApplicationCreated (function () {
39
+ $ this ->setUpRedis ();
40
+ });
40
41
41
- protected function tearDown (): void
42
- {
43
- $ this -> tearDownRedis ( );
42
+ $ this -> beforeApplicationDestroyed ( function () {
43
+ $ this -> tearDownRedis ();
44
+ } );
44
45
45
- parent ::tearDown ();
46
+ parent ::setUp ();
46
47
}
47
48
48
49
/**
You can’t perform that action at this time.
0 commit comments