respect-validation/tests/unit/Rules/NotEmptyTest.php

59 lines
1.2 KiB
PHP
Raw Normal View History

2010-09-27 23:02:30 +02:00
<?php
2015-06-08 16:47:14 +02:00
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* SPDX-License-Identifier: MIT
*/
declare(strict_types=1);
2010-09-27 23:02:30 +02:00
namespace Respect\Validation\Rules;
use Respect\Validation\Test\RuleTestCase;
use stdClass;
2017-11-04 11:21:40 +01:00
/**
* @group rule
2017-02-04 14:01:14 +01:00
* @covers \Respect\Validation\Rules\NotEmpty
*
* @author Alexandre Gomes Gaigalas <alganet@gmail.com>
* @author Bram Van der Sype <bram.vandersype@gmail.com>
* @author Gabriel Caruso <carusogabriel34@gmail.com>
* @author Henrique Moody <henriquemoody@gmail.com>
*/
final class NotEmptyTest extends RuleTestCase
2010-09-27 23:02:30 +02:00
{
/**
* {@inheritDoc}
*/
public static function providerForValidInput(): array
2010-09-27 23:02:30 +02:00
{
$rule = new NotEmpty();
2010-09-27 23:02:30 +02:00
2015-10-18 03:44:47 +02:00
return [
[$rule, 1],
[$rule, ' oi'],
[$rule, [5]],
[$rule, [0]],
[$rule, new stdClass()],
2015-10-18 03:44:47 +02:00
];
}
/**
* {@inheritDoc}
*/
public static function providerForInvalidInput(): array
2010-09-27 23:02:30 +02:00
{
$rule = new NotEmpty();
2015-10-18 03:44:47 +02:00
return [
[$rule, ''],
[$rule, ' '],
[$rule, "\n"],
[$rule, false],
[$rule, null],
[$rule, []],
2015-10-18 03:44:47 +02:00
];
2010-09-27 23:02:30 +02:00
}
}