lvcodesmith / php-expect
此包已被废弃且不再维护。没有推荐替代包。
dev-master
2015-10-29 19:18 UTC
Requires
- php: >=5.3.2
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is not auto-updated.
Last update: 2022-04-02 01:22:49 UTC
README
我在 Packigist 上!
{
...
"require": {
...
"lvcodesmith/php-expect": "dev-master"
...
}
...
}
不糟糕的匹配 ... 大多数情况下
使用 php-expect 创建匹配器非常简单。只需将其放入 Expect::$matchers 静态数组中。以下是方法。
匹配器骨架
Expect::$matchers['matcher'] = function($actual, $expected) { return array( $positive_matcher = function() use ($actual, $expected) { }, "What to say when the positive matcher fails", $negative_matcher = function() use ($actual, $expected) { }, "What to say when the negative matcher fails" ); }
当然,您不需要编写 $positive_matcher = 或 $negative_matcher =,但这有助于增加上下文。
the toSuck 匹配器
Expect::$matchers['toSuck'] = function ($actual, $expected) { $class = get_class($actual); return array( $positive_matcher = function () use ($class) { assert( $class == 'Suck' ); }, "Expected object to suck", $negative_matcher = function () use ($class) { assert( $class != 'Suck' ); }, "Expected object not to suck" ); };
社交更新
此项目将使用 Trello.com 来管理项目。如果您想获得访问权限,请向 @LVCSkunkworks 发送消息。关注 @LVCSkunkworks 以查看实时活动。