znt/module/webhook/test/model/getopenidlist.php

40 lines
1.4 KiB
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env php
<?php
/**
title=测试 webhookModel::getOpenIdList();
timeout=0
cid=19700
- 步骤1传入toList参数 @openid_001,openid_002
- 步骤2空的toList和actionID @0
- 步骤3空actionID测试 @0
- 步骤4不同webhook用户 @openid_003,openid_004
- 步骤5数组格式toList @openid_001,openid_002
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
// 数据准备 - 简化版本
$oauthTable = zenData('oauth');
$oauthTable->account->range('admin,user1,user2,user3');
$oauthTable->openID->range('openid_001,openid_002,openid_003,openid_004');
$oauthTable->providerType->range('webhook');
$oauthTable->providerID->range('1{2},2{2}');
$oauthTable->gen(4);
su('admin');
$webhookTest = new webhookModelTest();
// 执行5个测试步骤
r($webhookTest->getOpenIdListTest(1, 0, 'admin,user1')) && p() && e('openid_001,openid_002'); // 步骤1传入toList参数
r($webhookTest->getOpenIdListTest(1, 0, '')) && p() && e('0'); // 步骤2空的toList和actionID
r($webhookTest->getOpenIdListTest(1, 0)) && p() && e('0'); // 步骤3空actionID测试
r($webhookTest->getOpenIdListTest(2, 0, 'user2,user3')) && p() && e('openid_003,openid_004'); // 步骤4不同webhook用户
r($webhookTest->getOpenIdListTest(1, 0, array('admin', 'user1'))) && p() && e('openid_001,openid_002'); // 步骤5数组格式toList