@@ -66,34 +66,7 @@ public function testShouldJsonEncodeMessageAndPutToExpectedTube()
66
66
);
67
67
}
68
68
69
- public function testPriorityPrecedesMessagePriority ()
70
- {
71
- $ message = new PheanstalkMessage ('theBody ' );
72
- $ message ->setPriority (100 );
73
-
74
- $ pheanstalk = $ this ->createPheanstalkMock ();
75
- $ pheanstalk
76
- ->expects ($ this ->once ())
77
- ->method ('useTube ' )
78
- ->with ('theQueueName ' )
79
- ->willReturnSelf ()
80
- ;
81
- $ pheanstalk
82
- ->expects ($ this ->once ())
83
- ->method ('put ' )
84
- ->with ('{"body":"theBody","properties":[],"headers":{"priority":100}} ' , 50 , Pheanstalk::DEFAULT_DELAY , Pheanstalk::DEFAULT_TTR )
85
- ;
86
-
87
- $ producer = new PheanstalkProducer ($ pheanstalk );
88
- $ producer ->setPriority (50 );
89
-
90
- $ producer ->send (
91
- new PheanstalkDestination ('theQueueName ' ),
92
- $ message
93
- );
94
- }
95
-
96
- public function testNullPriorityFallsBackToMessagePriority ()
69
+ public function testMessagePriorityPrecedesPriority ()
97
70
{
98
71
$ message = new PheanstalkMessage ('theBody ' );
99
72
$ message ->setPriority (100 );
@@ -112,42 +85,12 @@ public function testNullPriorityFallsBackToMessagePriority()
112
85
;
113
86
114
87
$ producer = new PheanstalkProducer ($ pheanstalk );
115
- $ producer ->setPriority (null );
116
-
117
- $ producer ->send (
118
- new PheanstalkDestination ('theQueueName ' ),
119
- $ message
120
- );
121
- }
122
-
123
- public function testPriorityDoesNotPersist ()
124
- {
125
- $ message = new PheanstalkMessage ('theBody ' );
126
-
127
- $ pheanstalk = $ this ->createPheanstalkMock ();
128
- $ pheanstalk
129
- ->expects ($ this ->once ())
130
- ->method ('useTube ' )
131
- ->with ('theQueueName ' )
132
- ->willReturnSelf ()
133
- ;
134
- $ pheanstalk
135
- ->expects ($ this ->once ())
136
- ->method ('put ' )
137
- ->with ('{"body":"theBody","properties":[],"headers":[]} ' , 100 , Pheanstalk::DEFAULT_DELAY , Pheanstalk::DEFAULT_TTR )
138
- ;
139
-
140
- $ producer = new PheanstalkProducer ($ pheanstalk );
141
- $ producer ->setPriority (100 );
142
-
143
- $ this ->assertEquals (100 , $ producer ->getPriority ());
88
+ $ producer ->setPriority (50 );
144
89
145
90
$ producer ->send (
146
91
new PheanstalkDestination ('theQueueName ' ),
147
92
$ message
148
93
);
149
-
150
- $ this ->assertNull ($ producer ->getPriority ());
151
94
}
152
95
153
96
public function testAccessDeliveryDelayAsMilliseconds ()
@@ -184,34 +127,7 @@ public function testDeliveryDelayResolvesToSeconds()
184
127
);
185
128
}
186
129
187
- public function testDeliveryDelayPrecedesMessageDelay ()
188
- {
189
- $ message = new PheanstalkMessage ('theBody ' );
190
- $ message ->setDelay (25 );
191
-
192
- $ pheanstalk = $ this ->createPheanstalkMock ();
193
- $ pheanstalk
194
- ->expects ($ this ->once ())
195
- ->method ('useTube ' )
196
- ->with ('theQueueName ' )
197
- ->willReturnSelf ()
198
- ;
199
- $ pheanstalk
200
- ->expects ($ this ->once ())
201
- ->method ('put ' )
202
- ->with ('{"body":"theBody","properties":[],"headers":{"delay":25}} ' , Pheanstalk::DEFAULT_PRIORITY , 1 , Pheanstalk::DEFAULT_TTR )
203
- ;
204
-
205
- $ producer = new PheanstalkProducer ($ pheanstalk );
206
- $ producer ->setDeliveryDelay (1000 );
207
-
208
- $ producer ->send (
209
- new PheanstalkDestination ('theQueueName ' ),
210
- $ message
211
- );
212
- }
213
-
214
- public function testNullDeliveryDelayFallsBackToMessageDelay ()
130
+ public function testMessageDelayPrecedesDeliveryDelay ()
215
131
{
216
132
$ message = new PheanstalkMessage ('theBody ' );
217
133
$ message ->setDelay (25 );
@@ -229,43 +145,13 @@ public function testNullDeliveryDelayFallsBackToMessageDelay()
229
145
->with ('{"body":"theBody","properties":[],"headers":{"delay":25}} ' , Pheanstalk::DEFAULT_PRIORITY , 25 , Pheanstalk::DEFAULT_TTR )
230
146
;
231
147
232
- $ producer = new PheanstalkProducer ($ pheanstalk );
233
- $ producer ->setDeliveryDelay (null );
234
-
235
- $ producer ->send (
236
- new PheanstalkDestination ('theQueueName ' ),
237
- $ message
238
- );
239
- }
240
-
241
- public function testDeliveryDelayDoesNotPersist ()
242
- {
243
- $ message = new PheanstalkMessage ('theBody ' );
244
-
245
- $ pheanstalk = $ this ->createPheanstalkMock ();
246
- $ pheanstalk
247
- ->expects ($ this ->once ())
248
- ->method ('useTube ' )
249
- ->with ('theQueueName ' )
250
- ->willReturnSelf ()
251
- ;
252
- $ pheanstalk
253
- ->expects ($ this ->once ())
254
- ->method ('put ' )
255
- ->with ('{"body":"theBody","properties":[],"headers":[]} ' , Pheanstalk::DEFAULT_PRIORITY , 1 , Pheanstalk::DEFAULT_TTR )
256
- ;
257
-
258
148
$ producer = new PheanstalkProducer ($ pheanstalk );
259
149
$ producer ->setDeliveryDelay (1000 );
260
150
261
- $ this ->assertEquals (1000 , $ producer ->getDeliveryDelay ());
262
-
263
151
$ producer ->send (
264
152
new PheanstalkDestination ('theQueueName ' ),
265
153
$ message
266
154
);
267
-
268
- $ this ->assertNull ($ producer ->getDeliveryDelay ());
269
155
}
270
156
271
157
public function testAccessTimeToLiveAsMilliseconds ()
@@ -302,34 +188,7 @@ public function testTimeToLiveResolvesToSeconds()
302
188
);
303
189
}
304
190
305
- public function testTimeToLivePrecedesMessageTimeToRun ()
306
- {
307
- $ message = new PheanstalkMessage ('theBody ' );
308
- $ message ->setTimeToRun (25 );
309
-
310
- $ pheanstalk = $ this ->createPheanstalkMock ();
311
- $ pheanstalk
312
- ->expects ($ this ->once ())
313
- ->method ('useTube ' )
314
- ->with ('theQueueName ' )
315
- ->willReturnSelf ()
316
- ;
317
- $ pheanstalk
318
- ->expects ($ this ->once ())
319
- ->method ('put ' )
320
- ->with ('{"body":"theBody","properties":[],"headers":{"ttr":25}} ' , Pheanstalk::DEFAULT_PRIORITY , Pheanstalk::DEFAULT_DELAY , 1 )
321
- ;
322
-
323
- $ producer = new PheanstalkProducer ($ pheanstalk );
324
- $ producer ->setTimeToLive (1000 );
325
-
326
- $ producer ->send (
327
- new PheanstalkDestination ('theQueueName ' ),
328
- $ message
329
- );
330
- }
331
-
332
- public function testNullTimeToLiveFallsBackToMessageTimeToRun ()
191
+ public function testMessageTimeToRunPrecedesTimeToLive ()
333
192
{
334
193
$ message = new PheanstalkMessage ('theBody ' );
335
194
$ message ->setTimeToRun (25 );
@@ -347,43 +206,13 @@ public function testNullTimeToLiveFallsBackToMessageTimeToRun()
347
206
->with ('{"body":"theBody","properties":[],"headers":{"ttr":25}} ' , Pheanstalk::DEFAULT_PRIORITY , Pheanstalk::DEFAULT_DELAY , 25 )
348
207
;
349
208
350
- $ producer = new PheanstalkProducer ($ pheanstalk );
351
- $ producer ->setTimeToLive (null );
352
-
353
- $ producer ->send (
354
- new PheanstalkDestination ('theQueueName ' ),
355
- $ message
356
- );
357
- }
358
-
359
- public function testTimeToLiveDoesNotPersist ()
360
- {
361
- $ message = new PheanstalkMessage ('theBody ' );
362
-
363
- $ pheanstalk = $ this ->createPheanstalkMock ();
364
- $ pheanstalk
365
- ->expects ($ this ->once ())
366
- ->method ('useTube ' )
367
- ->with ('theQueueName ' )
368
- ->willReturnSelf ()
369
- ;
370
- $ pheanstalk
371
- ->expects ($ this ->once ())
372
- ->method ('put ' )
373
- ->with ('{"body":"theBody","properties":[],"headers":[]} ' , Pheanstalk::DEFAULT_PRIORITY , Pheanstalk::DEFAULT_DELAY , 1 )
374
- ;
375
-
376
209
$ producer = new PheanstalkProducer ($ pheanstalk );
377
210
$ producer ->setTimeToLive (1000 );
378
211
379
- $ this ->assertEquals (1000 , $ producer ->getTimeToLive ());
380
-
381
212
$ producer ->send (
382
213
new PheanstalkDestination ('theQueueName ' ),
383
214
$ message
384
215
);
385
-
386
- $ this ->assertNull ($ producer ->getTimeToLive ());
387
216
}
388
217
389
218
/**
0 commit comments