diff --git a/docs/03-handling-exceptions.md b/docs/03-handling-exceptions.md index 490ad053d..a006bb8a0 100644 --- a/docs/03-handling-exceptions.md +++ b/docs/03-handling-exceptions.md @@ -44,7 +44,7 @@ The code above generates the following output: ```no-highlight Array ( - [__root__] => All the required rules must pass for "The Respect Panda" + [__root] => All the required rules must pass for "The Respect Panda" [alnum] => "The Respect Panda" must contain only letters (a-z) and digits (0-9) [lowercase] => "The Respect Panda" must contain only lowercase letters ) @@ -69,7 +69,7 @@ try { ->assert( 'The Respect Panda', [ - '__root__' => 'The given input is not valid', + '__root' => 'The given input is not valid', 'alnum' => 'Your username must contain only letters and digits', 'lowercase' => 'Your username must be lowercase', ] @@ -84,7 +84,7 @@ The code above will generate the following output. ```no-highlight Array ( - [__root__] => The given input is not valid + [__root] => The given input is not valid [alnum] => Your username must contain only letters and digits [lowercase] => Your username must be lowercase ) @@ -100,7 +100,7 @@ use Respect\Validation\Validator as v; $validator = v::alnum()->lowercase(); $validator->setTemplates([ - '__root__' => '{{name}} is not valid', + '__root' => '{{name}} is not valid', 'alnum' => 'Usernames must contain only letters and digits', 'lowercase' => 'Usernames must be lowercase', ]); diff --git a/library/Message/StandardFormatter.php b/library/Message/StandardFormatter.php index 5e007aa8f..7b4550436 100644 --- a/library/Message/StandardFormatter.php +++ b/library/Message/StandardFormatter.php @@ -99,7 +99,7 @@ public function array(Result $result, array $templates, Translator $translator): { $selectedTemplates = $this->selectTemplates($result, $templates); $messages = [ - '__root__' => $this->renderer->render($this->getTemplated($result, $selectedTemplates), $translator), + '__root' => $this->renderer->render($this->getTemplated($result, $selectedTemplates), $translator), ]; $children = []; @@ -120,7 +120,7 @@ public function array(Result $result, array $templates, Translator $translator): } if (count($children) === 0 || $this->isFinalTemplate($result, $selectedTemplates)) { - return [$result->path ?? $result->id => $messages['__root__']]; + return [$result->path ?? $result->id => $messages['__root']]; } if ($result->path !== null) { @@ -172,7 +172,7 @@ private function getTemplated(Result $result, array $templates): Result return $result; } - foreach ([$result->path, $result->name, $result->id, '__root__'] as $key) { + foreach ([$result->path, $result->name, $result->id, '__root'] as $key) { if (!isset($templates[$key])) { continue; } @@ -211,7 +211,7 @@ private function isFinalTemplate(Result $result, array $templates): bool } } - return isset($templates['__root__']); + return isset($templates['__root']); } /** diff --git a/library/Validator.php b/library/Validator.php index 23ebee95c..2f8f13964 100644 --- a/library/Validator.php +++ b/library/Validator.php @@ -81,9 +81,9 @@ public function assert(mixed $input, array|string|Throwable|callable|null $templ if (is_array($template)) { $templates = $template; } elseif (is_string($template)) { - $templates = ['__root__' => $template]; + $templates = ['__root' => $template]; } elseif ($this->getTemplate() != null) { - $templates = ['__root__' => $this->getTemplate()]; + $templates = ['__root' => $this->getTemplate()]; } $exception = new ValidationException( diff --git a/tests/feature/GetMessagesShouldIncludeAllValidationMessagesInAChainTest.php b/tests/feature/GetMessagesShouldIncludeAllValidationMessagesInAChainTest.php index e391be986..fed9dca02 100644 --- a/tests/feature/GetMessagesShouldIncludeAllValidationMessagesInAChainTest.php +++ b/tests/feature/GetMessagesShouldIncludeAllValidationMessagesInAChainTest.php @@ -20,7 +20,7 @@ function (): void { ->assert(['username' => 'u', 'birthdate' => 'Not a date', 'password' => '']); }, [ - '__root__' => 'All the required rules must pass for `["username": "u", "birthdate": "Not a date", "password": ""]`', + '__root' => 'All the required rules must pass for `["username": "u", "birthdate": "Not a date", "password": ""]`', 'username' => 'The length of username must be between 2 and 32', 'birthdate' => 'birthdate must be a valid date/time', 'password' => 'password must not be empty', diff --git a/tests/feature/GetMessagesTest.php b/tests/feature/GetMessagesTest.php index a18315667..1356793d2 100644 --- a/tests/feature/GetMessagesTest.php +++ b/tests/feature/GetMessagesTest.php @@ -20,16 +20,16 @@ ->key('schema', v::stringType())) ->assert(['mysql' => ['host' => 42, 'schema' => 42], 'postgresql' => ['user' => 42, 'password' => 42]]), [ - '__root__' => 'All the required rules must pass for `["mysql": ["host": 42, "schema": 42], "postgresql": ["user": 42, "password": 42]]`', + '__root' => 'All the required rules must pass for `["mysql": ["host": 42, "schema": 42], "postgresql": ["user": 42, "password": 42]]`', 'mysql' => [ - '__root__' => 'All the required rules must pass for mysql', + '__root' => 'All the required rules must pass for mysql', 'host' => 'host must be a string', 'user' => 'user must be present', 'password' => 'password must be present', 'schema' => 'schema must be a string', ], 'postgresql' => [ - '__root__' => 'All the required rules must pass for postgresql', + '__root' => 'All the required rules must pass for postgresql', 'host' => 'host must be present', 'user' => 'user must be a string', 'password' => 'password must be a string', diff --git a/tests/feature/GetMessagesWithReplacementsTest.php b/tests/feature/GetMessagesWithReplacementsTest.php index b2c2c717f..8e743e7f1 100644 --- a/tests/feature/GetMessagesWithReplacementsTest.php +++ b/tests/feature/GetMessagesWithReplacementsTest.php @@ -49,16 +49,16 @@ function (): void { ); }, [ - '__root__' => 'All the required rules must pass for `["mysql": ["host": 42, "schema": 42], "postgresql": ["user": 42, "password": 42]]`', + '__root' => 'All the required rules must pass for `["mysql": ["host": 42, "schema": 42], "postgresql": ["user": 42, "password": 42]]`', 'mysql' => [ - '__root__' => 'All the required rules must pass for mysql', + '__root' => 'All the required rules must pass for mysql', 'host' => '`host` should be a MySQL host', 'user' => 'Value should be a MySQL username', 'password' => 'password must be present', 'schema' => 'schema must be a string', ], 'postgresql' => [ - '__root__' => 'All the required rules must pass for postgresql', + '__root' => 'All the required rules must pass for postgresql', 'host' => 'host must be present', 'user' => 'user must be a string', 'password' => 'password must be a string', diff --git a/tests/feature/Issues/Issue1033Test.php b/tests/feature/Issues/Issue1033Test.php index 246c30cc1..a8994bb6e 100644 --- a/tests/feature/Issues/Issue1033Test.php +++ b/tests/feature/Issues/Issue1033Test.php @@ -17,7 +17,7 @@ - "B" must be equal to 1 FULL_MESSAGE, [ - '__root__' => 'Each item in `["A", "B", "B"]` must be valid', + '__root' => 'Each item in `["A", "B", "B"]` must be valid', 0 => '"A" must be equal to 1', 1 => '"B" must be equal to 1', 2 => '"B" must be equal to 1', diff --git a/tests/feature/Issues/Issue1289Test.php b/tests/feature/Issues/Issue1289Test.php index 9edf422d7..837e32ac7 100644 --- a/tests/feature/Issues/Issue1289Test.php +++ b/tests/feature/Issues/Issue1289Test.php @@ -54,11 +54,11 @@ - description must be a string value FULL_MESSAGE, [ - '__root__' => 'Each item in `[["default": 2, "description": [], "children": ["nope"]]]` must be valid', + '__root' => 'Each item in `[["default": 2, "description": [], "children": ["nope"]]]` must be valid', 0 => [ - '__root__' => 'These rules must pass for `["default": 2, "description": [], "children": ["nope"]]`', + '__root' => 'These rules must pass for `["default": 2, "description": [], "children": ["nope"]]`', 'default' => [ - '__root__' => 'Only one of these rules must pass for default', + '__root' => 'Only one of these rules must pass for default', 'stringType' => 'default must be a string', 'boolType' => 'default must be a boolean', ], diff --git a/tests/feature/Issues/Issue1333Test.php b/tests/feature/Issues/Issue1333Test.php index af3f45e63..731611f77 100644 --- a/tests/feature/Issues/Issue1333Test.php +++ b/tests/feature/Issues/Issue1333Test.php @@ -16,7 +16,7 @@ - User Email must be a valid email address FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for User Email', + '__root' => 'All the required rules must pass for User Email', 'noWhitespace' => 'User Email must not contain whitespaces', 'email' => 'User Email must be a valid email address', ] diff --git a/tests/feature/Issues/Issue1334Test.php b/tests/feature/Issues/Issue1334Test.php index 411a55c1b..eceba7ef9 100644 --- a/tests/feature/Issues/Issue1334Test.php +++ b/tests/feature/Issues/Issue1334Test.php @@ -35,28 +35,28 @@ function (): void { - street must be a string FULL_MESSAGE, [ - '__root__' => 'These rules must pass for `[["region": "Oregon", "country": "USA", "other": 123], ["street": "", "region": "Oregon", "country": "USA"], ["s ... ]`', + '__root' => 'These rules must pass for `[["region": "Oregon", "country": "USA", "other": 123], ["street": "", "region": "Oregon", "country": "USA"], ["s ... ]`', 'each' => [ - '__root__' => 'Each item in `[["region": "Oregon", "country": "USA", "other": 123], ["street": "", "region": "Oregon", "country": "USA"], ["s ... ]` must be valid', + '__root' => 'Each item in `[["region": "Oregon", "country": "USA", "other": 123], ["street": "", "region": "Oregon", "country": "USA"], ["s ... ]` must be valid', 0 => [ - '__root__' => 'These rules must pass for `["region": "Oregon", "country": "USA", "other": 123]`', + '__root' => 'These rules must pass for `["region": "Oregon", "country": "USA", "other": 123]`', 'street' => 'street must be present', 'other' => [ - '__root__' => 'These rules must pass for other', + '__root' => 'These rules must pass for other', 'nullOrStringType' => 'other must be a string or must be null', ], ], 1 => [ - '__root__' => 'These rules must pass for `["street": "", "region": "Oregon", "country": "USA"]`', + '__root' => 'These rules must pass for `["street": "", "region": "Oregon", "country": "USA"]`', 'street' => [ - '__root__' => 'These rules must pass for street', + '__root' => 'These rules must pass for street', 'notEmpty' => 'street must not be empty', ], ], 2 => [ - '__root__' => 'These rules must pass for `["street": 123, "region": "Oregon", "country": "USA"]`', + '__root' => 'These rules must pass for `["street": 123, "region": "Oregon", "country": "USA"]`', 'street' => [ - '__root__' => 'These rules must pass for street', + '__root' => 'These rules must pass for street', 'stringType' => 'street must be a string', ], ], diff --git a/tests/feature/Issues/Issue1348Test.php b/tests/feature/Issues/Issue1348Test.php index 4f9797c0f..08596c167 100644 --- a/tests/feature/Issues/Issue1348Test.php +++ b/tests/feature/Issues/Issue1348Test.php @@ -47,39 +47,39 @@ - model must be in `["F150", "Bronco"]` FULL_MESSAGE, [ - '__root__' => 'These rules must pass for `[["manufacturer": "Honda", "model": "Accord"], ["manufacturer": "Toyota", "model": "Rav4"], ["manufacturer": "Fo ... ]`', + '__root' => 'These rules must pass for `[["manufacturer": "Honda", "model": "Accord"], ["manufacturer": "Toyota", "model": "Rav4"], ["manufacturer": "Fo ... ]`', 'each' => [ - '__root__' => 'Each item in `[["manufacturer": "Honda", "model": "Accord"], ["manufacturer": "Toyota", "model": "Rav4"], ["manufacturer": "Fo ... ]` must be valid', + '__root' => 'Each item in `[["manufacturer": "Honda", "model": "Accord"], ["manufacturer": "Toyota", "model": "Rav4"], ["manufacturer": "Fo ... ]` must be valid', 2 => [ - '__root__' => 'Only one of these rules must pass for `["manufacturer": "Ford", "model": "not real"]`', + '__root' => 'Only one of these rules must pass for `["manufacturer": "Ford", "model": "not real"]`', 'allOf.1' => [ - '__root__' => 'All the required rules must pass for `["manufacturer": "Ford", "model": "not real"]`', + '__root' => 'All the required rules must pass for `["manufacturer": "Ford", "model": "not real"]`', 'manufacturer' => 'manufacturer must be equal to "Honda"', 'model' => 'model must be in `["Accord", "Fit"]`', ], 'allOf.2' => [ - '__root__' => 'All the required rules must pass for `["manufacturer": "Ford", "model": "not real"]`', + '__root' => 'All the required rules must pass for `["manufacturer": "Ford", "model": "not real"]`', 'manufacturer' => 'manufacturer must be equal to "Toyota"', 'model' => 'model must be in `["Rav4", "Camry"]`', ], 'allOf.3' => [ - '__root__' => 'These rules must pass for `["manufacturer": "Ford", "model": "not real"]`', + '__root' => 'These rules must pass for `["manufacturer": "Ford", "model": "not real"]`', 'model' => 'model must be in `["F150", "Bronco"]`', ], ], 3 => [ - '__root__' => 'Only one of these rules must pass for `["manufacturer": "Honda", "model": "not valid"]`', + '__root' => 'Only one of these rules must pass for `["manufacturer": "Honda", "model": "not valid"]`', 'allOf.1' => [ - '__root__' => 'These rules must pass for `["manufacturer": "Honda", "model": "not valid"]`', + '__root' => 'These rules must pass for `["manufacturer": "Honda", "model": "not valid"]`', 'model' => 'model must be in `["Accord", "Fit"]`', ], 'allOf.2' => [ - '__root__' => 'All the required rules must pass for `["manufacturer": "Honda", "model": "not valid"]`', + '__root' => 'All the required rules must pass for `["manufacturer": "Honda", "model": "not valid"]`', 'manufacturer' => 'manufacturer must be equal to "Toyota"', 'model' => 'model must be in `["Rav4", "Camry"]`', ], 'allOf.3' => [ - '__root__' => 'All the required rules must pass for `["manufacturer": "Honda", "model": "not valid"]`', + '__root' => 'All the required rules must pass for `["manufacturer": "Honda", "model": "not valid"]`', 'manufacturer' => 'manufacturer must be equal to "Ford"', 'model' => 'model must be in `["F150", "Bronco"]`', ], diff --git a/tests/feature/Issues/Issue1376Test.php b/tests/feature/Issues/Issue1376Test.php index d9bda8334..3e26584eb 100644 --- a/tests/feature/Issues/Issue1376Test.php +++ b/tests/feature/Issues/Issue1376Test.php @@ -25,11 +25,11 @@ - user must be present FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for `stdClass { +$author="foo" }`', + '__root' => 'All the required rules must pass for `stdClass { +$author="foo" }`', 'title' => 'title must be present', 'description' => 'description must be present', 'author' => [ - '__root__' => 'All the required rules must pass for author', + '__root' => 'All the required rules must pass for author', 'intType' => 'author must be an integer', 'lengthBetween' => 'The length of author must be between 1 and 2', ], diff --git a/tests/feature/Issues/Issue1427Test.php b/tests/feature/Issues/Issue1427Test.php index 239422ce7..82a0a1863 100644 --- a/tests/feature/Issues/Issue1427Test.php +++ b/tests/feature/Issues/Issue1427Test.php @@ -42,26 +42,26 @@ - permissions must be iterable FULL_MESSAGE, [ - '__root__' => 'Each item in `[16: ["groups": [1, "A", 3, 4, 5], "permissions": ["perm1": true, "perm2": false, "perm3": "boom!"]], 18: false, ... ]` must be valid', + '__root' => 'Each item in `[16: ["groups": [1, "A", 3, 4, 5], "permissions": ["perm1": true, "perm2": false, "perm3": "boom!"]], 18: false, ... ]` must be valid', 16 => [ - '__root__' => 'These rules must pass for `["groups": [1, "A", 3, 4, 5], "permissions": ["perm1": true, "perm2": false, "perm3": "boom!"]]`', + '__root' => 'These rules must pass for `["groups": [1, "A", 3, 4, 5], "permissions": ["perm1": true, "perm2": false, "perm3": "boom!"]]`', 'groups' => [ - '__root__' => 'Each item in groups must be valid', + '__root' => 'Each item in groups must be valid', 1 => 'groups must be an integer value', ], 'permissions' => [ - '__root__' => 'Each item in permissions must be valid', + '__root' => 'Each item in permissions must be valid', 'perm3' => 'permissions must be a boolean value', ], ], 18 => [ - '__root__' => 'All the required rules must pass for `false`', + '__root' => 'All the required rules must pass for `false`', 'arrayVal' => '`false` must be an array value', 'groups' => 'groups must be present', 'permissions' => 'permissions must be present', ], 24 => [ - '__root__' => 'These rules must pass for `["permissions": false]`', + '__root' => 'These rules must pass for `["permissions": false]`', 'groups' => 'groups must be present', 'permissions' => 'permissions must be iterable', ], diff --git a/tests/feature/Issues/Issue1469Test.php b/tests/feature/Issues/Issue1469Test.php index b4b9e00b2..3c204121e 100644 --- a/tests/feature/Issues/Issue1469Test.php +++ b/tests/feature/Issues/Issue1469Test.php @@ -39,20 +39,20 @@ function (): void { - product_title2 must not be present FULL_MESSAGE, [ - '__root__' => 'These rules must pass for `["order_items": [["product_title": test(?string $description = null, ?Closure $closure = null): Pest\Support\Hig ... ]`', + '__root' => 'These rules must pass for `["order_items": [["product_title": test(?string $description = null, ?Closure $closure = null): Pest\Support\Hig ... ]`', 'keySet' => [ - '__root__' => '`["order_items": [["product_title": test(?string $description = null, ?Closure $closure = null): Pest\Support\Hig ... ]` validation failed', + '__root' => '`["order_items": [["product_title": test(?string $description = null, ?Closure $closure = null): Pest\Support\Hig ... ]` validation failed', 'each' => [ - '__root__' => 'Each item in order_items must be valid', + '__root' => 'Each item in order_items must be valid', 0 => [ - '__root__' => 'order_items validation failed', + '__root' => 'order_items validation failed', 'quantity' => [ - '__root__' => 'These rules must pass for quantity', + '__root' => 'These rules must pass for quantity', 'intVal' => 'quantity must be an integer value', ], ], 1 => [ - '__root__' => 'order_items contains both missing and extra keys', + '__root' => 'order_items contains both missing and extra keys', 'product_title' => 'product_title must be present', 'quantity' => 'quantity must be present', 'product_title2' => 'product_title2 must not be present', diff --git a/tests/feature/Issues/Issue179Test.php b/tests/feature/Issues/Issue179Test.php index e4d3fa4cc..892eb6d55 100644 --- a/tests/feature/Issues/Issue179Test.php +++ b/tests/feature/Issues/Issue179Test.php @@ -30,7 +30,7 @@ function (): void { - user must be present FULL_MESSAGE, [ - '__root__' => 'These rules must pass for Settings', + '__root' => 'These rules must pass for Settings', 'host' => 'host must be a string', 'user' => 'user must be present', ] diff --git a/tests/feature/Issues/Issue425Test.php b/tests/feature/Issues/Issue425Test.php index a061afa92..943f1e35a 100644 --- a/tests/feature/Issues/Issue425Test.php +++ b/tests/feature/Issues/Issue425Test.php @@ -17,7 +17,7 @@ function (): void { 'reference must be present', '- reference must be present', [ - '__root__' => 'These rules must pass for `["age": 1]`', + '__root' => 'These rules must pass for `["age": 1]`', 'reference' => 'reference must be present', ] )); diff --git a/tests/feature/Issues/Issue446Test.php b/tests/feature/Issues/Issue446Test.php index 64411d6ea..aa5158744 100644 --- a/tests/feature/Issues/Issue446Test.php +++ b/tests/feature/Issues/Issue446Test.php @@ -20,7 +20,7 @@ 'The length of name must be between 2 and 32', '- The length of name must be between 2 and 32', [ - '__root__' => 'These rules must pass for `["name": "w", "email": "hello@hello.com"]`', + '__root' => 'These rules must pass for `["name": "w", "email": "hello@hello.com"]`', 'name' => 'The length of name must be between 2 and 32', ] )); diff --git a/tests/feature/Issues/Issue796Test.php b/tests/feature/Issues/Issue796Test.php index c531577a4..fe4ee80bb 100644 --- a/tests/feature/Issues/Issue796Test.php +++ b/tests/feature/Issues/Issue796Test.php @@ -49,13 +49,13 @@ - user must be a string FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for the given data', + '__root' => 'All the required rules must pass for the given data', 'mysql' => [ - '__root__' => 'These rules must pass for mysql', + '__root' => 'These rules must pass for mysql', 'host' => 'host must be a string', ], 'postgresql' => [ - '__root__' => 'These rules must pass for postgresql', + '__root' => 'These rules must pass for postgresql', 'user' => 'user must be a string', ], ] diff --git a/tests/feature/Issues/Issue799Test.php b/tests/feature/Issues/Issue799Test.php index 5e114c596..c5af166e8 100644 --- a/tests/feature/Issues/Issue799Test.php +++ b/tests/feature/Issues/Issue799Test.php @@ -25,7 +25,7 @@ - scheme must be present FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for 1', + '__root' => 'All the required rules must pass for 1', 'arrayVal' => '1 must be an array value', 'scheme' => 'scheme must be present', ] @@ -43,7 +43,7 @@ function ($url) { 'scheme must start with "https"', '- scheme must start with "https"', [ - '__root__' => 'These rules must pass for `["scheme": "http", "host": "www.google.com", "path": "/search", "query": "q=respect.github.com"]`', + '__root' => 'These rules must pass for `["scheme": "http", "host": "www.google.com", "path": "/search", "query": "q=respect.github.com"]`', 'scheme' => 'scheme must start with "https"', ] )); diff --git a/tests/feature/Readme/CustomMessagesTest.php b/tests/feature/Readme/CustomMessagesTest.php index 98b1d72d4..d3ce86d15 100644 --- a/tests/feature/Readme/CustomMessagesTest.php +++ b/tests/feature/Readme/CustomMessagesTest.php @@ -17,7 +17,7 @@ 'length' => '{{name}} must not have more than 15 chars', ]), [ - '__root__' => 'All the required rules must pass for "really messed up screen#name"', + '__root' => 'All the required rules must pass for "really messed up screen#name"', 'alnum' => '"really messed up screen#name" must contain only letters and digits', 'noWhitespace' => '"really messed up screen#name" cannot contain spaces', 'lengthBetween' => 'The length of "really messed up screen#name" must be between 1 and 15', diff --git a/tests/feature/Readme/GettingMessagesAsAnArrayTest.php b/tests/feature/Readme/GettingMessagesAsAnArrayTest.php index 58d1ce9d9..879a6aafb 100644 --- a/tests/feature/Readme/GettingMessagesAsAnArrayTest.php +++ b/tests/feature/Readme/GettingMessagesAsAnArrayTest.php @@ -10,7 +10,7 @@ test('Scenario #1', expectMessages( fn() => v::alnum()->noWhitespace()->lengthBetween(1, 15)->assert('really messed up screen#name'), [ - '__root__' => 'All the required rules must pass for "really messed up screen#name"', + '__root' => 'All the required rules must pass for "really messed up screen#name"', 'alnum' => '"really messed up screen#name" must contain only letters (a-z) and digits (0-9)', 'noWhitespace' => '"really messed up screen#name" must not contain whitespaces', 'lengthBetween' => 'The length of "really messed up screen#name" must be between 1 and 15', diff --git a/tests/feature/Rules/AllOfTest.php b/tests/feature/Rules/AllOfTest.php index d2069c1b5..0f1c8baaa 100644 --- a/tests/feature/Rules/AllOfTest.php +++ b/tests/feature/Rules/AllOfTest.php @@ -16,7 +16,7 @@ - "2" must be a negative number FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for "2"', + '__root' => 'All the required rules must pass for "2"', 'intType' => '"2" must be an integer', 'negative' => '"2" must be a negative number', ] @@ -31,7 +31,7 @@ - 3 must not be a positive number FULL_MESSAGE, [ - '__root__' => 'These rules must not pass for 3', + '__root' => 'These rules must not pass for 3', 'intType' => '3 must not be an integer', 'positive' => '3 must not be a positive number', ] @@ -42,7 +42,7 @@ '4 must not be an integer', '- 4 must not be an integer', [ - '__root__' => 'These rules must pass for 4', + '__root' => 'These rules must pass for 4', 'notIntType' => '4 must not be an integer', ] )); @@ -56,7 +56,7 @@ test('With multiple templates', expectAll( fn() => v::allOf(v::stringType(), v::uppercase())->assert(5, [ - '__root__' => 'Two things are wrong', + '__root' => 'Two things are wrong', 'stringType' => 'Template for "stringType"', 'uppercase' => 'Template for "uppercase"', ]), @@ -67,7 +67,7 @@ - Template for "uppercase" FULL_MESSAGE, [ - '__root__' => 'Two things are wrong', + '__root' => 'Two things are wrong', 'stringType' => 'Template for "stringType"', 'uppercase' => 'Template for "uppercase"', ] diff --git a/tests/feature/Rules/AttributesTest.php b/tests/feature/Rules/AttributesTest.php index da23a4cc3..955b77a4b 100644 --- a/tests/feature/Rules/AttributesTest.php +++ b/tests/feature/Rules/AttributesTest.php @@ -14,7 +14,7 @@ 'name must not be empty', '- name must not be empty', [ - '__root__' => 'These rules must pass for `Respect\Validation\Test\Stubs\WithAttributes { +$name="" +$email="john.doe@gmail.com" +$birthdate="2024-06-23" + ... }`', + '__root' => 'These rules must pass for `Respect\Validation\Test\Stubs\WithAttributes { +$name="" +$email="john.doe@gmail.com" +$birthdate="2024-06-23" + ... }`', 'name' => 'name must not be empty', ] )); @@ -24,7 +24,7 @@ 'phone must be a valid telephone number or must be null', '- phone must be a valid telephone number or must be null', [ - '__root__' => 'These rules must pass for `Respect\Validation\Test\Stubs\WithAttributes { +$name="John Doe" +$email="john.doe@gmail.com" +$birthdate="2024- ... }`', + '__root' => 'These rules must pass for `Respect\Validation\Test\Stubs\WithAttributes { +$name="John Doe" +$email="john.doe@gmail.com" +$birthdate="2024- ... }`', 'phone' => 'phone must be a valid telephone number or must be null', ] )); @@ -41,7 +41,7 @@ 'phone must be a valid telephone number or must be null', '- phone must be a valid telephone number or must be null', [ - '__root__' => 'These rules must pass for `Respect\Validation\Test\Stubs\WithAttributes { +$name="John Doe" +$email="john.doe@gmail.com" +$birthdate="2024- ... }`', + '__root' => 'These rules must pass for `Respect\Validation\Test\Stubs\WithAttributes { +$name="John Doe" +$email="john.doe@gmail.com" +$birthdate="2024- ... }`', 'phone' => 'phone must be a valid telephone number or must be null', ] )); @@ -59,11 +59,11 @@ - phone must be a valid telephone number or must be null FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for `Respect\\Validation\\Test\\Stubs\\WithAttributes { +$name="" +$email="not an email" +$birthdate="not a date" +$phone ... }`', + '__root' => 'All the required rules must pass for `Respect\\Validation\\Test\\Stubs\\WithAttributes { +$name="" +$email="not an email" +$birthdate="not a date" +$phone ... }`', 'name' => 'name must not be empty', 'email' => 'email must be a valid email address', 'birthdate' => [ - '__root__' => 'All the required rules must pass for birthdate', + '__root' => 'All the required rules must pass for birthdate', 'date' => 'birthdate must be a valid date in the format "2005-12-30"', 'dateTimeDiffLessThanOrEqual' => 'For comparison with now, birthdate must be a valid datetime', ], @@ -76,9 +76,9 @@ 'birthdate must be a valid date in the format "2005-12-30"', '- birthdate must be a valid date in the format "2005-12-30"', [ - '__root__' => 'These rules must pass for `Respect\Validation\Test\Stubs\WithAttributes { +$name="John Doe" +$email="john.doe@gmail.com" +$birthdate="22 ye ... }`', + '__root' => 'These rules must pass for `Respect\Validation\Test\Stubs\WithAttributes { +$name="John Doe" +$email="john.doe@gmail.com" +$birthdate="22 ye ... }`', 'birthdate' => [ - '__root__' => 'These rules must pass for birthdate', + '__root' => 'These rules must pass for birthdate', 'date' => 'birthdate must be a valid date in the format "2005-12-30"', ], ] diff --git a/tests/feature/Rules/DateTimeDiffTest.php b/tests/feature/Rules/DateTimeDiffTest.php index d59fe358b..e7b1195de 100644 --- a/tests/feature/Rules/DateTimeDiffTest.php +++ b/tests/feature/Rules/DateTimeDiffTest.php @@ -121,7 +121,7 @@ - The number of years between now and "1 year ago" must be between 2 and 5 FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for "1 year ago"', + '__root' => 'All the required rules must pass for "1 year ago"', 'dateTimeDiffPrimeNumber' => 'The number of years between now and "1 year ago" must be a prime number', 'dateTimeDiffBetween' => 'The number of years between now and "1 year ago" must be between 2 and 5', ] @@ -141,7 +141,7 @@ - The number of years between now and "1 year ago" must be between 2 and 5 FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for "1 year ago"', + '__root' => 'All the required rules must pass for "1 year ago"', 'dateTimeDiffPrimeNumber' => 'The number of years between now and "1 year ago" must be a prime number', 'dateTimeDiffBetween' => 'The number of years between now and "1 year ago" must be between 2 and 5', ] diff --git a/tests/feature/Rules/EachTest.php b/tests/feature/Rules/EachTest.php index ee1f78249..e04008d57 100644 --- a/tests/feature/Rules/EachTest.php +++ b/tests/feature/Rules/EachTest.php @@ -31,7 +31,7 @@ - "c" must be an integer FULL_MESSAGE, [ - '__root__' => 'Each item in `["a", "b", "c"]` must be valid', + '__root' => 'Each item in `["a", "b", "c"]` must be valid', 0 => '"a" must be an integer', 1 => '"b" must be an integer', 2 => '"c" must be an integer', @@ -48,7 +48,7 @@ - 3 must not be an integer FULL_MESSAGE, [ - '__root__' => 'Each item in `[1, 2, 3]` must be invalid', + '__root' => 'Each item in `[1, 2, 3]` must be invalid', 0 => '1 must not be an integer', 1 => '2 must not be an integer', 2 => '3 must not be an integer', @@ -79,7 +79,7 @@ - Wrapped must be an integer FULL_MESSAGE, [ - '__root__' => 'Each item in Wrapped must be valid', + '__root' => 'Each item in Wrapped must be valid', 0 => 'Wrapped must be an integer', 1 => 'Wrapped must be an integer', 2 => 'Wrapped must be an integer', @@ -96,7 +96,7 @@ - Wrapped must not be an integer FULL_MESSAGE, [ - '__root__' => 'Each item in Wrapped must be invalid', + '__root' => 'Each item in Wrapped must be invalid', 0 => 'Wrapped must not be an integer', 1 => 'Wrapped must not be an integer', 2 => 'Wrapped must not be an integer', @@ -113,7 +113,7 @@ - Wrapper must be an integer FULL_MESSAGE, [ - '__root__' => 'Each item in Wrapper must be valid', + '__root' => 'Each item in Wrapper must be valid', 0 => 'Wrapper must be an integer', 1 => 'Wrapper must be an integer', 2 => 'Wrapper must be an integer', @@ -130,7 +130,7 @@ - Wrapper must not be an integer FULL_MESSAGE, [ - '__root__' => 'Each item in Wrapper must be invalid', + '__root' => 'Each item in Wrapper must be invalid', 0 => 'Wrapper must not be an integer', 1 => 'Wrapper must not be an integer', 2 => 'Wrapper must not be an integer', @@ -147,7 +147,7 @@ - Not must not be an integer FULL_MESSAGE, [ - '__root__' => 'Each item in Not must be invalid', + '__root' => 'Each item in Not must be invalid', 0 => 'Not must not be an integer', 1 => 'Not must not be an integer', 2 => 'Not must not be an integer', @@ -191,7 +191,7 @@ fn() => v::each(v::intType()) ->setTemplates([ 'each' => [ - '__root__' => 'Here a sequence of items that did not pass the validation', + '__root' => 'Here a sequence of items that did not pass the validation', 0 => 'First item should have been an integer', 1 => 'Second item should have been an integer', 2 => 'Third item should have been an integer', @@ -206,7 +206,7 @@ - Third item should have been an integer FULL_MESSAGE, [ - '__root__' => 'Here a sequence of items that did not pass the validation', + '__root' => 'Here a sequence of items that did not pass the validation', 0 => 'First item should have been an integer', 1 => 'Second item should have been an integer', 2 => 'Third item should have been an integer', @@ -218,7 +218,7 @@ ->setName('Wrapper') ->setTemplates([ 'Wrapped' => [ - '__root__' => 'Here a sequence of items that did not pass the validation', + '__root' => 'Here a sequence of items that did not pass the validation', 0 => 'First item should have been an integer', 1 => 'Second item should have been an integer', 2 => 'Third item should have been an integer', @@ -233,7 +233,7 @@ - Third item should have been an integer FULL_MESSAGE, [ - '__root__' => 'Here a sequence of items that did not pass the validation', + '__root' => 'Here a sequence of items that did not pass the validation', 0 => 'First item should have been an integer', 1 => 'Second item should have been an integer', 2 => 'Third item should have been an integer', @@ -253,14 +253,14 @@ - 4 must be an odd number FULL_MESSAGE, [ - '__root__' => 'Each item in `[2, 4]` must be valid', + '__root' => 'Each item in `[2, 4]` must be valid', 0 => [ - '__root__' => 'All the required rules must pass for 2', + '__root' => 'All the required rules must pass for 2', 'between' => '2 must be between 5 and 7', 'odd' => '2 must be an odd number', ], 1 => [ - '__root__' => 'All the required rules must pass for 4', + '__root' => 'All the required rules must pass for 4', 'between' => '4 must be between 5 and 7', 'odd' => '4 must be an odd number', ], @@ -281,20 +281,20 @@ - my_int must be present FULL_MESSAGE, [ - '__root__' => 'Each item in `[["not_int": "wrong"], ["my_int": 2], "not an array"]` must be valid', + '__root' => 'Each item in `[["not_int": "wrong"], ["my_int": 2], "not an array"]` must be valid', 0 => [ - '__root__' => 'These rules must pass for `["not_int": "wrong"]`', + '__root' => 'These rules must pass for `["not_int": "wrong"]`', 'my_int' => 'my_int must be present', ], 1 => [ - '__root__' => 'These rules must pass for `["my_int": 2]`', + '__root' => 'These rules must pass for `["my_int": 2]`', 'my_int' => [ - '__root__' => 'These rules must pass for my_int', + '__root' => 'These rules must pass for my_int', 'odd' => 'my_int must be an odd number', ], ], 2 => [ - '__root__' => 'All the required rules must pass for "not an array"', + '__root' => 'All the required rules must pass for "not an array"', 'arrayType' => '"not an array" must be an array', 'my_int' => 'my_int must be present', ], diff --git a/tests/feature/Rules/KeySetTest.php b/tests/feature/Rules/KeySetTest.php index 85b7a8f17..90f16c813 100644 --- a/tests/feature/Rules/KeySetTest.php +++ b/tests/feature/Rules/KeySetTest.php @@ -12,7 +12,7 @@ 'foo must be an integer', '- foo must be an integer', [ - '__root__' => '`["foo": "string"]` validation failed', + '__root' => '`["foo": "string"]` validation failed', 'foo' => 'foo must be an integer', ] )); @@ -22,7 +22,7 @@ 'foo must be present', '- foo must be present', [ - '__root__' => '`[]` contains missing keys', + '__root' => '`[]` contains missing keys', 'foo' => 'foo must be present', ] )); @@ -32,7 +32,7 @@ 'bar must not be present', '- bar must not be present', [ - '__root__' => '`["foo": 42, "bar": "string"]` contains extra keys', + '__root' => '`["foo": 42, "bar": "string"]` contains extra keys', 'bar' => 'bar must not be present', ] )); @@ -46,7 +46,7 @@ - bar must not be present FULL_MESSAGE, [ - '__root__' => '`["bar": true]` contains both missing and extra keys', + '__root' => '`["bar": true]` contains both missing and extra keys', 'foo' => 'foo must be present', 'bar' => 'bar must not be present', ] @@ -61,7 +61,7 @@ - baz must not be present FULL_MESSAGE, [ - '__root__' => '`["foo": 42, "bar": "string", "baz": true]` contains extra keys', + '__root' => '`["foo": 42, "bar": "string", "baz": true]` contains extra keys', 'bar' => 'bar must not be present', 'baz' => 'baz must not be present', ] @@ -99,7 +99,7 @@ - plugh must not be present FULL_MESSAGE, [ - '__root__' => '`["foo": 42, "bar": "string", "baz": true, "qux": false, "quux": 42, ...]` contains extra keys', + '__root' => '`["foo": 42, "bar": "string", "baz": true, "qux": false, "quux": 42, ...]` contains extra keys', 'bar' => 'bar must not be present', 'baz' => 'baz must not be present', 'qux' => 'qux must not be present', @@ -118,7 +118,7 @@ 'bar must be present', '- bar must be present', [ - '__root__' => '`["foo": 42]` contains missing keys', + '__root' => '`["foo": 42]` contains missing keys', 'bar' => 'bar must be present', ] )); @@ -132,7 +132,7 @@ - bar must be present FULL_MESSAGE, [ - '__root__' => '`[]` contains missing keys', + '__root' => '`[]` contains missing keys', 'foo' => 'foo must be present', 'bar' => 'bar must be present', ] @@ -146,7 +146,7 @@ 'baz must not be present', '- baz must not be present', [ - '__root__' => '`["foo": 42, "bar": "string", "baz": true]` contains extra keys', + '__root' => '`["foo": 42, "bar": "string", "baz": true]` contains extra keys', 'baz' => 'baz must not be present', ] )); @@ -163,7 +163,7 @@ - baz must not be present FULL_MESSAGE, [ - '__root__' => '`["bar": "string", "baz": true]` contains both missing and extra keys', + '__root' => '`["bar": "string", "baz": true]` contains both missing and extra keys', 'foo' => 'foo must be present', 'baz' => 'baz must not be present', ] @@ -182,7 +182,7 @@ - baz must not be present FULL_MESSAGE, [ - '__root__' => '`["foo": 42, "bar": "string", "baz": true, "qux": false]` contains extra keys', + '__root' => '`["foo": 42, "bar": "string", "baz": true, "qux": false]` contains extra keys', 'qux' => 'qux must be an integer', 'baz' => 'baz must not be present', ] @@ -202,7 +202,7 @@ - baz must be an integer FULL_MESSAGE, [ - '__root__' => '`["foo": 42, "bar": "string", "baz": true]` validation failed', + '__root' => '`["foo": 42, "bar": "string", "baz": true]` validation failed', 'bar' => 'bar must be an integer', 'baz' => 'baz must be an integer', ] @@ -223,7 +223,7 @@ - baz must be present FULL_MESSAGE, [ - '__root__' => '`["foo": 42, "bar": "string"]` contains missing keys', + '__root' => '`["foo": 42, "bar": "string"]` contains missing keys', 'bar' => 'bar must be an integer', 'baz' => 'baz must be present', ] diff --git a/tests/feature/Rules/LengthTest.php b/tests/feature/Rules/LengthTest.php index 427535e78..8dd190d3c 100644 --- a/tests/feature/Rules/LengthTest.php +++ b/tests/feature/Rules/LengthTest.php @@ -51,7 +51,7 @@ - The length of `[]` must be an odd number FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for `[]`', + '__root' => 'All the required rules must pass for `[]`', 'lengthBetween' => 'The length of `[]` must be between 5 and 7', 'lengthOdd' => 'The length of `[]` must be an odd number', ] diff --git a/tests/feature/Rules/MaxTest.php b/tests/feature/Rules/MaxTest.php index 1906b8064..9e977618f 100644 --- a/tests/feature/Rules/MaxTest.php +++ b/tests/feature/Rules/MaxTest.php @@ -79,7 +79,7 @@ - The maximum of `[1, 2, 3, 4]` must be an odd number FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for `[1, 2, 3, 4]`', + '__root' => 'All the required rules must pass for `[1, 2, 3, 4]`', 'maxBetween' => 'The maximum of `[1, 2, 3, 4]` must be between 5 and 7', 'maxOdd' => 'The maximum of `[1, 2, 3, 4]` must be an odd number', ] diff --git a/tests/feature/Rules/MinTest.php b/tests/feature/Rules/MinTest.php index 9725b787a..4148e6626 100644 --- a/tests/feature/Rules/MinTest.php +++ b/tests/feature/Rules/MinTest.php @@ -44,7 +44,7 @@ - The minimum of `[2, 3, 4]` must be an odd number FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for `[2, 3, 4]`', + '__root' => 'All the required rules must pass for `[2, 3, 4]`', 'minBetween' => 'The minimum of `[2, 3, 4]` must be between 5 and 7', 'minOdd' => 'The minimum of `[2, 3, 4]` must be an odd number', ] diff --git a/tests/feature/Rules/NullOrTest.php b/tests/feature/Rules/NullOrTest.php index 73a199a08..1868f9e26 100644 --- a/tests/feature/Rules/NullOrTest.php +++ b/tests/feature/Rules/NullOrTest.php @@ -86,7 +86,7 @@ - 1234 must be a string or must be null FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for 1234', + '__root' => 'All the required rules must pass for 1234', 'nullOrAlpha' => '1234 must contain only letters (a-z) or must be null', 'nullOrStringType' => '1234 must be a string or must be null', ] @@ -104,7 +104,7 @@ - Should be nul or string type FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for 1234', + '__root' => 'All the required rules must pass for 1234', 'nullOrAlpha' => 'Should be nul or alpha', 'nullOrStringType' => 'Should be nul or string type', ] diff --git a/tests/feature/Rules/PropertyTest.php b/tests/feature/Rules/PropertyTest.php index 8b2cd5f2b..0bf49af7b 100644 --- a/tests/feature/Rules/PropertyTest.php +++ b/tests/feature/Rules/PropertyTest.php @@ -31,7 +31,7 @@ FULL_MESSAGE, [ 'foo' => [ - '__root__' => 'All the required rules must pass for foo', + '__root' => 'All the required rules must pass for foo', 'intType' => 'foo must be an integer', 'positive' => 'foo must be a positive number', ], diff --git a/tests/feature/Rules/SizeTest.php b/tests/feature/Rules/SizeTest.php index 568c05dc5..94527abcf 100644 --- a/tests/feature/Rules/SizeTest.php +++ b/tests/feature/Rules/SizeTest.php @@ -66,7 +66,7 @@ - The size in kilobytes of "vfs://root/2kb.txt" must be an odd number FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for "vfs://root/2kb.txt"', + '__root' => 'All the required rules must pass for "vfs://root/2kb.txt"', 'sizeBetween' => 'The size in kilobytes of "vfs://root/2kb.txt" must be between 5 and 7', 'sizeOdd' => 'The size in kilobytes of "vfs://root/2kb.txt" must be an odd number', ] diff --git a/tests/feature/Rules/UndefOrTest.php b/tests/feature/Rules/UndefOrTest.php index 890aaeab0..97087de40 100644 --- a/tests/feature/Rules/UndefOrTest.php +++ b/tests/feature/Rules/UndefOrTest.php @@ -86,7 +86,7 @@ - 1234 must be a string or must be undefined FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for 1234', + '__root' => 'All the required rules must pass for 1234', 'undefOrAlpha' => '1234 must contain only letters (a-z) or must be undefined', 'undefOrStringType' => '1234 must be a string or must be undefined', ] @@ -104,7 +104,7 @@ - Should be nul or string type FULL_MESSAGE, [ - '__root__' => 'All the required rules must pass for 1234', + '__root' => 'All the required rules must pass for 1234', 'undefOrAlpha' => 'Should be nul or alpha', 'undefOrStringType' => 'Should be nul or string type', ] diff --git a/tests/unit/Message/StandardFormatter/ArrayProvider.php b/tests/unit/Message/StandardFormatter/ArrayProvider.php index 221f40c25..2cc5402d5 100644 --- a/tests/unit/Message/StandardFormatter/ArrayProvider.php +++ b/tests/unit/Message/StandardFormatter/ArrayProvider.php @@ -32,7 +32,7 @@ public static function provideForArray(): array 'with single-level children, without templates' => [ self::singleLevelChildrenMessage(), [ - '__root__' => '__parent_original__', + '__root' => '__parent_original__', '1st' => '__1st_original__', '2nd' => '__2nd_original__', '3rd' => '__3rd_original__', @@ -41,13 +41,13 @@ public static function provideForArray(): array 'with single-level children, with templates' => [ self::singleLevelChildrenMessage(), [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => '2nd custom', '3rd' => '3rd custom', ], [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => '2nd custom', '3rd' => '3rd custom', @@ -56,7 +56,7 @@ public static function provideForArray(): array 'with single-level children, with partial templates' => [ self::singleLevelChildrenMessage(), [ - '__root__' => '__parent_original__', + '__root' => '__parent_original__', '1st' => '1st custom', '2nd' => '__2nd_original__', '3rd' => '3rd custom', @@ -74,10 +74,10 @@ public static function provideForArray(): array 'with single-nested child, without templates' => [ self::multiLevelChildrenWithSingleNestedChildMessage(), [ - '__root__' => '__parent_original__', + '__root' => '__parent_original__', '1st' => '__1st_original__', '2nd' => [ - '__root__' => '__2nd_original__', + '__root' => '__2nd_original__', '2nd_1st' => '__2nd_1st_original__', ], '3rd' => '__3rd_original__', @@ -86,16 +86,16 @@ public static function provideForArray(): array 'with single-nested child, with templates' => [ self::multiLevelChildrenWithSingleNestedChildMessage(), [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => [ - '__root__' => '__2nd_original__', + '__root' => '__2nd_original__', '2nd_1st' => '2nd > 1st custom', ], '3rd' => '3rd custom', ], [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => [ '2nd_1st' => '2nd > 1st custom', @@ -106,16 +106,16 @@ public static function provideForArray(): array 'with single-nested child, with partial templates' => [ self::multiLevelChildrenWithSingleNestedChildMessage(), [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => [ - '__root__' => '__2nd_original__', + '__root' => '__2nd_original__', '2nd_1st' => '__2nd_1st_original__', ], '3rd' => '3rd custom', ], [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => [ '2nd_2nd' => '2nd > 2nd not shown', @@ -126,13 +126,13 @@ public static function provideForArray(): array 'with single-nested child, with overwritten templates' => [ self::multiLevelChildrenWithSingleNestedChildMessage(), [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => '2nd custom', '3rd' => '3rd custom', ], [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => '2nd custom', '3rd' => '3rd custom', @@ -141,10 +141,10 @@ public static function provideForArray(): array 'with multi-nested children, without templates' => [ self::multiLevelChildrenWithMultiNestedChildrenMessage(), [ - '__root__' => '__parent_original__', + '__root' => '__parent_original__', '1st' => '__1st_original__', '2nd' => [ - '__root__' => '__2nd_original__', + '__root' => '__2nd_original__', '2nd_1st' => '__2nd_1st_original__', '2nd_2nd' => '__2nd_2nd_original__', ], @@ -154,20 +154,20 @@ public static function provideForArray(): array 'with multi-nested children, with templates' => [ self::multiLevelChildrenWithMultiNestedChildrenMessage(), [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => [ - '__root__' => '2nd custom', + '__root' => '2nd custom', '2nd_1st' => '2nd > 1st custom', '2nd_2nd' => '2nd > 2nd custom', ], '3rd' => '3rd custom', ], [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => [ - '__root__' => '2nd custom', + '__root' => '2nd custom', '2nd_1st' => '2nd > 1st custom', '2nd_2nd' => '2nd > 2nd custom', ], @@ -177,17 +177,17 @@ public static function provideForArray(): array 'with multi-nested children, with partial templates' => [ self::multiLevelChildrenWithMultiNestedChildrenMessage(), [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => [ - '__root__' => '__2nd_original__', + '__root' => '__2nd_original__', '2nd_1st' => '__2nd_1st_original__', '2nd_2nd' => '2nd > 2nd custom', ], '3rd' => '3rd custom', ], [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => [ '2nd_2nd' => '2nd > 2nd custom', @@ -198,7 +198,7 @@ public static function provideForArray(): array 'with children with the same id, without templates' => [ self::singleLevelChildrenWithSameId(), [ - '__root__' => '__parent_original__', + '__root' => '__parent_original__', 'child.1' => '__1st_original__', 'child.2' => '__2nd_original__', 'child.3' => '__3rd_original__', @@ -207,13 +207,13 @@ public static function provideForArray(): array 'with children with the same id, with templates' => [ self::singleLevelChildrenWithSameId(), [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', 'child.1' => '1st custom', 'child.2' => '2nd custom', 'child.3' => '3rd custom', ], [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', 'child.1' => '1st custom', 'child.2' => '2nd custom', 'child.3' => '3rd custom', @@ -222,7 +222,7 @@ public static function provideForArray(): array 'with children with the same id, with partial templates' => [ self::singleLevelChildrenWithSameId(), [ - '__root__' => '__parent_original__', + '__root' => '__parent_original__', 'child.1' => '1st custom', 'child.2' => '2nd custom', 'child.3' => '__3rd_original__', diff --git a/tests/unit/Message/StandardFormatter/FullProvider.php b/tests/unit/Message/StandardFormatter/FullProvider.php index f92cfc4f5..108459178 100644 --- a/tests/unit/Message/StandardFormatter/FullProvider.php +++ b/tests/unit/Message/StandardFormatter/FullProvider.php @@ -48,7 +48,7 @@ public static function provideForFull(): array FULL_MESSAGE, [ 'parent' => [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => '2nd custom', '3rd' => '3rd custom', @@ -98,10 +98,10 @@ public static function provideForFull(): array FULL_MESSAGE, [ 'parent' => [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => [ - '__root__' => '2nd custom', + '__root' => '2nd custom', '2nd_1st' => '2nd > 1st custom', ], '3rd' => '3rd custom', @@ -119,7 +119,7 @@ public static function provideForFull(): array FULL_MESSAGE, [ 'parent' => [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => [ '2nd_2nd' => '2nd > 2nd not shown', @@ -138,7 +138,7 @@ public static function provideForFull(): array FULL_MESSAGE, [ 'parent' => [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => '2nd custom', '3rd' => '3rd custom', @@ -168,10 +168,10 @@ public static function provideForFull(): array FULL_MESSAGE, [ 'parent' => [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => [ - '__root__' => '2nd custom', + '__root' => '2nd custom', '2nd_1st' => '2nd > 1st custom', '2nd_2nd' => '2nd > 2nd custom', ], @@ -191,7 +191,7 @@ public static function provideForFull(): array FULL_MESSAGE, [ 'parent' => [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => [ '2nd_2nd' => '2nd > 2nd custom', @@ -210,7 +210,7 @@ public static function provideForFull(): array FULL_MESSAGE, [ 'parent' => [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => '2nd custom', '3rd' => '3rd custom', @@ -236,7 +236,7 @@ public static function provideForFull(): array FULL_MESSAGE, [ 'parent' => [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', 'child.1' => '1st custom', 'child.2' => '2nd custom', 'child.3' => '3rd custom', @@ -280,7 +280,7 @@ public static function provideForFull(): array 'parent' => [ '1st' => '1st custom', '2nd' => [ - '__root__' => '2nd custom', + '__root' => '2nd custom', '2nd_1st' => '2nd > 1st custom', ], ], diff --git a/tests/unit/Message/StandardFormatter/MainProvider.php b/tests/unit/Message/StandardFormatter/MainProvider.php index 1ed52d442..e0218661d 100644 --- a/tests/unit/Message/StandardFormatter/MainProvider.php +++ b/tests/unit/Message/StandardFormatter/MainProvider.php @@ -49,7 +49,7 @@ public static function provideForMain(): array ->build(), 'Parent custom', [ - '__root__' => 'Parent custom', + '__root' => 'Parent custom', '1st' => '1st custom', '2nd' => '2nd custom', ], diff --git a/tests/unit/ValidatorTest.php b/tests/unit/ValidatorTest.php index 3833c2d74..828a79fb6 100644 --- a/tests/unit/ValidatorTest.php +++ b/tests/unit/ValidatorTest.php @@ -142,12 +142,12 @@ public function itShouldAssertUsingTheGivingArrayTemplateWithTheRuleNameAsKey(): #[Test] public function itShouldAssertUsingTheGivingArrayTemplateWithRootKey(): void { - $template = ['__root__' => 'This is my new template']; + $template = ['__root' => 'This is my new template']; - $this->expectExceptionMessage($template['__root__']); + $this->expectExceptionMessage($template['__root']); $validator = Validator::create(Stub::fail(1)); - $validator->setTemplates(['__root__' => 'This is my pre-defined template']); + $validator->setTemplates(['__root' => 'This is my pre-defined template']); $validator->assert('whatever', $template); } @@ -173,7 +173,7 @@ public static function providerForTemplates(): array return [ 'string' => ['This is my new template'], 'array key named key' => [['stub' => 'This is my new template']], - 'array key __root__ key' => [['__root__' => 'This is my new template']], + 'array key __root key' => [['__root' => 'This is my new template']], ]; } }