* SPDX-License-Identifier: MIT */ declare(strict_types=1); namespace Respect\Validation\Rules; use Respect\Validation\Test\RuleTestCase; use stdClass; /** * @group rule * * @covers \Respect\Validation\Rules\Callback * * @author Alexandre Gomes Gaigalas * @author Gabriel Caruso * @author Henrique Moody * @author Nick Lombard * @author William Espindola */ final class CallbackTest extends RuleTestCase { /** * {@inheritDoc} */ public static function providerForValidInput(): array { return [ [new Callback('is_a', 'stdClass'), new stdClass()], [new Callback([new AlwaysValid(), 'validate']), 'test'], [new Callback('is_string'), 'test'], [ new Callback(static function () { return true; }), 'wpoiur', ], ]; } /** * {@inheritDoc} */ public static function providerForInvalidInput(): array { return [ [ new Callback(static function () { return false; }), 'w poiur', ], [ new Callback(static function () { return false; }), '', ], ]; } }