ascii-soup/hamcrest-callback-matcher

Hamcrest matcher that matches against a provided callback.

Maintainers

👁 ascii-soup

Package info

github.com/ascii-soup/hamcrest-callback-matcher

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

Statistics

Installs: 7 025

Dependents: 1

Suggesters: 0

Stars: 1

Open Issues: 0

1.1 2016-03-16 15:42 UTC

Requires

Requires (Dev)

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT f38262830de5d624f0c9a79ea050b90cd45d04f3

  • Nils Luxton <nils.luxton.woop@gmail.com>

This package is auto-updated.

Last update: 2026-06-12 07:49:43 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';
 }
 )
}