Passed
Pull Request — master (#1012)
by Maxim
21:28
created
src/Queue/tests/Interceptor/Consume/RetryPolicyInterceptorTest.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
             ->with(self::class, 'bar', [])
81 81
             ->willThrowException(new TestRetryException());
82 82
 
83
-        try {
83
+        try{
84 84
             $this->interceptor->process(self::class, 'bar', [], $this->core);
85
-        } catch (RetryException $e) {
85
+        }catch (RetryException $e){
86 86
             $this->assertSame(1, $e->getOptions()->getDelay());
87 87
             $this->assertSame(['attempts' => ['1']], $e->getOptions()->getHeaders());
88 88
         }
@@ -100,9 +100,9 @@  discard block
 block discarded – undo
100 100
                 retryPolicy: new \Spiral\Queue\RetryPolicy(maxAttempts: 2, delay: 4)
101 101
             ));
102 102
 
103
-        try {
103
+        try{
104 104
             $this->interceptor->process(self::class, 'bar', [], $this->core);
105
-        } catch (RetryException $e) {
105
+        }catch (RetryException $e){
106 106
             $this->assertSame(4, $e->getOptions()->getDelay());
107 107
             $this->assertSame(['attempts' => ['1']], $e->getOptions()->getHeaders());
108 108
         }
@@ -120,14 +120,14 @@  discard block
 block discarded – undo
120 120
             ->with(self::class, 'bar', ['headers' => ['attempts' => ['1']]])
121 121
             ->willThrowException(new TestRetryException());
122 122
 
123
-        try {
123
+        try{
124 124
             $this->interceptor->process(
125 125
                 self::class,
126 126
                 'bar',
127 127
                 ['headers' => ['attempts' => ['1']]],
128 128
                 $this->core
129 129
             );
130
-        } catch (RetryException $e) {
130
+        }catch (RetryException $e){
131 131
             $this->assertSame(8, $e->getOptions()->getDelay());
132 132
             $this->assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
133 133
         }
@@ -147,14 +147,14 @@  discard block
 block discarded – undo
147 147
                 retryPolicy: new \Spiral\Queue\RetryPolicy(maxAttempts: 3, delay: 4, multiplier: 2)
148 148
             ));
149 149
 
