rodrigodiez/mockable-predis
Composer 安装命令:
composer require rodrigodiez/mockable-predis
包简介
A class that extends Predis/Client and has all its magic methods anotated so you can create Prophecy mocks
README 文档
README
Mockable Predis
This project allows developers to use PhpSpec/Prophecy to TDD projects that use Predis by allowing mocks of the Client to be created.
Installation
composer require rodrigodiez/mockable-predis
Use
Just use RodrigoDiez\MockablePredis\Client class in your code instead of Predis\Client
Why is this needed?
Predis makes intensive use of magic call methods in its Client class making it impossible for some mocking frameworks to guess its interface and create mocks.
One common workaround when using magic call methods within a class is to document them using @method annotations as described here
Predis maintainers decided to document these methods in the ClientInterface instead of doing it in the Client class itself as recommended by phpdoc documentation. On the other hand, Prophecy maintainers refuse to read @method annotations from interfaces.
Full history and both sides arguments can be found here and here.
统计信息
- 总下载量: 287
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-02-12