bluepsyduck/test-helper
最新稳定版本:2.0.0
Composer 安装命令:
composer require bluepsyduck/test-helper
包简介
Some traits helping with testing using PHPUnit.
README 文档
README
This library contains a trait helping with testing classes using PHPUnit by providing some shortcut methods for the test cases.
ReflectionTrait
The ReflectionTrait is a trait which adds methods for easier access to non-public properties and methods, making
mocking them easier. The trait comes with the following methods:
injectProperty($object, $name, $value): Injects the value to a property of the object.injectStaticProperty($className, $name, $value): Injects the value to a static property of the class.extractProperty($object, $name): Extracts the value of a property from the object.extractStaticProperty($className, $name): Extracts the value of a static property from the class.invokeMethod($object, $name, ...$params): Invokes a non-public method on the object.invokeStaticMethod($className, $name, ...$params): Invokes a non-public static method on the class.
Note: The parameters passed to invokeMethod() and invokeStaticMethod() are passed-by-value. If the method uses
references, the changes made by the method will not be visible to the outside.
统计信息
- 总下载量: 39.9k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 22
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0-or-later
- 更新时间: 2019-04-23