crellbar / prophecy-extensions
Prophecy 对流畅接口的承诺
v1.1
2018-03-29 09:31 UTC
Requires
- phpspec/prophecy: ^1.5
This package is not auto-updated.
Last update: 2024-09-29 05:01:56 UTC
README
通过 composer 安装
php ./composer.phar require --dev crellbar/prophecy-extensions
FluidPromise
提供简单的流畅接口预言承诺。
尽管我对流畅接口有些抵触,但我还是构建了这个库,因为我和我的项目团队使用它们。在您的代码中承诺使用流畅接口之前,我强烈建议您了解我认为超过 可读性 小优点的许多缺点。以下是其中一个来源 https://ocramius.github.io/blog/fluent-interfaces-are-evil/
用法
use Crellbar\ProphecyExtensions\FluidPromise as Fluid; /** @var ObjectProphecy $prophecy */ ... // setup prophecy in the usual fashion for the test tool you're using $prophecy->myMethod(Argument::any())->will(new Fluid());
VoidPromise
用法
use Crellbar\ProphecyExtensions\VoidPromise as VoidP; /** @var ObjectProphecy $prophecy */ ... // setup prophecy in the usual fashion for the test tool you're using $prophecy->myMethod(Argument::any())->will(new VoidP());