Skip to content
This repository has been archived by the owner on Mar 28, 2022. It is now read-only.

wscoble/php-expect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Expect::your($test)->not->toSuck();

Build Status

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.

About

Expect::your($test)->not->toSuck();

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages