znt/module/doc/test/model/statlibcounts.php

34 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=测试 docModel->statLibCounts();
cid=16154
- 文档库ID列表为空时获取文档、模块的数量 @0
- 文档库ID列表为1-30时获取文档ID=11、模块的数量属性11 @4
- 文档库ID列表为1-30时获取文档ID=12、模块的数量属性12 @3
- 文档库ID列表为1-30时获取文档ID=13、模块的数量属性13 @1
- 文档库ID列表数据不存在时获取文档、模块的数量属性41 @0
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
zenData('module')->loadYaml('module')->gen(3);
zenData('doclib')->loadYaml('doclib')->gen(30);
zenData('doc')->loadYaml('doc')->gen(50);
zenData('user')->gen(5);
$libIds[0] = array();
$libIds[1] = range(1, 30);
$libIds[2] = range(41, 50);
$docTester = new docModelTest();
r($docTester->statLibCountsTest($libIds[0])) && p() && e('0'); // 文档库ID列表为空时获取文档、模块的数量
r($docTester->statLibCountsTest($libIds[1])) && p('11') && e('4'); // 文档库ID列表为1-30时获取文档ID=11、模块的数量
r($docTester->statLibCountsTest($libIds[1])) && p('12') && e('3'); // 文档库ID列表为1-30时获取文档ID=12、模块的数量
r($docTester->statLibCountsTest($libIds[1])) && p('13') && e('1'); // 文档库ID列表为1-30时获取文档ID=13、模块的数量
r($docTester->statLibCountsTest($libIds[2])) && p('41') && e('0'); // 文档库ID列表数据不存在时获取文档、模块的数量