@@ -29,8 +29,6 @@ public function setUp()
29
29
parent ::setUp ();
30
30
31
31
if (! extension_loaded ('redis ' )) {
32
- $ this ->markTestSkipped ('The redis extension is not installed. Please install the extension to enable ' .__CLASS__ );
33
-
34
32
return ;
35
33
}
36
34
@@ -39,13 +37,25 @@ public function setUp()
39
37
40
38
public function testAllowsTransactionsOnAggregateConnection ()
41
39
{
40
+ if (! extension_loaded ('redis ' )) {
41
+ $ this ->markTestSkipped ('The redis extension is not installed. Please install the extension to enable ' .__CLASS__ );
42
+
43
+ return ;
44
+ }
45
+
42
46
$ transaction = $ this ->subject ->transaction ();
43
47
44
48
$ this ->assertInstanceOf (Redis::class, $ transaction );
45
49
}
46
50
47
51
public function testExecutesCommandsInTransaction ()
48
52
{
53
+ if (! extension_loaded ('redis ' )) {
54
+ $ this ->markTestSkipped ('The redis extension is not installed. Please install the extension to enable ' .__CLASS__ );
55
+
56
+ return ;
57
+ }
58
+
49
59
$ result = $ this ->subject ->transaction (function ($ trans ) {
50
60
$ trans ->set ('test-key ' , 'test value ' );
51
61
$ trans ->get ('test-key ' );
@@ -59,6 +69,12 @@ public function testExecutesCommandsInTransaction()
59
69
60
70
public function testExecutesTransactionsOnMaster ()
61
71
{
72
+ if (! extension_loaded ('redis ' )) {
73
+ $ this ->markTestSkipped ('The redis extension is not installed. Please install the extension to enable ' .__CLASS__ );
74
+
75
+ return ;
76
+ }
77
+
62
78
$ expectedSubset = ['role ' => 'master ' ];
63
79
64
80
$ info = $ this ->subject ->transaction (function ($ transaction ) {
@@ -70,6 +86,12 @@ public function testExecutesTransactionsOnMaster()
70
86
71
87
public function testAbortsTransactionOnException ()
72
88
{
89
+ if (! extension_loaded ('redis ' )) {
90
+ $ this ->markTestSkipped ('The redis extension is not installed. Please install the extension to enable ' .__CLASS__ );
91
+
92
+ return ;
93
+ }
94
+
73
95
$ exception = null ;
74
96
75
97
try {
@@ -88,6 +110,12 @@ public function testAbortsTransactionOnException()
88
110
89
111
public function testRetriesTransactionWhenConnectionFails ()
90
112
{
113
+ if (! extension_loaded ('redis ' )) {
114
+ $ this ->markTestSkipped ('The redis extension is not installed. Please install the extension to enable ' .__CLASS__ );
115
+
116
+ return ;
117
+ }
118
+
91
119
$ this ->expectException (RedisRetryException::class);
92
120
93
121
$ this ->subject = $ this ->makeConnection (1 , 0 ); // retry once and immediately
@@ -99,6 +127,12 @@ public function testRetriesTransactionWhenConnectionFails()
99
127
100
128
public function testCanReconnectWhenConnectionFails ()
101
129
{
130
+ if (! extension_loaded ('redis ' )) {
131
+ $ this ->markTestSkipped ('The redis extension is not installed. Please install the extension to enable ' .__CLASS__ );
132
+
133
+ return ;
134
+ }
135
+
102
136
$ retries = 3 ;
103
137
$ attempts = 0 ;
104
138
0 commit comments