使用workman
This commit is contained in:
@@ -6,34 +6,43 @@ use cn\com\maiyoule\mqttclient\biz\AppUserCreateRequest;
|
||||
use cn\com\maiyoule\mqttclient\biz\AppUserDeleteRequest;
|
||||
use cn\com\maiyoule\mqttclient\biz\AppUserUpdateRequest;
|
||||
use cn\com\maiyoule\mqttclient\exception\ApiException;
|
||||
use cn\com\maiyoule\mqttclient\MQTTManager;
|
||||
use cn\com\maiyoule\mqttclient\AuthorServerClient;
|
||||
use PHPUnit\Framework\Assert;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
|
||||
class AppManagerTest extends TestCase
|
||||
{
|
||||
private MQTTManager $manager;
|
||||
private AuthorServerClient $manager;
|
||||
|
||||
protected function setUp(): void
|
||||
{
|
||||
$this->manager = new MQTTManager();
|
||||
$this->manager->setAppId('6MMVTLW66D');
|
||||
$this->manager = new AuthorServerClient();
|
||||
$this->manager->setAppId('6N6QPV2FYD');
|
||||
$this->manager->setPrivateKey(file_get_contents(__DIR__ . '/prikey.pem'));
|
||||
$this->manager->setApi('http://localhost:8000/api/');
|
||||
$this->manager->setApi('https://mqttauthor_dev.maiyoule.com.cn/api/');
|
||||
$this->manager->setDebug(true);
|
||||
}
|
||||
|
||||
|
||||
public function testAdmin()
|
||||
{
|
||||
$request = new AppUserCreateRequest();
|
||||
$request->setPassword('123');
|
||||
$request->setRole('admin');
|
||||
$request->setBiz('ch');
|
||||
$biz = $this->manager->exec($request);
|
||||
$this->assertTrue($biz->isSuccess(), $biz->getMessage());
|
||||
}
|
||||
|
||||
|
||||
public function testRunUser()
|
||||
{
|
||||
|
||||
|
||||
try {
|
||||
$request = new AppUserCreateRequest();
|
||||
$request->setPassword('111');
|
||||
$request->setFettle('');
|
||||
$request->setRole('admin');
|
||||
$request->setBiz(['ch','ws']);
|
||||
$request->setBiz(['ch', 'ws']);
|
||||
|
||||
$biz = $this->manager->exec($request);
|
||||
if (!$biz->isSuccess()) {
|
||||
|
||||
Reference in New Issue
Block a user