znt/module/search/test/model/deletequery.php

34 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';
// 缓冲zenData输出避免干扰测试结果
ob_start();
zenData('userquery')->gen(10);
ob_end_clean();
su('admin');
/**
title=测试 searchModel::deleteQuery();
timeout=0
cid=18298
- 步骤1管理员删除存在的查询ID @true
- 步骤2管理员删除不存在的查询ID @true
- 步骤3普通用户删除自己的查询记录 @true
- 步骤4普通用户尝试删除其他用户的查询记录 @true
- 步骤5删除无效ID0测试边界情况 @true
*/
$search = new searchModelTest();
r($search->deleteQueryTest(1)) && p() && e('true'); // 步骤1管理员删除存在的查询ID
r($search->deleteQueryTest(999)) && p() && e('true'); // 步骤2管理员删除不存在的查询ID
su('user1');
r($search->deleteQueryTest(4)) && p() && e('true'); // 步骤3普通用户删除自己的查询记录
r($search->deleteQueryTest(1)) && p() && e('true'); // 步骤4普通用户尝试删除其他用户的查询记录
r($search->deleteQueryTest(0)) && p() && e('true'); // 步骤5删除无效ID0测试边界情况