znt/module/bi/test/model/getsqlbymonth.php

29 lines
1.2 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
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
/**
title=测试 biModel::getSqlByMonth();
timeout=0
cid=15181
- 步骤1默认参数测试返回数组且长度为1 @1
- 步骤2返回数组类型验证 @1
- 步骤3不同年月格式测试 @1
- 步骤4验证SQL结构 @1
- 步骤5再次验证方法调用稳定性 @1
*/
$biTest = new biModelTest();
r(is_array($biTest->getSqlByMonthTest()) && count($biTest->getSqlByMonthTest()) == 1) && p() && e('1'); // 步骤1默认参数测试返回数组且长度为1
r(is_array($biTest->getSqlByMonthTest('Y', 'm'))) && p() && e('1'); // 步骤2返回数组类型验证
$result = $biTest->getSqlByMonthTest('y', 'n');
r(is_array($result) && count($result) == 1) && p() && e('1'); // 步骤3不同年月格式测试
$result = $biTest->getSqlByMonthTest();
$sql = current($result);
r(strpos($sql, 'select * from zt_action where') !== false && strpos($sql, 'TIMESTAMP') !== false) && p() && e('1'); // 步骤4验证SQL结构
r(is_array($biTest->getSqlByMonthTest()) && count($biTest->getSqlByMonthTest()) == 1) && p() && e('1'); // 步骤5再次验证方法调用稳定性