lvcodesmith / php-expect
Installs: 3 814
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 0
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
I'm on Packigist!
{ ... "require": { ... "lvcodesmith/php-expect": "dev-master" ... } ... }
Matching that doesn't suck ... mostly
It is very easy to create a matcher using php-expect. Just put it in the Expect::$matchers static array. Here's how.
Matcher skeleton
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" ); }
Of course, you don't need to write $positive_matcher = or $negative_matcher =, but it helps add context.
The toSuck matcher:
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" ); };
Social Updates
This project will be using Trello.com to manage the project. If you want access, please send a message to @LVCSkunkworks. Follow @LVCSkunkworks to see real time activity.