@covers PHPUnit_Framework_Constraint_Callback
public function testConstraintCallback() {
$closureReflect = function ($parameter) {
return $parameter;
};
$closureWithoutParameter = function () {
return TRUE;
};
$constraint = PHPUnit_Framework_Assert::callback($closureWithoutParameter);
$this
->assertTrue($constraint
->evaluate('', '', TRUE));
$constraint = PHPUnit_Framework_Assert::callback($closureReflect);
$this
->assertTrue($constraint
->evaluate(TRUE, '', TRUE));
$this
->assertFalse($constraint
->evaluate(FALSE, '', TRUE));
$callback = array(
$this,
'callbackReturningTrue',
);
$constraint = PHPUnit_Framework_Assert::callback($callback);
$this
->assertTrue($constraint
->evaluate(FALSE, '', TRUE));
$callback = array(
'Framework_ConstraintTest',
'staticCallbackReturningTrue',
);
$constraint = PHPUnit_Framework_Assert::callback($callback);
$this
->assertTrue($constraint
->evaluate(NULL, '', TRUE));
$this
->assertEquals('is accepted by specified callback', $constraint
->toString());
}