\Ke\TestUtilsTestClassInstanceTrait

类实例辅助测试工具(Trait)

Summary

Methods
Properties
Constants
setTestInstance()
newTestMethod()
runMethodTest()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$_testInstance
$_testInstanceRef
N/A

Properties

$_testInstance

$_testInstance : 

Type

$_testInstanceRef

$_testInstanceRef : \ReflectionObject

Type

\ReflectionObject

Methods

setTestInstance()

setTestInstance(  $obj) : $this

设置当前测试的实例对象

Parameters

$obj

Returns

$this

newTestMethod()

newTestMethod(string  $method) : \Ke\TestUtils\TestMethod

生成一个实例类方法的测试对象

Parameters

string $method

Returns

\Ke\TestUtils\TestMethod

runMethodTest()

runMethodTest(string|\Ke\TestUtils\TestMethod  $method, array  $items, callable|null  $filterItemCallback = null, callable|null  $testItemCallback = null) : \Ke\TestUtils\TestMethod

执行一个方法进行测试

该方法不关心具体的测试内容,实质的测试内容,由testItemCallback来实现,所以未传入这个参数时,会抛出一个异常。

Parameters

string|\Ke\TestUtils\TestMethod $method

要进行测试的方法,可以是字符串,也可以是一个 TestMethod 实例

array $items

要进行单元测试的测试用例

callable|null $filterItemCallback

每个测试用例实例化时的回调过滤函数

callable|null $testItemCallback

每个测试用例实例实际执行测试的回调函数

Returns

\Ke\TestUtils\TestMethod