@@ -66,34 +66,7 @@ public function testShouldJsonEncodeMessageAndPutToExpectedTube()
6666 );
6767 }
6868
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 ()
9770 {
9871 $ message = new PheanstalkMessage ('theBody ' );
9972 $ message ->setPriority (100 );
@@ -112,42 +85,12 @@ public function testNullPriorityFallsBackToMessagePriority()
11285 ;
11386
11487 $ 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 );
14489
14590 $ producer ->send (
14691 new PheanstalkDestination ('theQueueName ' ),
14792 $ message
14893 );
149-
150- $ this ->assertNull ($ producer ->getPriority ());
15194 }
15295
15396 public function testAccessDeliveryDelayAsMilliseconds ()
@@ -184,34 +127,7 @@ public function testDeliveryDelayResolvesToSeconds()
184127 );
185128 }
186129
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 ()
215131 {
216132 $ message = new PheanstalkMessage ('theBody ' );
217133 $ message ->setDelay (25 );
@@ -229,43 +145,13 @@ public function testNullDeliveryDelayFallsBackToMessageDelay()
229145 ->with ('{"body":"theBody","properties":[],"headers":{"delay":25}} ' , Pheanstalk::DEFAULT_PRIORITY , 25 , Pheanstalk::DEFAULT_TTR )
230146 ;
231147
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-
258148 $ producer = new PheanstalkProducer ($ pheanstalk );
259149 $ producer ->setDeliveryDelay (1000 );
260150
261- $ this ->assertEquals (1000 , $ producer ->getDeliveryDelay ());
262-
263151 $ producer ->send (
264152 new PheanstalkDestination ('theQueueName ' ),
265153 $ message
266154 );
267-
268- $ this ->assertNull ($ producer ->getDeliveryDelay ());
269155 }
270156
271157 public function testAccessTimeToLiveAsMilliseconds ()
@@ -302,34 +188,7 @@ public function testTimeToLiveResolvesToSeconds()
302188 );
303189 }
304190
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 ()
333192 {
334193 $ message = new PheanstalkMessage ('theBody ' );
335194 $ message ->setTimeToRun (25 );
@@ -347,43 +206,13 @@ public function testNullTimeToLiveFallsBackToMessageTimeToRun()
347206 ->with ('{"body":"theBody","properties":[],"headers":{"ttr":25}} ' , Pheanstalk::DEFAULT_PRIORITY , Pheanstalk::DEFAULT_DELAY , 25 )
348207 ;
349208
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-
376209 $ producer = new PheanstalkProducer ($ pheanstalk );
377210 $ producer ->setTimeToLive (1000 );
378211
379- $ this ->assertEquals (1000 , $ producer ->getTimeToLive ());
380-
381212 $ producer ->send (
382213 new PheanstalkDestination ('theQueueName ' ),
383214 $ message
384215 );
385-
386- $ this ->assertNull ($ producer ->getTimeToLive ());
387216 }
388217
389218 /**
0 commit comments