+ [misc] Add unit tests for executionZen::checkPostForCreate() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,8 @@ class executionZenTest
|
||||
global $tester;
|
||||
$this->tester = $tester;
|
||||
$this->objectModel = $tester->loadModel('execution');
|
||||
$this->objectZen = $tester->loadZen('execution');
|
||||
$this->executionZenTest = new ReflectionClass($this->objectZen);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1039,4 +1041,22 @@ class executionZenTest
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test checkPostForCreate method.
|
||||
*
|
||||
* @access public
|
||||
* @return bool|array
|
||||
*/
|
||||
public function checkPostForCreateTest(): bool|array
|
||||
{
|
||||
$method = $this->executionZenTest->getMethod('checkPostForCreate');
|
||||
$method->setAccessible(true);
|
||||
|
||||
$result = $method->invoke($this->objectZen);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 executionZen::checkPostForCreate();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 执行executionzenTest模块的checkPostForCreateTest方法 属性project @所属项目不能为空。
|
||||
- 执行executionzenTest模块的checkPostForCreateTest方法 属性project @所属项目不能为空。
|
||||
- 执行executionzenTest模块的checkPostForCreateTest方法 属性project @所属项目不能为空。
|
||||
- 执行executionzenTest模块的checkPostForCreateTest方法 属性project @所属项目不能为空。
|
||||
- 执行executionzenTest模块的checkPostForCreateTest方法 属性project @所属项目不能为空。
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/executionzen.unittest.class.php';
|
||||
|
||||
zenData('project')->gen(0);
|
||||
|
||||
su('admin');
|
||||
|
||||
$executionzenTest = new executionZenTest();
|
||||
|
||||
$_POST = array();
|
||||
r($executionzenTest->checkPostForCreateTest()) && p('project') && e('所属项目不能为空。');
|
||||
$_POST['project'] = 0;
|
||||
r($executionzenTest->checkPostForCreateTest()) && p('project') && e('所属项目不能为空。');
|
||||
$_POST['project'] = '';
|
||||
r($executionzenTest->checkPostForCreateTest()) && p('project') && e('所属项目不能为空。');
|
||||
$_POST['project'] = null;
|
||||
r($executionzenTest->checkPostForCreateTest()) && p('project') && e('所属项目不能为空。');
|
||||
$_POST['project'] = false;
|
||||
r($executionzenTest->checkPostForCreateTest()) && p('project') && e('所属项目不能为空。');
|
||||
Reference in New Issue
Block a user