expectException(NsqError::class); $this->expectExceptionMessage($exceptionMessage); $producer = new Producer('tcp://localhost:4150'); $producer->pub($topic, $body); } /** * @return Generator */ public function pubFails(): Generator { yield 'Empty body' => ['test', '', 'E_BAD_MESSAGE PUB invalid message body size 0']; yield 'Invalid topic' => ['test$%^&', '', 'E_BAD_TOPIC PUB topic name "test$%^&" is not valid']; } }