znt/module/datatable/test/model/sortcols.php

33 lines
1.3 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=测试 datatableModel::sortCols();
timeout=0
cid=15948
- 测试步骤1正常排序order值小的在前 @-1
- 测试步骤2正常排序order值大的在前 @1
- 测试步骤3相同order值的排序 @0
- 测试步骤4缺少order字段的数组排序 @0
- 测试步骤5边界值测试负数和正数排序 @-11
- 测试步骤6大数值差异的排序测试 @-999
- 测试步骤7零值order字段的排序测试 @-1
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
su('admin');
$datatableTest = new datatableModelTest();
r($datatableTest->sortColsTest(array('order' => 1), array('order' => 2))) && p() && e('-1');
r($datatableTest->sortColsTest(array('order' => 2), array('order' => 1))) && p() && e('1');
r($datatableTest->sortColsTest(array('order' => 1), array('order' => 1))) && p() && e('0');
r($datatableTest->sortColsTest(array(), array('order' => 1))) && p() && e('0');
r($datatableTest->sortColsTest(array('order' => -10), array('order' => 1))) && p() && e('-11');
r($datatableTest->sortColsTest(array('order' => 1), array('order' => 1000))) && p() && e('-999');
r($datatableTest->sortColsTest(array('order' => 0), array('order' => 1))) && p() && e('-1');