znt/module/dimension/test/model/savestate.php

35 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
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
$table = zenData('dimension');
$table->id->range('1-10');
$table->name->range('维度{10}');
$table->code->range('dimension{10}');
$table->desc->range('测试维度描述{10}');
$table->createdBy->range('admin{10}');
$table->editedBy->range('admin{10}');
$table->deleted->range('0{8},1{2}');
$table->gen(10);
/**
title=测试 dimensionModel::saveState();
timeout=0
cid=16037
- 步骤1正常传入有效维度ID @1
- 步骤2传入0获取第一个维度 @1
- 步骤3传入不存在的维度ID返回第一个可见维度ID @1
- 步骤4从session中获取维度 @3
- 步骤5从config中获取维度 @5
*/
$dimensionTest = new dimensionModelTest();
r($dimensionTest->saveStateTest(1)) && p() && e('1'); // 步骤1正常传入有效维度ID
r($dimensionTest->saveStateTest(0)) && p() && e('1'); // 步骤2传入0获取第一个维度
r($dimensionTest->saveStateTest(999)) && p() && e('1'); // 步骤3传入不存在的维度ID返回第一个可见维度ID
r($dimensionTest->saveStateTest(0, '3')) && p() && e('3'); // 步骤4从session中获取维度
r($dimensionTest->saveStateTest(0, '', '5')) && p() && e('5'); // 步骤5从config中获取维度