Explode Response to Frames
This commit is contained in:
@ -4,7 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
use Nsq\Consumer;
|
||||
use Nsq\Exception\MessageAlreadyFinished;
|
||||
use Nsq\Message;
|
||||
use Nsq\Protocol\Message;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
final class MessageTest extends TestCase
|
||||
|
@ -4,8 +4,8 @@ declare(strict_types=1);
|
||||
|
||||
use Nsq\Config\ClientConfig;
|
||||
use Nsq\Consumer;
|
||||
use Nsq\Message;
|
||||
use Nsq\Producer;
|
||||
use Nsq\Protocol\Message;
|
||||
use Nsq\Subscriber;
|
||||
use Nyholm\NSA;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@ -20,7 +20,7 @@ final class NsqTest extends TestCase
|
||||
$consumer = new Consumer(
|
||||
address: 'tcp://localhost:4150',
|
||||
clientConfig: new ClientConfig(
|
||||
heartbeatInterval: 1000,
|
||||
heartbeatInterval: 3000,
|
||||
readTimeout: 1,
|
||||
),
|
||||
);
|
||||
|
32
tests/Protocol/ErrorTypeTest.php
Normal file
32
tests/Protocol/ErrorTypeTest.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Protocol;
|
||||
|
||||
use Generator;
|
||||
use Nsq\Protocol\ErrorType;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use ReflectionClass;
|
||||
|
||||
final class ErrorTypeTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* @dataProvider data
|
||||
*/
|
||||
public function testConstructor(string $type, bool $isConnectionTerminated): void
|
||||
{
|
||||
$errorType = new ErrorType($type);
|
||||
self::assertSame($isConnectionTerminated, $errorType->terminateConnection);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Generator<string, array<int, bool|string>>
|
||||
*/
|
||||
public function data(): Generator
|
||||
{
|
||||
foreach ((new ReflectionClass(ErrorType::class))->getConstants() as $constant => $isTerminated) {
|
||||
yield $constant => [$constant, $isTerminated];
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user