使用workman

This commit is contained in:
2025-05-13 15:49:27 +08:00
parent c1547e191c
commit 2ff864b8c8
9 changed files with 446 additions and 13 deletions

View File

@@ -0,0 +1,39 @@
<?php
namespace cn\com\maiyoule\mqttclient\test;
use cn\com\maiyoule\mqttclient\AuthorAppMQTTClient;
use PHPUnit\Framework\TestCase;
class AuthorAppMQTTClientTest extends TestCase
{
private AuthorAppMQTTClient $client;
protected function setUp(): void
{
}
protected function tearDown(): void
{
$this->client->stop();
}
public function testInit()
{
$this->client = AuthorAppMQTTClient::getInstance();
$this->client->setServer('202.200.18.22');
$this->client->setAppid('6N6QPV2FYD');
$this->client
->setClientId('6NEC8SKNK5')
->setUsername('6N6QPV2FYD')
->setPassword('123')
->registerEvent(AuthorAppMQTTClient::EVENT_CONNECT, function ($connection) {
print_r('连接成功');
});
$result = $this->client->start();
self::assertTrue($result, '启动失败');
}
}