150
-        try {
150
+        try{
151 151
             $this->interceptor->process(
152 152
                 self::class,
153 153
                 'bar',
154 154
                 ['headers' => ['attempts' => ['1']]],
155 155
                 $this->core
156 156
             );
157
-        } catch (RetryException $e) {
157
+        }catch (RetryException $e){
158 158
             $this->assertSame(8, $e->getOptions()->getDelay());
159 159
             $this->assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
160 160
         }
@@ -171,7 +171,7 @@  discard block
 block discarded – undo
171 171
             ->method('callAction')
172 172
             ->with(self::class, 'bar', ['headers' => ['attempts' => ['1']]])
173 173
             ->willThrowException(new TestRetryException(
174
-                retryPolicy: new class implements RetryPolicyInterface {
174
+                retryPolicy: new class implements RetryPolicyInterface{
175 175
                     public function isRetryable(\Throwable $exception, int $attempts = 0): bool
176 176
                     {
177 177
                         return true;
@@ -184,14 +184,14 @@  discard block
 block discarded – undo
184 184
                 }
185 185
             ));
186 186
 
187
-        try {
187
+        try{
188 188
             $this->interceptor->process(
189 189
                 self::class,
190 190
                 'bar',
191 191
                 ['headers' => ['attempts' => ['1']]],
192 192
                 $this->core
193 193
             );
194
-        } catch (RetryException $e) {
194
+        }catch (RetryException $e){
195 195
             $this->assertSame(5, $e->getOptions()->getDelay());
196 196
             $this->assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
197 197
         }
@@ -213,14 +213,14 @@  discard block
 block discarded – undo
213 213
                 )
214 214
             ));
215 215
 
216
-        try {
216
+        try{
217 217
             $this->interceptor->process(
218 218
                 self::class,
219 219
                 'bar',
220 220
                 ['headers' => ['attempts' => ['1']]],
221 221
                 $this->core
222 222
             );
223
-        } catch (RetryException $e) {
223
+        }catch (RetryException $e){
224 224
             $this->assertSame(8, $e->getOptions()->getDelay());
225 225
             $this->assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
226 226
         }
Please login to merge, or discard this patch.
Braces   +32 added lines, -13 removed lines patch added patch discarded remove patch
@@ -80,9 +80,12 @@  discard block
 block discarded – undo
80 80
             ->with(self::class, 'bar', [])
81 81
             ->willThrowException(new TestRetryException());
82 82
 
83
-        try {
83
+        try
84
+        {
84 85
             $this->interceptor->process(self::class, 'bar', [], $this->core);
85
-        } catch (RetryException $e) {
86
+        }
87
+        catch (RetryException $e)
88
+        {
86 89
             $this->assertSame(1, $e->getOptions()->getDelay());
87 90
             $this->assertSame(['attempts' => ['1']], $e->getOptions()->getHeaders());
88 91
         }
@@ -100,9 +103,12 @@  discard block
 block discarded – undo
100 103
                 retryPolicy: new \Spiral\Queue\RetryPolicy(maxAttempts: 2, delay: 4)
101 104
             ));
102 105
 
103
-        try {
106
+        try
107
+        {
104 108
             $this->interceptor->process(self::class, 'bar', [], $this->core);
105
-        } catch (RetryException $e) {
109
+        }
110
+        catch (RetryException $e)
111
+        {
106 112
             $this->assertSame(4, $e->getOptions()->getDelay());
107 113
             $this->assertSame(['attempts' => ['1']], $e->getOptions()->getHeaders());
108 114
         }
@@ -120,14 +126,17 @@  discard block
 block discarded – undo
120 126
             ->with(self::class, 'bar', ['headers' => ['attempts' => ['1']]])
121 127
             ->willThrowException(new TestRetryException());
122 128
 
123
-        try {
129
+        try
130
+        {
124 131
             $this->interceptor->process(
125 132
                 self::class,
126 133
                 'bar',
127 134
                 ['headers' => ['attempts' => ['1']]],
128 135
                 $this->core
129 136
             );
130
-        } catch (RetryException $e) {
137
+        }
138
+        catch (RetryException $e)
139
+        {
131 140
             $this->assertSame(8, $e->getOptions()->getDelay());
132 141
             $this->assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
133 142
         }
@@ -147,14 +156,17 @@  discard block
 block discarded – undo
147 156
                 retryPolicy: new \Spiral\Queue\RetryPolicy(maxAttempts: 3, delay: 4, multiplier: 2)
148 157
             ));
149 158
 
150
-        try {
159
+        try
160
+        {
151 161
             $this->interceptor->process(
152 162
                 self::class,
153 163
                 'bar',
154 164
                 ['headers' => ['attempts' => ['1']]],
155 165
                 $this->core
156 166
             );
157
-        } catch (RetryException $e) {
167
+        }
168
+        catch (RetryException $e)
169
+        {
158 170
             $this->assertSame(8, $e->getOptions()->getDelay());
159 171
             $this->assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
160 172
         }
@@ -171,7 +183,8 @@  discard block
 block discarded – undo
171 183
             ->method('callAction')
172 184
             ->with(self::class, 'bar', ['headers' => ['attempts' => ['1']]])
173 185
             ->willThrowException(new TestRetryException(
174
-                retryPolicy: new class implements RetryPolicyInterface {
186
+                retryPolicy: new class implements RetryPolicyInterface
187
+                {
175 188
                     public function isRetryable(\Throwable $exception, int $attempts = 0): bool
176 189
                     {
177 190
                         return true;
@@ -184,14 +197,17 @@  discard block
 block discarded – undo
184 197
                 }
185 198
             ));
186 199
 
187
-        try {
200
+        try
201
+        {
188 202
             $this->interceptor->process(
189 203
                 self::class,
190 204
                 'bar',
191 205
                 ['headers' => ['attempts' => ['1']]],
192 206
                 $this->core
193 207
             );
194
-        } catch (RetryException $e) {
208
+        }
209
+        catch (RetryException $e)
210
+        {
195 211
             $this->assertSame(5, $e->getOptions()->getDelay());
196 212
             $this->assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
197 213
         }
@@ -213,14 +229,17 @@  discard block
 block discarded – undo
213 229
                 )
214 230
             ));
215 231
 
216
-        try {
232
+        try
233
+        {
217 234
             $this->interceptor->process(
218 235
                 self::class,
219 236
                 'bar',
220 237
                 ['headers' => ['attempts' => ['1']]],
221 238
                 $this->core
222 239
             );
223
-        } catch (RetryException $e) {
240
+        }
241
+        catch (RetryException $e)
242
+        {
224 243
             $this->assertSame(8, $e->getOptions()->getDelay());
225 244
             $this->assertSame(['attempts' => ['2']], $e->getOptions()->getHeaders());
226 245
         }
Please login to merge, or discard this patch.