znt/module/metric/test/model/getlistbycollect.php

44 lines
1.5 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=测试 metricModel::getListByCollect();
timeout=0
cid=17104
- 执行metric模块的getListByCollect方法参数是'all' 第0条的id属性 @8
- 执行metric模块的getListByCollect方法参数是'released' 第0条的id属性 @8
- 执行metric模块的getListByCollect方法参数是'wait' @0
- 执行$result @2
- 执行metric模块的getListByCollect方法参数是'all' 第0条的id属性 @9
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/calc.unittest.class.php';
$metric = new metricTest();
// 设置测试用户为admin并设置度量项10的收集者为admin
su('admin');
$metric->setCollector('10', 'admin');
$metric->setCollector('8', 'admin');
$metric->setCollector('9', 'user1');
// 测试步骤1使用admin用户获取所有阶段的度量项列表
r($metric->getListByCollect('all')) && p('0:id') && e('8');
// 测试步骤2使用stage参数为'released'获取已发布的度量项
r($metric->getListByCollect('released')) && p('0:id') && e('8');
// 测试步骤3使用stage参数为'wait'获取等待阶段的度量项
r($metric->getListByCollect('wait')) && p() && e('0');
// 测试步骤4使用stage参数为'all'获取所有阶段的度量项数量
$result = $metric->getListByCollect('all');
r(count($result)) && p() && e('2');
// 测试步骤5切换到user1用户测试权限控制
su('user1');
r($metric->getListByCollect('all')) && p('0:id') && e('9');