我正在寻找用于在 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/