Download the PHP package yunbuye/thinkphp-testing without Composer
On this page you can find all versions of the php package yunbuye/thinkphp-testing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package thinkphp-testing
yunbuye/thinkphp-testing
一个测试友好的ThinkPHP测试扩展
安装
修改 phpunit.xml 文件,在 phpunit 标签加入 bootstrap="vendor/autoload.php"
使用时注意
- 测试类必须继承 Yunbuye\ThinkTesting\TestCase 测试类
- 如果不是使用thinkPHP命令(php think unit) 运行的测试,需要设置 $app_path 和加载基础文件。
例:
功能
-
模拟对象
只要是使用容器进行管理的对象,都可以使用以下方法进行模拟(具体的 Mockery 使用方法,请参考 文档:为了让以上过程更加便捷:
同样,如果你想侦查一个对象,基本测试用例类提供了一个便捷的 spy 方法作为 Mockery::spy 的替代方法:
-
每次测试后数据库回滚
每次运行测试用例后,为了不互相污染数据,可以选择数据库回滚。
例: -
Facade mock 模拟
安装扩展(不要加--dev)具体使用,请参考 yunbuye/thinkphp-facade
-
模型工厂
安装扩展(加--dev)具体使用,请参考 yunbuye/thinkphp-model-factory
All versions of thinkphp-testing with dependencies
PHP Build Version
Package Version
Requires
php Version
>=7.1.0
fzaninotto/faker Version ~1.0
topthink/framework Version 5.1.*
mockery/mockery Version ^0.9.5
phpunit/phpunit Version ^6.0
topthink/think-testing Version 2.0.*
ext-json Version *
fzaninotto/faker Version ~1.0
topthink/framework Version 5.1.*
mockery/mockery Version ^0.9.5
phpunit/phpunit Version ^6.0
topthink/think-testing Version 2.0.*
ext-json Version *
The package yunbuye/thinkphp-testing contains the following files
Loading the files please wait ....