ascii-soup/hamcrest-callback-matcher

Hamcrest matcher that matches against a provided callback.

Installs: 6 138

Dependents: 1

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/ascii-soup/hamcrest-callback-matcher

1.1 2016-03-16 15:42 UTC

This package is auto-updated.

Last update: 2025-09-12 05:55:31 UTC


README

Usage:

assertThat("hello", matchesUsing(function($value) { return $value === "hello"; }));

Creating new custom matchers

Creating new custom matchers is made simpler with the callback matcher.

You can use describedAs() to provide a better description for the expectation.

function myCustomMatcher()
{
    return describedAs('a custom value', new CallbackMatcher(
        function($value) {
            return $value === 'my custom value';
        }
    )
}