znt/module/custom/test/model/hasproducterdata.php

53 lines
1.6 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=测试 customModel::hasProductERData();
timeout=0
cid=15908
- 步骤1测试空数据库情况 @0
- 步骤2测试有epic类型story且未删除 @3
- 步骤3测试有epic类型story但已删除 @0
- 步骤4测试有story但类型不是epic @0
- 步骤5测试混合数据情况 @2
*/
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
zenData('story')->gen(0);
zenData('user')->gen(5);
su('admin');
$customTester = new customModelTest();
r($customTester->hasProductERDataTest()) && p() && e('0'); // 步骤1测试空数据库情况
$storyTable = zenData('story');
$storyTable->type->range('epic');
$storyTable->deleted->range('0');
$storyTable->gen(3);
r($customTester->hasProductERDataTest()) && p() && e('3'); // 步骤2测试有epic类型story且未删除
zenData('story')->gen(0);
$storyTable = zenData('story');
$storyTable->type->range('epic');
$storyTable->deleted->range('1');
$storyTable->gen(2);
r($customTester->hasProductERDataTest()) && p() && e('0'); // 步骤3测试有epic类型story但已删除
zenData('story')->gen(0);
$storyTable = zenData('story');
$storyTable->type->range('story');
$storyTable->deleted->range('0');
$storyTable->gen(4);
r($customTester->hasProductERDataTest()) && p() && e('0'); // 步骤4测试有story但类型不是epic
zenData('story')->gen(0);
$storyTable = zenData('story');
$storyTable->type->range('epic{2}, story{3}');
$storyTable->deleted->range('0{4}, 1{1}');
$storyTable->gen(5);
r($customTester->hasProductERDataTest()) && p() && e('2'); // 步骤5测试混合数据情况