Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records committed Jan 18, 2021
1 parent 90c14fe commit f32988e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private function reConnect(int $delay)

public function send(array $data, bool $response = true)
{
if ($this->config['protocol_level'] === 5) {
if ($this->config['protocol_level'] === ProtocolInterface::MQTT_PROTOCOL_LEVEL_5_0) {
$package = ProtocolV5::pack($data);
} else {
$package = Protocol::pack($data);
Expand Down Expand Up @@ -218,7 +218,7 @@ public function recv()
throw new RuntimeException($errMsg, $this->client->errCode);
}
} elseif (is_string($response) && strlen($response) > 0) {
if ($this->config['protocol_level'] === 5) {
if ($this->config['protocol_level'] === ProtocolInterface::MQTT_PROTOCOL_LEVEL_5_0) {
return ProtocolV5::unpack($response);
}

Expand Down
4 changes: 2 additions & 2 deletions tests/V3/PacketTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ public function testClose(Client $client)

public function testPublishNonTopic()
{
$client = new Client(getTestMQTT5ConnectConfig(false), SWOOLE_MQTT_CONFIG);
$client = new Client(getTestConnectConfig(false), SWOOLE_MQTT_CONFIG);
$client->connect();
$this->expectException(ProtocolException::class);
$this->expectExceptionMessage('Protocol Error, Topic cannot be empty or need to set topic_alias');
$this->expectExceptionMessage('Protocol Error, Topic cannot be empty');
$client->publish('', 'hello,simps');

return $client;
Expand Down

0 comments on commit f32988e

Please sign in to comment.