php - 用于 php 单元测试的理想 stub 实用程序

标签 php unit-testing stub utilities

我正在寻找用于在 php 中进行单元测试的 stub 的实用程序。 stub 必须满足类型提示。必须能够检查带参数的方法调用。必须能够根据指定的参数返回值。 你知道吗?

最佳答案

Mockery是一个不错的选择:

来自 GitHub padraic / mockery

Mockery is a simple yet flexible PHP mock object framework for use in unit testing with PHPUnit, PHPSpec or any other testing framework. Its core goal is to offer a test double framework with a succint API capable of clearly defining all possible object operations and interactions using a human readable Domain Specific Language (DSL). Designed as a drop in alternative to PHPUnit's phpunit-mock-objects library, Mockery is easy to integrate with PHPUnit and can operate alongside phpunit-mock-objects without the World ending.

Mockery is released under a New BSD License.

关于php - 用于 php 单元测试的理想 stub 实用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13168640/

相关文章:

javascript - 传递 js 变量以形成操作 url

Angular2 单元测试 - 未触发 MdCheckbox 中的更改事件

java - Axis 客户端 stub 日历错误日期

java - 将 JUnit 转换为 RESTful 服务

java - 如何使用 Mockito 模拟方法调用

java - Spock - 返回固定值不按预期工作

javascript - 如何 stub 未直接传递给调用函数的函数?

php - 在 localhost 中连接 MYSQL 时出现问题

php - Ajax 未将值传递给 php 文件

php - 如何声明函数的日期特定值