@@ -91,70 +91,14 @@ public function testShouldReceiveFromQueueAndReturnMessageIfMessageInQueue()
9191 $ this ->assertSame ($ kafkaMessage , $ actualMessage ->getKafkaMessage ());
9292 }
9393
94- public function testShouldReceiveNoWaitFromQueueAndReturnNullIfNoMessageInQueue ()
94+ public function testShouldThrowExceptionNotImplementedOnReceiveNoWait ()
9595 {
96- $ destination = new RdKafkaTopic ('dest ' );
97-
98- $ kafkaMessage = new Message ();
99- $ kafkaMessage ->err = RD_KAFKA_RESP_ERR__TIMED_OUT ;
100-
101- $ kafkaConsumer = $ this ->createKafkaConsumerMock ();
102- $ kafkaConsumer
103- ->expects ($ this ->once ())
104- ->method ('subscribe ' )
105- ->with (['dest ' ])
106- ;
107- $ kafkaConsumer
108- ->expects ($ this ->once ())
109- ->method ('consume ' )
110- ->with (10 )
111- ->willReturn ($ kafkaMessage )
112- ;
113- $ kafkaConsumer
114- ->expects ($ this ->once ())
115- ->method ('unsubscribe ' )
116- ;
117-
118- $ consumer = new RdKafkaConsumer ($ kafkaConsumer , $ this ->createContextMock (), $ destination );
119-
120- $ this ->assertNull ($ consumer ->receiveNoWait ());
121- }
96+ $ consumer = new RdKafkaConsumer ($ this ->createKafkaConsumerMock (), $ this ->createContextMock (), new RdKafkaTopic ('' ));
12297
123- public function testShouldReceiveNoWaitFromQueueAndReturnMessageIfMessageInQueue ()
124- {
125- $ destination = new RdKafkaTopic ('dest ' );
126-
127- $ message = new RdKafkaMessage ('theBody ' , ['foo ' => 'fooVal ' ], ['bar ' => 'barVal ' ]);
98+ $ this ->expectException (\LogicException::class);
99+ $ this ->expectExceptionMessage ('Not implemented ' );
128100
129- $ kafkaMessage = new Message ();
130- $ kafkaMessage ->err = RD_KAFKA_RESP_ERR_NO_ERROR ;
131- $ kafkaMessage ->payload = json_encode ($ message );
132-
133- $ kafkaConsumer = $ this ->createKafkaConsumerMock ();
134- $ kafkaConsumer
135- ->expects ($ this ->once ())
136- ->method ('subscribe ' )
137- ->with (['dest ' ])
138- ;
139- $ kafkaConsumer
140- ->expects ($ this ->once ())
141- ->method ('consume ' )
142- ->with (10 )
143- ->willReturn ($ kafkaMessage )
144- ;
145- $ kafkaConsumer
146- ->expects ($ this ->once ())
147- ->method ('unsubscribe ' )
148- ;
149-
150- $ consumer = new RdKafkaConsumer ($ kafkaConsumer , $ this ->createContextMock (), $ destination );
151-
152- $ actualMessage = $ consumer ->receiveNoWait ();
153-
154- $ this ->assertSame ('theBody ' , $ actualMessage ->getBody ());
155- $ this ->assertSame (['foo ' => 'fooVal ' ], $ actualMessage ->getProperties ());
156- $ this ->assertSame (['bar ' => 'barVal ' ], $ actualMessage ->getHeaders ());
157- $ this ->assertSame ($ kafkaMessage , $ actualMessage ->getKafkaMessage ());
101+ $ consumer ->receiveNoWait ();
158102 }
159103
160104 /**
0 commit comments