+ [misc] Add unit tests for bugZen::checkBugExecutionPriv() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@ class bugTest
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('bug');
|
||||
$this->objectZen = $tester->loadZen('bug');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1576,4 +1577,20 @@ class bugTest
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test checkBugExecutionPriv method.
|
||||
*
|
||||
* @param object $bug
|
||||
* @access public
|
||||
* @return bool|int
|
||||
*/
|
||||
public function checkBugExecutionPrivTest(object $bug): bool|int
|
||||
{
|
||||
$result = $this->objectZen->checkBugExecutionPriv($bug);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
|
||||
$table = zenData('bug');
|
||||
$table->id->range('1-5');
|
||||
$table->title->range('测试Bug1,测试Bug2,测试Bug3,测试Bug4,测试Bug5');
|
||||
$table->execution->range('0,0,0,0,0');
|
||||
$table->product->range('1');
|
||||
$table->status->range('active');
|
||||
$table->openedBy->range('admin');
|
||||
$table->gen(5);
|
||||
|
||||
su('admin');
|
||||
|
||||
/**
|
||||
|
||||
title=测试 bugZen::checkBugExecutionPriv();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 执行invokeArgs($zen模块的newInstance方法,参数是, [ @1
|
||||
- 执行invokeArgs($zen模块的newInstance方法,参数是, [ @1
|
||||
- 执行invokeArgs($zen模块的newInstance方法,参数是, [ @1
|
||||
- 执行invokeArgs($zen模块的newInstance方法,参数是, [ @1
|
||||
- 执行invokeArgs($zen模块的newInstance方法,参数是, [ @1
|
||||
|
||||
*/
|
||||
|
||||
global $tester, $app;
|
||||
$app->rawModule = 'bug';
|
||||
$app->rawMethod = 'view';
|
||||
|
||||
$zen = initReference('bug');
|
||||
$func = $zen->getMethod('checkBugExecutionPriv');
|
||||
|
||||
r($func->invokeArgs($zen->newInstance(), [(object)array('id' => 1, 'execution' => 0)])) && p() && e('1');
|
||||
r($func->invokeArgs($zen->newInstance(), [(object)array('id' => 2, 'execution' => '')])) && p() && e('1');
|
||||
r($func->invokeArgs($zen->newInstance(), [(object)array('id' => 3, 'execution' => null)])) && p() && e('1');
|
||||
r($func->invokeArgs($zen->newInstance(), [(object)array('id' => 4, 'execution' => 0)])) && p() && e('1');
|
||||
r($func->invokeArgs($zen->newInstance(), [(object)array('id' => 5, 'execution' => false)])) && p() && e('1');
|
||||
Reference in New Issue
Block a user