+ [misc] Add unit tests for blockZen::initBlock() method
🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -5,6 +5,7 @@ class blockTest
|
||||
{
|
||||
global $tester;
|
||||
$this->objectModel = $tester->loadModel('block');
|
||||
$this->objectTao = $tester->loadTao('block');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -842,4 +843,33 @@ class blockTest
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Test initBlock method in zen layer.
|
||||
*
|
||||
* @param string $dashboard
|
||||
* @access public
|
||||
* @return bool
|
||||
*/
|
||||
public function zenInitBlockTest(string $dashboard)
|
||||
{
|
||||
global $tester;
|
||||
|
||||
include_once dirname(__FILE__, 3) . '/model.php';
|
||||
|
||||
if (!class_exists('block')) {
|
||||
class_alias('blockModel', 'block');
|
||||
}
|
||||
|
||||
include_once dirname(__FILE__, 3) . '/zen.php';
|
||||
|
||||
$blockZen = new blockZen();
|
||||
$blockZen->block = $this->objectModel; // 设置block属性
|
||||
|
||||
$result = $blockZen->initBlock($dashboard);
|
||||
|
||||
if(dao::isError()) return dao::getError();
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
#!/usr/bin/env php
|
||||
<?php
|
||||
|
||||
/**
|
||||
|
||||
title=测试 blockZen::initBlock();
|
||||
timeout=0
|
||||
cid=0
|
||||
|
||||
- 执行blockTest模块的zenInitBlockTest方法,参数是'my' @1
|
||||
- 执行blockTest模块的zenInitBlockTest方法,参数是'qa' @1
|
||||
- 执行blockTest模块的zenInitBlockTest方法,参数是'' @0
|
||||
- 执行blockTest模块的zenInitBlockTest方法,参数是'product' @1
|
||||
- 执行blockTest模块的zenInitBlockTest方法,参数是'my' @1
|
||||
|
||||
*/
|
||||
|
||||
include dirname(__FILE__, 5) . '/test/lib/init.php';
|
||||
include dirname(__FILE__, 2) . '/lib/block.unittest.class.php';
|
||||
|
||||
su('admin');
|
||||
|
||||
$blockTest = new blockTest();
|
||||
|
||||
r($blockTest->zenInitBlockTest('my')) && p() && e(1);
|
||||
r($blockTest->zenInitBlockTest('qa')) && p() && e(1);
|
||||
r($blockTest->zenInitBlockTest('')) && p() && e(0);
|
||||
r($blockTest->zenInitBlockTest('product')) && p() && e(1);
|
||||
r($blockTest->zenInitBlockTest('my')) && p() && e(1);
|
||||
Reference in New Issue
Block a user