respect-validation/tests/unit/Rules/NotEmojiTest.php
Alexandre Gomes Gaigalas ab3732f91f Use SPDX IDs for licensing
SPDX IDs are shorter than licensing notes previously used, and
adhere better to FOSS standards. It is also machine-readable.
2023-02-19 00:19:10 -03:00

75 lines
2.4 KiB
PHP

<?php
/*
* Copyright (c) Alexandre Gomes Gaigalas <alganet@gmail.com>
* 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\NotEmoji
*
* @author Henrique Moody <henriquemoody@gmail.com>
* @author Mazen Touati <mazen_touati@hotmail.com>
*/
final class NotEmojiTest extends RuleTestCase
{
/**
* {@inheritDoc}
*/
public function providerForValidInput(): array
{
$sut = new NotEmoji();
return [
'Numbers' => [$sut, '0123456789'],
'Alpha' => [$sut, 'ABCDEFGHIKLMNOPQRSTVXYZabcdefghiklmnopqrstvxyz'],
'Symbols' => [$sut, '&"\'(-_)@-*/+.'],
'Unicode symbols' => [$sut, 'çàéè⁊ǷÞÐÆ'],
'Arabic' => [$sut, 'ضصثقفغعهخحجشسيبلاتنمكطئءؤرلاىةوزظذ'],
'Russian' => [$sut, 'русский'],
'Japanese' => [$sut, 'ろぬふあうえおやゆよわ゛へちついすかんなにらせれせ゜たqとしはきくまのりもろむてさそひこみねるめ!'],
];
}
/**
* {@inheritDoc}
*/
public function providerForInvalidInput(): array
{
$sut = new NotEmoji();
return [
'Smileys & People' => [$sut, '🤣'],
'Backhand Index Pointing Right with modifier' => [$sut, '👉🏿'],
'Santa Claus with modifier' => [$sut, '🎅🏾'],
'Man Frowning with modifier' => [$sut, '🙍🏻‍♂️'],
'Animals & Nature' => [$sut, '🐵'],
'Food & Drink' => [$sut, '🍎'],
'Travel & Places' => [$sut, '⛰️'],
'Activities' => [$sut, '🎈'],
'Objects' => [$sut, '📢'],
'Symbols from Unicode 4.0' => [$sut, '⚠️'],
'Symbols from Unicode 7.0' => [$sut, '⏺️'],
'Symbols from Unicode 6.0' => [$sut, '✅'],
'Flags Emoji 1.0' => [$sut, '🇹🇳'],
'Flags Emoji 4.0' => [$sut, '🏳️‍🌈'],
'Flags Emoji 5.0' => [$sut, '🏴󠁧󠁢󠁥󠁮󠁧󠁿'],
'Flags Emoji 11.0' => [$sut, '🏴‍☠️'],
'Flags' => [$sut, '🇹🇳'],
'Mixed with text' => [$sut, 'this is a pizza 🍕'],
'Array' => [$sut, []],
'Bool' => [$sut, true],
'Object' => [$sut, new stdClass()],
];
}
}