respect-validation/tests/unit/Rules
Henrique Moody 562d98d805
Refactor the NotEmpty rule
Since we have the ability to use `not` as a prefix, having rules that
validate negative behaviour makes them a bit inflexible, verbose, and
harder to understand.

This commit will refactor the `NotEmpty`, and rename it to `Falsy`. It
will no longer trim strings, because Blank does a much better job at it;
it only simulates the behaviour of PHP’s native `empty()` function.

Because `Falsy`, `Blank`, and `Undef` have similar behaviour, I created
a page to demonstrate the difference and show when the user should use
one or the other.

Assisted-by: Cursor (claude-4.5-opus-high)
2025-12-29 12:48:35 +01:00
..
Core Change how we trace the path of results 2025-12-20 22:19:17 +01:00
AllOfTest.php Update the validation engine of composite-based rules 2024-02-23 00:56:30 +01:00
AlnumTest.php Update the validation engine of filter-based rules 2024-02-22 17:21:49 +01:00
AlphaTest.php Update the validation engine of filter-based rules 2024-02-22 17:21:49 +01:00
AlwaysInvalidTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
AlwaysValidTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
AnyOfTest.php Improve composite-based rules 2024-03-06 18:02:39 +01:00
ArrayTypeTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
ArrayValTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
AttributesTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
Base64Test.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
BaseTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
BetweenExclusiveTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
BetweenTest.php Make proper use of exceptions in rules 2024-03-25 22:09:02 +01:00
BlankTest.php Invert the behaviour of NotBlank 2025-12-27 17:18:30 +01:00
BoolTypeTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
BoolValTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
BsnTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
CallableTypeTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
CallbackTest.php Remove previous validation engine 2024-03-25 12:28:25 +01:00
CallTest.php Update validation enginer of a few rules 2024-03-07 02:57:39 +01:00
CharsetTest.php Simplify InvalidRuleConstructorException 2024-03-24 18:06:38 +01:00
CircuitTest.php Rename "Consecutive" to "Circuit" 2024-12-20 16:53:56 +01:00
CnhTest.php Fix some errors detected by PHPStan 2025-05-18 14:15:41 +02:00
CnpjTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
ConsonantTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
ContainsAnyTest.php Update the validation engine of composite-based rules 2024-02-23 00:56:30 +01:00
ContainsTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
ControlTest.php Update the validation engine of filter-based rules 2024-02-22 17:21:49 +01:00
CountableTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
CountryCodeTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
CpfTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
CreditCardTest.php Make proper use of exceptions in rules 2024-03-25 22:09:02 +01:00
CurrencyCodeTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
DateTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
DateTimeDiffTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
DateTimeTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
DecimalTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
DigitTest.php Update the validation engine of filter-based rules 2024-02-22 17:21:49 +01:00
DirectoryTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
DomainTest.php Allow to validate ArrayObject in key-related values 2024-03-08 21:36:49 +01:00
EachTest.php Update the validation engine of the "Each" rule 2024-03-03 14:45:47 +01:00
EmailTest.php Remove previous validation engine 2024-03-25 12:28:25 +01:00
EmojiTest.php Refactor the NotEmoji rule 2025-12-29 11:16:25 +01:00
EndsWithTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
EqualsTest.php Move core rules into the "Core" namespace 2024-03-03 16:12:58 +01:00
EquivalentTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
EvenTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
ExecutableTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
ExistsTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
ExtensionTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
FactorTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
FalseValTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
FalsyTest.php Refactor the NotEmpty rule 2025-12-29 12:48:35 +01:00
FibonacciTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
FileTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
FilterVarTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
FiniteTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
FloatTypeTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
FloatValTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
GraphTest.php Update the validation engine of filter-based rules 2024-02-22 17:21:49 +01:00
GreaterThanOrEqualTest.php Rename "Min" to "GreaterThanOrEqual" 2024-02-27 21:04:45 +01:00
GreaterThanTest.php Update the validation engine of comparison-based rules 2024-02-22 17:27:02 +01:00
HetuTest.php Create "Hetu" rule 2024-03-15 11:28:08 +01:00
HexRgbColorTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
IbanTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
IdenticalTest.php Move core rules into the "Core" namespace 2024-03-03 16:12:58 +01:00
ImageTest.php Remove previous validation engine 2024-03-25 12:28:25 +01:00
ImeiTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
InfiniteTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
InstanceTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
InTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
IntTypeTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
IntValTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
IpTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
IsbnTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
IterableTypeTest.php Allow to validate ArrayObject in key-related values 2024-03-08 21:36:49 +01:00
IterableValTest.php Rename "IterableType" into "IterableVal" 2024-02-29 23:02:32 +01:00
JsonTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
KeyExistsTest.php Split "Key" rules 2024-03-04 00:06:18 +01:00
KeyOptionalTest.php Handle names via the Named rule 2024-12-26 23:10:19 +01:00
KeySetTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
KeyTest.php Handle names via the Named rule 2024-12-26 23:10:19 +01:00
LanguageCodeTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
LazyTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
LeapDateTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
LeapYearTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
LengthTest.php Refactor the Length rule 2024-03-19 15:38:29 +01:00
LessThanOrEqualTest.php Rename "Max" to "LessThanOrEqual" 2024-02-27 21:12:13 +01:00
LessThanTest.php Move core rules into the "Core" namespace 2024-03-03 16:12:58 +01:00
LowercaseTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
LuhnTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
MacAddressTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
MaxTest.php Allow to validate ArrayObject in key-related values 2024-03-08 21:36:49 +01:00
MimetypeTest.php Update validation enginer of a few rules 2024-03-07 02:57:39 +01:00
MinTest.php Refactor the NotEmpty rule 2025-12-29 12:48:35 +01:00
MultipleTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
NegativeTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
NfeAccessKeyTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
NifTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
NipTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
NoneOfTest.php Update the validation engine of composite-based rules 2024-02-23 00:56:30 +01:00
NoTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
NotTest.php Move important value objects to the root namespace 2025-12-21 11:14:47 +01:00
NullOrTest.php Update NullOr to generate results with siblings 2024-12-04 18:06:12 +01:00
NullTypeTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
NumberTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
NumericValTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
ObjectTypeTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
OddTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
OneOfTest.php Update the validation engine of composite-based rules 2024-02-23 00:56:30 +01:00
PerfectSquareTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
PeselTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
PhoneTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
PhpLabelTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
PisTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
PolishIdCardTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
PortugueseNifTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
PositiveTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
PostalCodeTest.php Make proper use of exceptions in rules 2024-03-25 22:09:02 +01:00
PrimeNumberTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
PrintableTest.php Update the validation engine of filter-based rules 2024-02-22 17:21:49 +01:00
PropertyExistsTest.php Split the "Property" rule 2024-03-05 00:48:31 +01:00
PropertyOptionalTest.php Handle names via the Named rule 2024-12-26 23:10:19 +01:00
PropertyTest.php Handle names via the Named rule 2024-12-26 23:10:19 +01:00
PublicDomainSuffixTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
PunctTest.php Update the validation engine of filter-based rules 2024-02-22 17:21:49 +01:00
ReadableTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
RegexTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
ResourceTypeTest.php Improve how we handle data providers 2024-03-17 22:30:23 +01:00
RomanTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
ScalarValTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
SizeTest.php Refactor Size rule 2024-12-16 20:56:12 +01:00
SlugTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
SortedTest.php Make proper use of exceptions in rules 2024-03-25 22:09:02 +01:00
SpacedTest.php Invert the behaviour of NoWhitespace 2025-12-29 09:11:01 +01:00
SpaceTest.php Update the validation engine of filter-based rules 2024-02-22 17:21:49 +01:00
StartsWithTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
StringTypeTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
StringValTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
SubdivisionCodeTest.php Make proper use of exceptions in rules 2024-03-25 22:09:02 +01:00
SubsetTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
SymbolicLinkTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
TimeTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
TldTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
TrueValTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
UndefOrTest.php Update UndefOr to generate results with siblings 2024-12-04 19:08:32 +01:00
UndefTest.php Invert the behaviour of NotUndef 2025-12-27 18:49:46 +01:00
UniqueTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
UploadedTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
UppercaseTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
UrlTest.php Update the validation engine of envelop-based rules 2024-02-22 18:41:09 +01:00
UuidTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00
VersionTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
VideoUrlTest.php Increase code coverage of some rules 2024-04-23 16:01:55 +02:00
VowelTest.php Update the validation engine of filter-based rules 2024-02-22 17:21:49 +01:00
WhenTest.php Update validation engine 2024-02-22 16:54:44 +01:00
WritableTest.php Use a single line to describe return type 2024-02-04 20:04:40 +01:00
XdigitTest.php Update the validation engine of filter-based rules 2024-02-22 17:21:49 +01:00
YesTest.php Bump respect/coding-standard from 4 to 5 2025-12-18 19:03:39 +01:00