Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[feature] Define matchers on the fly #15

@ghost

Description

It should be possible to define matchers on the fly

\PHPSpec\Matchers\define('contain', function($match, $actual) {
    return in_array($match, $actual);
});

class MyArraySpec extends \Context\PHPSpec {
    function itAddsNewElementsUsingArrayOperator() {
        $array = new MyArray();
        $array[] = 42;
        $array->should->contain(42);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions