23 lines
611 B
PHP
23 lines
611 B
PHP
<?php
|
|
|
|
namespace NoccyLabs\React\Protocol\Json;
|
|
|
|
use PHPUnit\Framework\Attributes\CoversClass;
|
|
use React\Stream\CompositeStream;
|
|
use React\Stream\ThroughStream;
|
|
|
|
#[CoversClass(JsonProtocol::class)]
|
|
#[CoversClass(NativeMessagingProtocol::class)]
|
|
class NativeMessagingProtocolTest extends \PHPUnit\Framework\TestCase
|
|
{
|
|
|
|
public function testFramePacking()
|
|
{
|
|
$proto = new NativeMessagingProtocol();
|
|
|
|
$packed = $proto->packFrame([ 'method' => 'foo', 'params' => [ 'bar' => true ] ]);
|
|
|
|
$this->assertEquals("\x26\x00\x00\x00".'{"method":"foo","params":{"bar":true}}', $packed);
|
|
}
|
|
|
|
} |