You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
966 B
PHTML
38 lines
966 B
PHTML
5 years ago
|
<?php
|
||
|
|
||
|
namespace Engelsystem\Test\Unit\Http\Validation\Rules;
|
||
|
|
||
|
use Engelsystem\Test\Unit\Http\Validation\Rules\Stub\UsesStringInputLength;
|
||
|
use Engelsystem\Test\Unit\TestCase;
|
||
|
|
||
|
class StringInputLengthTest extends TestCase
|
||
|
{
|
||
|
/**
|
||
|
* @covers \Engelsystem\Http\Validation\Rules\StringInputLength::validate
|
||
|
* @covers \Engelsystem\Http\Validation\Rules\StringInputLength::isDateTime
|
||
|
* @dataProvider validateProvider
|
||
|
* @param mixed $input
|
||
|
* @param mixed $expectedInput
|
||
|
*/
|
||
|
public function testValidate($input, $expectedInput)
|
||
|
{
|
||
|
$rule = new UsesStringInputLength();
|
||
|
$rule->validate($input);
|
||
|
|
||
|
$this->assertEquals($expectedInput, $rule->lastInput);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @return array[]
|
||
|
*/
|
||
|
public function validateProvider()
|
||
|
{
|
||
|
return [
|
||
|
['TEST', 4],
|
||
|
['?', 1],
|
||
|
['2042-01-01 00:00', '2042-01-01 00:00'],
|
||
|
['3', '3'],
|
||
|
];
|
||
|
}
|
||
|
}
|