ignaszak/testing-tools
Composer 安装命令:
composer require ignaszak/testing-tools
包简介
Testing tools
README 文档
README
This package provides tools for testing class via reflection.
Requirements
- PHP >= 7.0.0
- PHPUnit >= 6.0.0
Installation
composer require ignaszak/testing-tools
Usage
Get property value
<?php use Ignaszak\TestingTools\Test; Test::get('propertyName', $object);
Set property value
<?php use Ignaszak\TestingTools\Test; // Set value Test::inject('propertyName', 'new value', $object); // Get value Test::get('propertyName', $object);
Call method
<?php use Ignaszak\TestingTools\Test; // Call method with args Test::call('method', ['arg1', 'arg2'], $object); // Call method wthout args Test::call('method', null, $object);
Define tested class
You can set instance of tested class in Test::$object.
<?php use Ignaszak\TestingTools\Test; Test::$object = new Example(); // All these methods refers to `Example` Test::inject('propertyName', 'new value'); Test::inject('propertyName'); // Set null Test::get('propertyName'); Test::call('method'); Test::call('method', ['arg1', 'arg2']);
统计信息
- 总下载量: 39
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-09-01