2017 © Pedro Peláez
 

library php-expect

image

lvcodesmith/php-expect

  • Thursday, October 29, 2015
  • by lvcodesmith
  • Repository
  • 2 Watchers
  • 1 Stars
  • 1,482 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 5 % Grown

The README.md

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

Build Status, (*1)

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., (*2)

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., (*3)

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., (*4)

The Versions

29/10 2015

dev-master

9999999-dev

  Sources   Download

MIT

The Requires

  • php >=5.3.2

 

The Development Requires