This commit is contained in:
2021-02-26 00:59:52 +03:00
committed by GitHub
parent 9cefa847a9
commit e670cb161c
54 changed files with 1410 additions and 1280 deletions

View File

@ -2,7 +2,8 @@
declare(strict_types=1);
use Nsq\Exception\NsqError;
use Amp\Loop;
use Nsq\Exception\ServerException;
use Nsq\Producer;
use PHPUnit\Framework\TestCase;
@ -13,11 +14,16 @@ final class ProducerTest extends TestCase
*/
public function testPubFail(string $topic, string $body, string $exceptionMessage): void
{
$this->expectException(NsqError::class);
$this->expectException(ServerException::class);
$this->expectExceptionMessage($exceptionMessage);
$producer = new Producer('tcp://localhost:4150');
$producer->pub($topic, $body);
$producer = Producer::create('tcp://localhost:4150');
Loop::run(static function () use ($producer, $topic, $body): Generator {
yield $producer->connect();
yield $producer->publish($topic, $body);
});
}
/**