{
...
"require": {
...
"lvcodesmith/php-expect": "dev-master"
...
}
...
}
It is very easy to create a matcher using php-expect. Just put it in the Expect::$matchers static array. Here's how.
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.
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"
);
};
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.