Skip to content

Commit

Permalink
Update Info class based on the Nats source
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-lmi authored and nekufa committed Jul 18, 2022
1 parent 33aed76 commit 84bbd7b
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 8 deletions.
26 changes: 18 additions & 8 deletions src/Message/Info.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,29 @@ class Info extends Prototype
public string $server_name;
public string $version;
public int $proto;
public string $git_commit;
public ?string $git_commit;
public string $go;
public string $host;
public int $port;
public bool $headers;
public ?bool $auth_required;
public ?bool $tls_required;
public ?bool $tls_verify;
public ?bool $tls_available;
public int $max_payload;
public bool $jetstream;
public int $client_id;
public string $client_ip;
public bool $auth_required;

public ?string $cluster = null;
public ?array $connect_urls = null;
public ?bool $jetstream;
public ?string $ip;
public ?int $client_id;
public ?string $client_ip;
public ?string $nonce;
public ?string $cluster;
public ?bool $cluster_dynamic;
public ?string $domain;
/** @var string[]|null */
public ?array $connect_urls;
/** @var string[]|null */
public ?array $ws_connect_urls;
public ?bool $ldm;

public function render(): string
{
Expand Down
31 changes: 31 additions & 0 deletions tests/FactoryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace Basis\Nats\Tests;

use Basis\Nats\Message\Factory;
use Basis\Nats\Message\Info;

class FactoryTest extends Test
{
public function testInfo()
{
$infoData = [
"server_id" => "ID",
"server_name" => "NAME",
"version" => "1.0",
"proto" => 1,
"go" => "1",
"host" => "host",
"port" => 1234,
"headers" => false,
"domain" => "domain"
];
$infoString = "INFO " . json_encode($infoData);

$message = Factory::create($infoString);

$this->assertEquals(Info::class, get_class($message));
}
}

0 comments on commit 84bbd7b

Please sign in to comment.