food_server/vendor/php-mqtt/client/tests/Feature/SupportedProtocolsTest.php
tk 9ef6902c1d 【类 型】:fix
【主	题】:提交runing字段
【描	述】:
	[原因]:正则匹配 bind_route 添加runing字段 PS:对应取出bind_route的, 即分割符
	[过程]:
	[影响]:
【结	束】
2024-07-09 17:35:54 +08:00

48 lines
1.4 KiB
PHP

<?php
/** @noinspection PhpUnhandledExceptionInspection */
declare(strict_types=1);
namespace Tests\Feature;
use PhpMqtt\Client\Exceptions\ProtocolNotSupportedException;
use PhpMqtt\Client\MqttClient;
use Tests\TestCase;
/**
* Tests the protocols supported (and not supported) by the client.
*
* @package Tests\Feature
*/
class SupportedProtocolsTest extends TestCase
{
public function test_client_supports_mqtt_3_1_protocol(): void
{
$client = new MqttClient($this->mqttBrokerHost, $this->mqttBrokerPort, 'test-protocol', MqttClient::MQTT_3_1);
$this->assertInstanceOf(MqttClient::class, $client);
}
public function test_client_supports_mqtt_3_1_1_protocol(): void
{
$client = new MqttClient($this->mqttBrokerHost, $this->mqttBrokerPort, 'test-protocol', MqttClient::MQTT_3_1_1);
$this->assertInstanceOf(MqttClient::class, $client);
}
public function test_client_does_not_support_mqtt_3_protocol(): void
{
$this->expectException(ProtocolNotSupportedException::class);
new MqttClient($this->mqttBrokerHost, $this->mqttBrokerPort, 'test-protocol', '3');
}
public function test_client_does_not_support_mqtt_5_protocol(): void
{
$this->expectException(ProtocolNotSupportedException::class);
new MqttClient($this->mqttBrokerHost, $this->mqttBrokerPort, 'test-protocol', '5');
}
}