Skip to content

ascii-soup/hamcrest-callback-matcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hamcrest Callback Matcher

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';
        }
    )
}

About

Hamcrest matcher for matching using callbacks

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages