diff --git a/lib/IsTinyChar.php b/lib/IsTinyChar.php new file mode 100644 index 000000000..c04abc1d8 --- /dev/null +++ b/lib/IsTinyChar.php @@ -0,0 +1,22 @@ + + */ +class IsTinyChar extends IsChar +{ + /** + * @var int + */ + protected $maxLength = 255; +} diff --git a/tests/unit/IsTinyCharTest.php b/tests/unit/IsTinyCharTest.php new file mode 100644 index 000000000..6dfd81d66 --- /dev/null +++ b/tests/unit/IsTinyCharTest.php @@ -0,0 +1,44 @@ +assertTrue($this->isTinyChar($input)); + } + + /** + * @dataProvider providerForNotLength + * @param mixed $input + */ + public function testNotLength($input) + { + $this->assertFalse($this->isTinyChar($input)); + } + + public function providerForLength() + { + return [ + ['iā™„u4'], + [str_repeat('1', 255)], + [str_repeat('šŸ˜Š', 255)], + ]; + } + + public function providerForNotLength() + { + return [ + [str_repeat('1', 256)], + [str_repeat('šŸ˜Š', 255) . '1'], + ]; + } +}