使用workman
This commit is contained in:
39
tests/AuthorAppMQTTClientTest.php
Normal file
39
tests/AuthorAppMQTTClientTest.php
Normal 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, '启动失败');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user