Passed
Push — master ( 2a1f3f...85aa4b )
by butschster
05:42 queued 17s
created
src/Queue/tests/Interceptor/Consume/RetryPolicyInterceptorTest.php 1 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.