* * For the full copyright and license information, please view the "LICENSE.md" * file that was distributed with this source code. */ declare(strict_types=1); namespace Respect\Validation\Rules; use Respect\Validation\Test\RuleTestCase; /** * @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 function providerForValidInput(): array { return [ [new Callback('is_a', 'stdClass'), new \stdClass()], [new Callback([$this, 'sampleCallbackUsedInsideThisTest']), 'test'], [new Callback('is_string'), 'test'], [ new Callback(function () { return true; }), 'wpoiur' ], ]; } public function sampleCallbackUsedInsideThisTest() { return true; } /** * {@inheritdoc} */ public function providerForInvalidInput(): array { return [ [ new Callback(function () { return false; }), 'w poiur' ], [ new Callback(function () { return false; }), '' ], ]; } }