diff --git a/tests/feature/AssertWithKeysTest.php b/tests/feature/AssertWithKeysTest.php index a1d58afe9..e1705c7a2 100644 --- a/tests/feature/AssertWithKeysTest.php +++ b/tests/feature/AssertWithKeysTest.php @@ -15,7 +15,7 @@ ->key('host', v::stringType()) ->key('user', v::stringType()) ->key('password', v::stringType()) - ->key('schema', v::stringType()) + ->key('schema', v::stringType()), ) ->key( 'postgresql', @@ -23,7 +23,7 @@ ->key('host', v::stringType()) ->key('user', v::stringType()) ->key('password', v::stringType()) - ->key('schema', v::stringType()) + ->key('schema', v::stringType()), ) ->setName('the given data') ->assert([ diff --git a/tests/feature/AssertWithPropertiesTest.php b/tests/feature/AssertWithPropertiesTest.php index 71501bc15..8e953d626 100644 --- a/tests/feature/AssertWithPropertiesTest.php +++ b/tests/feature/AssertWithPropertiesTest.php @@ -31,7 +31,7 @@ function (): void { ->property('host', v::stringType()) ->property('user', v::stringType()) ->property('password', v::stringType()) - ->property('schema', v::stringType()) + ->property('schema', v::stringType()), ) ->property( 'postgresql', @@ -39,7 +39,7 @@ function (): void { ->property('host', v::stringType()) ->property('user', v::stringType()) ->property('password', v::stringType()) - ->property('schema', v::stringType()) + ->property('schema', v::stringType()), ) ->setName('the given data') ->assert($object); diff --git a/tests/feature/AssertWithTemplatesTest.php b/tests/feature/AssertWithTemplatesTest.php index bcee28e13..dede37d60 100644 --- a/tests/feature/AssertWithTemplatesTest.php +++ b/tests/feature/AssertWithTemplatesTest.php @@ -11,26 +11,26 @@ fn() => v::alwaysInvalid()->setTemplate('My string template in the chain')->assert(1), 'My string template in the chain', '- My string template in the chain', - ['alwaysInvalid' => 'My string template in the chain'] + ['alwaysInvalid' => 'My string template in the chain'], )); test('Template as an array in the chain', expectAll( fn() => v::alwaysInvalid()->setTemplates(['alwaysInvalid' => 'My array template in the chain'])->assert(1), 'My array template in the chain', '- My array template in the chain', - ['alwaysInvalid' => 'My array template in the chain'] + ['alwaysInvalid' => 'My array template in the chain'], )); test('Runtime template as string', expectAll( fn() => v::alwaysInvalid()->assert(1, 'My runtime template as string'), 'My runtime template as string', '- My runtime template as string', - ['alwaysInvalid' => 'My runtime template as string'] + ['alwaysInvalid' => 'My runtime template as string'], )); test('Runtime template as an array', expectAll( fn() => v::alwaysInvalid()->assert(1, ['alwaysInvalid' => 'My runtime template an array']), 'My runtime template an array', '- My runtime template an array', - ['alwaysInvalid' => 'My runtime template an array'] + ['alwaysInvalid' => 'My runtime template an array'], )); diff --git a/tests/feature/GetMessagesWithReplacementsTest.php b/tests/feature/GetMessagesWithReplacementsTest.php index b2c2c717f..c44d8ce5b 100644 --- a/tests/feature/GetMessagesWithReplacementsTest.php +++ b/tests/feature/GetMessagesWithReplacementsTest.php @@ -16,7 +16,7 @@ function (): void { ->key('host', v::stringType()) ->key('user', v::stringType()) ->key('password', v::stringType()) - ->key('schema', v::stringType()) + ->key('schema', v::stringType()), ) ->key( 'postgresql', @@ -24,7 +24,7 @@ function (): void { ->key('host', v::stringType()) ->key('user', v::stringType()) ->key('password', v::stringType()) - ->key('schema', v::stringType()) + ->key('schema', v::stringType()), ) ->assert( [ @@ -45,7 +45,7 @@ function (): void { 'postgresql' => [ 'schema' => 'You must provide a valid PostgreSQL schema', ], - ] + ], ); }, [ diff --git a/tests/feature/Issues/Issue1033Test.php b/tests/feature/Issues/Issue1033Test.php index 246c30cc1..3eecc2732 100644 --- a/tests/feature/Issues/Issue1033Test.php +++ b/tests/feature/Issues/Issue1033Test.php @@ -21,5 +21,5 @@ 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/Issue1244Test.php b/tests/feature/Issues/Issue1244Test.php index a4744004c..a5f3001bb 100644 --- a/tests/feature/Issues/Issue1244Test.php +++ b/tests/feature/Issues/Issue1244Test.php @@ -11,5 +11,5 @@ fn() => v::key('firstname', v::notBlank()->setName('First Name'))->assert([]), 'First Name must be present', '- First Name must be present', - ['firstname' => 'First Name must be present'] + ['firstname' => 'First Name must be present'], )); diff --git a/tests/feature/Issues/Issue1289Test.php b/tests/feature/Issues/Issue1289Test.php index aa0babbdc..ad8e9aae4 100644 --- a/tests/feature/Issues/Issue1289Test.php +++ b/tests/feature/Issues/Issue1289Test.php @@ -24,8 +24,8 @@ 'default', new OneOf( new StringType(), - new BoolType() - ) + new BoolType(), + ), ), new KeyOptional( 'description', @@ -34,9 +34,9 @@ new KeyOptional( 'children', new ArrayType(), - ) - ) - ) + ), + ), + ), ) ->assert([ [ @@ -63,5 +63,5 @@ ], 'description' => 'description must be a string value', ], - ] + ], )); diff --git a/tests/feature/Issues/Issue1333Test.php b/tests/feature/Issues/Issue1333Test.php index af3f45e63..ea391ddbd 100644 --- a/tests/feature/Issues/Issue1333Test.php +++ b/tests/feature/Issues/Issue1333Test.php @@ -19,5 +19,5 @@ '__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 d61f2933a..a37e4e3eb 100644 --- a/tests/feature/Issues/Issue1334Test.php +++ b/tests/feature/Issues/Issue1334Test.php @@ -13,13 +13,13 @@ function (): void { v::key('street', v::stringType()->notEmpty()) ->key('region', v::stringType()->notEmpty()) ->key('country', v::stringType()->notEmpty()) - ->keyOptional('other', v::nullOr(v::notEmpty()->stringType())) + ->keyOptional('other', v::nullOr(v::notEmpty()->stringType())), )->assert( [ ['region' => 'Oregon', 'country' => 'USA', 'other' => 123], ['street' => '', 'region' => 'Oregon', 'country' => 'USA'], ['street' => 123, 'region' => 'Oregon', 'country' => 'USA'], - ] + ], ); }, 'street must be present', @@ -45,5 +45,5 @@ function (): void { 1 => 'street must not be empty', 2 => 'street must be a string', ], - ] + ], )); diff --git a/tests/feature/Issues/Issue1348Test.php b/tests/feature/Issues/Issue1348Test.php index ced0cef7a..ef8219496 100644 --- a/tests/feature/Issues/Issue1348Test.php +++ b/tests/feature/Issues/Issue1348Test.php @@ -21,8 +21,8 @@ v::oneOf( v::key('manufacturer', v::equals('Honda'))->key('model', v::in(['Accord', 'Fit'])), v::key('manufacturer', v::equals('Toyota'))->key('model', v::in(['Rav4', 'Camry'])), - v::key('manufacturer', v::equals('Ford'))->key('model', Validator::in(['F150', 'Bronco'])) - ) + v::key('manufacturer', v::equals('Ford'))->key('model', Validator::in(['F150', 'Bronco'])), + ), )->assert($cars), 'manufacturer must be equal to "Honda"', <<<'FULL_MESSAGE' @@ -78,5 +78,5 @@ ], ], ], - ] + ], )); diff --git a/tests/feature/Issues/Issue1376Test.php b/tests/feature/Issues/Issue1376Test.php index d9bda8334..3f1bb038f 100644 --- a/tests/feature/Issues/Issue1376Test.php +++ b/tests/feature/Issues/Issue1376Test.php @@ -34,5 +34,5 @@ 'lengthBetween' => 'The length of author must be between 1 and 2', ], 'user' => 'user must be present', - ] + ], )); diff --git a/tests/feature/Issues/Issue1469Test.php b/tests/feature/Issues/Issue1469Test.php index b3756a809..6a07b2abd 100644 --- a/tests/feature/Issues/Issue1469Test.php +++ b/tests/feature/Issues/Issue1469Test.php @@ -49,5 +49,5 @@ function (): void { 'product_title2' => 'product_title2 must not be present', ], ], - ] + ], )); diff --git a/tests/feature/Issues/Issue1477Test.php b/tests/feature/Issues/Issue1477Test.php index fe8c09df1..8a226aa63 100644 --- a/tests/feature/Issues/Issue1477Test.php +++ b/tests/feature/Issues/Issue1477Test.php @@ -18,10 +18,10 @@ protected function isValid(mixed $input): bool { return false; } - })->setTemplate('{{name}} is not good!') + })->setTemplate('{{name}} is not good!'), )->assert(['Address' => 'cvejvn']); }, 'Address is not good!', '- Address is not good!', - ['Address' => 'Address is not good!'] + ['Address' => 'Address is not good!'], )); diff --git a/tests/feature/Issues/Issue179Test.php b/tests/feature/Issues/Issue179Test.php index e4d3fa4cc..ac47a6526 100644 --- a/tests/feature/Issues/Issue179Test.php +++ b/tests/feature/Issues/Issue179Test.php @@ -33,5 +33,5 @@ function (): void { '__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 096026b17..75813b832 100644 --- a/tests/feature/Issues/Issue425Test.php +++ b/tests/feature/Issues/Issue425Test.php @@ -16,5 +16,5 @@ function (): void { }, 'reference must be present', '- reference must be present', - ['reference' => 'reference must be present'] + ['reference' => 'reference must be present'], )); diff --git a/tests/feature/Issues/Issue446Test.php b/tests/feature/Issues/Issue446Test.php index c99c54691..151a54a68 100644 --- a/tests/feature/Issues/Issue446Test.php +++ b/tests/feature/Issues/Issue446Test.php @@ -19,5 +19,5 @@ ->assert($arr), 'The length of name must be between 2 and 32', '- The length of name must be between 2 and 32', - ['name' => 'The length of name must be between 2 and 32'] + ['name' => 'The length of name must be between 2 and 32'], )); diff --git a/tests/feature/Issues/Issue619Test.php b/tests/feature/Issues/Issue619Test.php index 375ae73f0..0355c22e9 100644 --- a/tests/feature/Issues/Issue619Test.php +++ b/tests/feature/Issues/Issue619Test.php @@ -11,5 +11,5 @@ fn() => v::instance(stdClass::class)->setTemplate('invalid object')->assert('test'), 'invalid object', '- invalid object', - ['instance' => 'invalid object'] + ['instance' => 'invalid object'], )); diff --git a/tests/feature/Issues/Issue739Test.php b/tests/feature/Issues/Issue739Test.php index 65204a56b..e9da6c109 100644 --- a/tests/feature/Issues/Issue739Test.php +++ b/tests/feature/Issues/Issue739Test.php @@ -11,5 +11,5 @@ fn() => v::when(v::alwaysInvalid(), v::alwaysValid())->assert('foo'), '"foo" is invalid', '- "foo" is invalid', - ['alwaysInvalid' => '"foo" is invalid'] + ['alwaysInvalid' => '"foo" is invalid'], )); diff --git a/tests/feature/Issues/Issue796Test.php b/tests/feature/Issues/Issue796Test.php index 24519b018..66d2c7492 100644 --- a/tests/feature/Issues/Issue796Test.php +++ b/tests/feature/Issues/Issue796Test.php @@ -8,14 +8,14 @@ declare(strict_types=1); test('https://github.com/Respect/Validation/issues/796', expectAll( - fn () => v::create() + fn() => v::create() ->key( 'mysql', v::create() ->key('host', v::stringType()) ->key('user', v::stringType()) ->key('password', v::stringType()) - ->key('schema', v::stringType()) + ->key('schema', v::stringType()), ) ->key( 'postgresql', @@ -23,7 +23,7 @@ ->key('host', v::stringType()) ->key('user', v::stringType()) ->key('password', v::stringType()) - ->key('schema', v::stringType()) + ->key('schema', v::stringType()), ) ->setName('the given data') ->assert([ @@ -52,5 +52,5 @@ '__root__' => 'All the required rules must pass for the given data', 'mysql' => 'host must be a string', 'postgresql' => 'user must be a string', - ] + ], )); diff --git a/tests/feature/Issues/Issue799Test.php b/tests/feature/Issues/Issue799Test.php index e93c76dbb..e428e486c 100644 --- a/tests/feature/Issues/Issue799Test.php +++ b/tests/feature/Issues/Issue799Test.php @@ -15,7 +15,7 @@ fn() => v::create() ->call( [new CountableStub(1), 'count'], - v::arrayVal()->key('scheme', v::startsWith('https')) + v::arrayVal()->key('scheme', v::startsWith('https')), ) ->assert($input), '1 must be an array value', @@ -28,19 +28,17 @@ '__root__' => 'All the required rules must pass for 1', 'arrayVal' => '1 must be an array value', 'scheme' => 'scheme must be present', - ] + ], )); test('https://github.com/Respect/Validation/issues/799 | #2', expectAll( fn() => v::create() ->call( - function ($url) { - return parse_url($url); - }, - v::arrayVal()->key('scheme', v::startsWith('https')) + fn ($url) => parse_url($url), + v::arrayVal()->key('scheme', v::startsWith('https')), ) ->assert($input), 'scheme must start with "https"', '- scheme must start with "https"', - ['scheme' => 'scheme must start with "https"'] + ['scheme' => 'scheme must start with "https"'], )); diff --git a/tests/feature/Issues/Issue805Test.php b/tests/feature/Issues/Issue805Test.php index be708c0b2..3efb1bba0 100644 --- a/tests/feature/Issues/Issue805Test.php +++ b/tests/feature/Issues/Issue805Test.php @@ -11,5 +11,5 @@ fn() => v::key('email', v::email()->setTemplate('WRONG EMAIL!!!!!!'))->assert(['email' => 'qwe']), 'WRONG EMAIL!!!!!!', '- WRONG EMAIL!!!!!!', - ['email' => 'WRONG EMAIL!!!!!!'] + ['email' => 'WRONG EMAIL!!!!!!'], )); diff --git a/tests/feature/KeysAsValidatorNamesTest.php b/tests/feature/KeysAsValidatorNamesTest.php index e03a4395f..2bbe86612 100644 --- a/tests/feature/KeysAsValidatorNamesTest.php +++ b/tests/feature/KeysAsValidatorNamesTest.php @@ -9,7 +9,6 @@ date_default_timezone_set('UTC'); - use Respect\Validation\Validator; test('Scenario #1', expectFullMessage( diff --git a/tests/feature/NotShouldWorkWithBuilderTestTest.php b/tests/feature/NotShouldWorkWithBuilderTestTest.php index f694d5e16..4f34fc03f 100644 --- a/tests/feature/NotShouldWorkWithBuilderTestTest.php +++ b/tests/feature/NotShouldWorkWithBuilderTestTest.php @@ -9,5 +9,5 @@ test( 'not() should work by builder', - fn() => expect(v::not(v::intVal())->isValid(10))->toBeFalse() + fn() => expect(v::not(v::intVal())->isValid(10))->toBeFalse(), ); diff --git a/tests/feature/NotWithRecursionTest.php b/tests/feature/NotWithRecursionTest.php index 2f4f549d3..c7dcfc6fb 100644 --- a/tests/feature/NotWithRecursionTest.php +++ b/tests/feature/NotWithRecursionTest.php @@ -13,11 +13,11 @@ v::not( v::not( v::not( - v::intVal()->positive() - ) - ) - ) - ) + v::intVal()->positive(), + ), + ), + ), + ), )->assert(2), '2 must not be an integer value', )); @@ -28,11 +28,11 @@ v::not( v::not( v::not( - v::intVal()->positive() - ) - ) - ) - ) + v::intVal()->positive(), + ), + ), + ), + ), )->assert(2), <<<'FULL_MESSAGE' - These rules must not pass for 2 diff --git a/tests/feature/Rules/AllOfTest.php b/tests/feature/Rules/AllOfTest.php index 32e364660..aa0f3c7d7 100644 --- a/tests/feature/Rules/AllOfTest.php +++ b/tests/feature/Rules/AllOfTest.php @@ -19,7 +19,7 @@ '__root__' => 'All the required rules must pass for "2"', 'intType' => '"2" must be an integer', 'negative' => '"2" must be a negative number', - ] + ], )); test('Wrapped by "not"', expectAll( @@ -34,21 +34,21 @@ '__root__' => 'These rules must not pass for 3', 'intType' => '3 must not be an integer', 'positive' => '3 must not be a positive number', - ] + ], )); test('Wrapping "not"', expectAll( fn() => v::allOf(v::not(v::intType()), v::greaterThan(2))->assert(4), '4 must not be an integer', '- 4 must not be an integer', - ['notIntType' => '4 must not be an integer'] + ['notIntType' => '4 must not be an integer'], )); test('With a single template', expectAll( fn() => v::allOf(v::stringType(), v::arrayType())->assert(5, 'This is a single template'), 'This is a single template', '- This is a single template', - ['allOf' => 'This is a single template'] + ['allOf' => 'This is a single template'], )); test('With multiple templates', expectAll( @@ -67,5 +67,5 @@ '__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 e853b66a3..2da23495c 100644 --- a/tests/feature/Rules/AttributesTest.php +++ b/tests/feature/Rules/AttributesTest.php @@ -13,28 +13,28 @@ fn() => v::attributes()->assert(new WithAttributes('', 'john.doe@gmail.com', '2024-06-23')), 'name must not be empty', '- name must not be empty', - ['name' => 'name must not be empty'] + ['name' => 'name must not be empty'], )); test('Inverted', expectAll( fn() => v::attributes()->assert(new WithAttributes('John Doe', 'john.doe@gmail.com', '2024-06-23', '+1234567890')), 'phone must be a valid telephone number or must be null', '- phone must be a valid telephone number or must be null', - ['phone' => 'phone must be a valid telephone number or must be null'] + ['phone' => 'phone must be a valid telephone number or must be null'], )); test('Not an object', expectAll( fn() => v::attributes()->assert([]), '`[]` must be an object', '- `[]` must be an object', - ['attributes' => '`[]` must be an object'] + ['attributes' => '`[]` must be an object'], )); test('Nullable', expectAll( fn() => v::attributes()->assert(new WithAttributes('John Doe', 'john.doe@gmail.com', '2024-06-23', 'not a phone number')), 'phone must be a valid telephone number or must be null', '- phone must be a valid telephone number or must be null', - ['phone' => 'phone must be a valid telephone number or must be null'] + ['phone' => 'phone must be a valid telephone number or must be null'], )); test('Multiple attributes, all failed', expectAll( @@ -59,12 +59,12 @@ 'dateTimeDiffLessThanOrEqual' => 'For comparison with now, birthdate must be a valid datetime', ], 'phone' => 'phone must be a valid telephone number or must be null', - ] + ], )); test('Multiple attributes, one failed', expectAll( fn() => v::attributes()->assert(new WithAttributes('John Doe', 'john.doe@gmail.com', '22 years ago')), 'birthdate must be a valid date in the format "2005-12-30"', '- birthdate must be a valid date in the format "2005-12-30"', - ['birthdate' => 'birthdate must be a valid date in the format "2005-12-30"'] + ['birthdate' => 'birthdate must be a valid date in the format "2005-12-30"'], )); diff --git a/tests/feature/Rules/BetweenExclusiveTest.php b/tests/feature/Rules/BetweenExclusiveTest.php index bd7d9a3fe..ca05b0b4d 100644 --- a/tests/feature/Rules/BetweenExclusiveTest.php +++ b/tests/feature/Rules/BetweenExclusiveTest.php @@ -11,26 +11,26 @@ fn() => v::betweenExclusive(1, 10)->assert(12), '12 must be greater than 1 and less than 10', '- 12 must be greater than 1 and less than 10', - ['betweenExclusive' => '12 must be greater than 1 and less than 10'] + ['betweenExclusive' => '12 must be greater than 1 and less than 10'], )); test('Inverted', expectAll( fn() => v::not(v::betweenExclusive(1, 10))->assert(5), '5 must not be greater than 1 or less than 10', '- 5 must not be greater than 1 or less than 10', - ['notBetweenExclusive' => '5 must not be greater than 1 or less than 10'] + ['notBetweenExclusive' => '5 must not be greater than 1 or less than 10'], )); test('With template', expectAll( fn() => v::betweenExclusive(1, 10)->setTemplate('Bewildered bees buzzed between blooming begonias')->assert(12), 'Bewildered bees buzzed between blooming begonias', '- Bewildered bees buzzed between blooming begonias', - ['betweenExclusive' => 'Bewildered bees buzzed between blooming begonias'] + ['betweenExclusive' => 'Bewildered bees buzzed between blooming begonias'], )); test('With name', expectAll( fn() => v::betweenExclusive(1, 10)->setName('Range')->assert(10), 'Range must be greater than 1 and less than 10', '- Range must be greater than 1 and less than 10', - ['betweenExclusive' => 'Range must be greater than 1 and less than 10'] + ['betweenExclusive' => 'Range must be greater than 1 and less than 10'], )); diff --git a/tests/feature/Rules/CallableTypeTest.php b/tests/feature/Rules/CallableTypeTest.php index 617a029a3..aab63828d 100644 --- a/tests/feature/Rules/CallableTypeTest.php +++ b/tests/feature/Rules/CallableTypeTest.php @@ -24,7 +24,7 @@ test('Scenario #4', expectFullMessage( fn() => v::not(v::callableType())->assert(function (): void { - // Do nothing + // Do nothing }), '- `function (): void` must not be a callable', )); diff --git a/tests/feature/Rules/CircuitTest.php b/tests/feature/Rules/CircuitTest.php index b0b92e8c3..31a0779e4 100644 --- a/tests/feature/Rules/CircuitTest.php +++ b/tests/feature/Rules/CircuitTest.php @@ -11,56 +11,56 @@ fn() => v::circuit(v::alwaysValid(), v::trueVal())->assert(false), '`false` must evaluate to `true`', '- `false` must evaluate to `true`', - ['trueVal' => '`false` must evaluate to `true`'] + ['trueVal' => '`false` must evaluate to `true`'], )); test('Inverted', expectAll( fn() => v::not(v::circuit(v::alwaysValid(), v::trueVal()))->assert(true), '`true` must not evaluate to `true`', '- `true` must not evaluate to `true`', - ['notTrueVal' => '`true` must not evaluate to `true`'] + ['notTrueVal' => '`true` must not evaluate to `true`'], )); test('Default with inverted failing rule', expectAll( fn() => v::circuit(v::alwaysValid(), v::not(v::trueVal()))->assert(true), '`true` must not evaluate to `true`', '- `true` must not evaluate to `true`', - ['notTrueVal' => '`true` must not evaluate to `true`'] + ['notTrueVal' => '`true` must not evaluate to `true`'], )); test('With wrapped name, default', expectAll( fn() => v::circuit(v::alwaysValid(), v::trueVal()->setName('Wrapped'))->setName('Wrapper')->assert(false), 'Wrapped must evaluate to `true`', '- Wrapped must evaluate to `true`', - ['trueVal' => 'Wrapped must evaluate to `true`'] + ['trueVal' => 'Wrapped must evaluate to `true`'], )); test('With wrapper name, default', expectAll( fn() => v::circuit(v::alwaysValid(), v::trueVal())->setName('Wrapper')->assert(false), 'Wrapper must evaluate to `true`', '- Wrapper must evaluate to `true`', - ['trueVal' => 'Wrapper must evaluate to `true`'] + ['trueVal' => 'Wrapper must evaluate to `true`'], )); test('With the name set in the wrapped rule of an inverted failing rule', expectAll( fn() => v::circuit(v::alwaysValid(), v::not(v::trueVal()->setName('Wrapped'))->setName('Not'))->setName('Wrapper')->assert(true), 'Wrapped must not evaluate to `true`', '- Wrapped must not evaluate to `true`', - ['notTrueVal' => 'Wrapped must not evaluate to `true`'] + ['notTrueVal' => 'Wrapped must not evaluate to `true`'], )); test('With the name set in an inverted failing rule', expectAll( fn() => v::circuit(v::alwaysValid(), v::not(v::trueVal())->setName('Not'))->setName('Wrapper')->assert(true), 'Not must not evaluate to `true`', '- Not must not evaluate to `true`', - ['notTrueVal' => 'Not must not evaluate to `true`'] + ['notTrueVal' => 'Not must not evaluate to `true`'], )); test('With the name set in the "circuit" that has an inverted failing rule', expectAll( fn() => v::circuit(v::alwaysValid(), v::not(v::trueVal()))->setName('Wrapper')->assert(true), 'Wrapper must not evaluate to `true`', '- Wrapper must not evaluate to `true`', - ['notTrueVal' => 'Wrapper must not evaluate to `true`'] + ['notTrueVal' => 'Wrapper must not evaluate to `true`'], )); test('With template', expectAll( @@ -69,7 +69,7 @@ ->assert(false), 'Circuit cool cats cunningly continuous cookies', '- Circuit cool cats cunningly continuous cookies', - ['trueVal' => 'Circuit cool cats cunningly continuous cookies'] + ['trueVal' => 'Circuit cool cats cunningly continuous cookies'], )); test('With multiple templates', expectAll( @@ -78,15 +78,15 @@ ->assert(false), 'Clever clowns craft circuit clever clocks', '- Clever clowns craft circuit clever clocks', - ['trueVal' => 'Clever clowns craft circuit clever clocks'] + ['trueVal' => 'Clever clowns craft circuit clever clocks'], )); test('Real example', expectAll( fn() => v::circuit( v::key('countyCode', v::countryCode()), - v::lazy(fn($input) => v::key('subdivisionCode', v::subdivisionCode($input['countyCode']))) + v::lazy(fn ($input) => v::key('subdivisionCode', v::subdivisionCode($input['countyCode']))), )->assert(['countyCode' => 'BR', 'subdivisionCode' => 'CA']), 'subdivisionCode must be a subdivision code of Brazil', '- subdivisionCode must be a subdivision code of Brazil', - ['subdivisionCode' => 'subdivisionCode must be a subdivision code of Brazil'] + ['subdivisionCode' => 'subdivisionCode must be a subdivision code of Brazil'], )); diff --git a/tests/feature/Rules/DateTimeDiffTest.php b/tests/feature/Rules/DateTimeDiffTest.php index d59fe358b..326406ffc 100644 --- a/tests/feature/Rules/DateTimeDiffTest.php +++ b/tests/feature/Rules/DateTimeDiffTest.php @@ -11,105 +11,105 @@ fn() => v::dateTimeDiff('years', v::equals(2))->assert('1 year ago'), 'The number of years between now and "1 year ago" must be equal to 2', '- The number of years between now and "1 year ago" must be equal to 2', - ['dateTimeDiffEquals' => 'The number of years between now and "1 year ago" must be equal to 2'] + ['dateTimeDiffEquals' => 'The number of years between now and "1 year ago" must be equal to 2'], )); test('With $type = "months"', expectAll( fn() => v::dateTimeDiff('months', v::equals(3))->assert('2 months ago'), 'The number of months between now and "2 months ago" must be equal to 3', '- The number of months between now and "2 months ago" must be equal to 3', - ['dateTimeDiffEquals' => 'The number of months between now and "2 months ago" must be equal to 3'] + ['dateTimeDiffEquals' => 'The number of months between now and "2 months ago" must be equal to 3'], )); test('With $type = "days"', expectAll( fn() => v::dateTimeDiff('days', v::equals(4))->assert('3 days ago'), 'The number of days between now and "3 days ago" must be equal to 4', '- The number of days between now and "3 days ago" must be equal to 4', - ['dateTimeDiffEquals' => 'The number of days between now and "3 days ago" must be equal to 4'] + ['dateTimeDiffEquals' => 'The number of days between now and "3 days ago" must be equal to 4'], )); test('With $type = "hours"', expectAll( fn() => v::dateTimeDiff('hours', v::equals(5))->assert('4 hours ago'), 'The number of hours between now and "4 hours ago" must be equal to 5', '- The number of hours between now and "4 hours ago" must be equal to 5', - ['dateTimeDiffEquals' => 'The number of hours between now and "4 hours ago" must be equal to 5'] + ['dateTimeDiffEquals' => 'The number of hours between now and "4 hours ago" must be equal to 5'], )); test('With $type = "minutes"', expectAll( fn() => v::dateTimeDiff('minutes', v::equals(6))->assert('5 minutes ago'), 'The number of minutes between now and "5 minutes ago" must be equal to 6', '- The number of minutes between now and "5 minutes ago" must be equal to 6', - ['dateTimeDiffEquals' => 'The number of minutes between now and "5 minutes ago" must be equal to 6'] + ['dateTimeDiffEquals' => 'The number of minutes between now and "5 minutes ago" must be equal to 6'], )); test('With $type = "microseconds"', expectAll( fn() => v::dateTimeDiff('microseconds', v::equals(7))->assert('6 microseconds ago'), 'The number of microseconds between now and "6 microseconds ago" must be equal to 7', '- The number of microseconds between now and "6 microseconds ago" must be equal to 7', - ['dateTimeDiffEquals' => 'The number of microseconds between now and "6 microseconds ago" must be equal to 7'] + ['dateTimeDiffEquals' => 'The number of microseconds between now and "6 microseconds ago" must be equal to 7'], )); test('With custom $format', expectAllToMatch( fn() => v::dateTimeDiff('years', v::lessThan(8), 'd/m/Y')->assert('09/12/1988'), 'The number of years between "%d/%d/%d" and "09/12/1988" must be less than 8', '- The number of years between "%d/%d/%d" and "09/12/1988" must be less than 8', - ['dateTimeDiffLessThan' => 'The number of years between "%d/%d/%d" and "09/12/1988" must be less than 8'] + ['dateTimeDiffLessThan' => 'The number of years between "%d/%d/%d" and "09/12/1988" must be less than 8'], )); test('With input in non-parseable date', expectAll( fn() => v::dateTimeDiff('years', v::equals(2))->assert('not a date'), 'For comparison with now, "not a date" must be a valid datetime', '- For comparison with now, "not a date" must be a valid datetime', - ['dateTimeDiffEquals' => 'For comparison with now, "not a date" must be a valid datetime'] + ['dateTimeDiffEquals' => 'For comparison with now, "not a date" must be a valid datetime'], )); test('With input in incorrect $format', expectAllToMatch( fn() => v::dateTimeDiff('years', v::equals(2), 'Y-m-d')->assert('1 year ago'), 'For comparison with %d-%d-%d, "1 year ago" must be a valid datetime in the format %d-%d-%d', '- For comparison with %d-%d-%d, "1 year ago" must be a valid datetime in the format %d-%d-%d', - ['dateTimeDiffEquals' => 'For comparison with %d-%d-%d, "1 year ago" must be a valid datetime in the format %d-%d-%d'] + ['dateTimeDiffEquals' => 'For comparison with %d-%d-%d, "1 year ago" must be a valid datetime in the format %d-%d-%d'], )); test('With custom $now', expectAllToMatch( fn() => v::dateTimeDiff('years', v::lessThan(9), null, new DateTimeImmutable())->assert('09/12/1988'), 'The number of years between "%d-%d-%d %d:%d:%d.%d" and "09/12/1988" must be less than 9', '- The number of years between "%d-%d-%d %d:%d:%d.%d" and "09/12/1988" must be less than 9', - ['dateTimeDiffLessThan' => 'The number of years between "%d-%d-%d %d:%d:%d.%d" and "09/12/1988" must be less than 9'] + ['dateTimeDiffLessThan' => 'The number of years between "%d-%d-%d %d:%d:%d.%d" and "09/12/1988" must be less than 9'], )); test('With custom template', expectAll( fn() => v::dateTimeDiff('years', v::equals(2)->setTemplate('Custom template'))->assert('1 year ago'), 'Custom template', '- Custom template', - ['equals' => 'Custom template'] + ['equals' => 'Custom template'], )); test('Wrapped by "not"', expectAll( fn() => v::not(v::dateTimeDiff('years', v::lessThan(8)))->assert('7 year ago'), 'The number of years between now and "7 year ago" must not be less than 8', '- The number of years between now and "7 year ago" must not be less than 8', - ['notDateTimeDiffLessThan' => 'The number of years between now and "7 year ago" must not be less than 8'] + ['notDateTimeDiffLessThan' => 'The number of years between now and "7 year ago" must not be less than 8'], )); test('Wrapping "not"', expectAll( fn() => v::dateTimeDiff('years', v::not(v::lessThan(9)))->assert('8 year ago'), 'The number of years between now and "8 year ago" must not be less than 9', '- The number of years between now and "8 year ago" must not be less than 9', - ['dateTimeDiffNotLessThan' => 'The number of years between now and "8 year ago" must not be less than 9'] + ['dateTimeDiffNotLessThan' => 'The number of years between now and "8 year ago" must not be less than 9'], )); test('Wrapped with custom template', expectAll( fn() => v::dateTimeDiff('years', v::equals(2)->setTemplate('Wrapped with custom template'))->assert('1 year ago'), 'Wrapped with custom template', '- Wrapped with custom template', - ['equals' => 'Wrapped with custom template'] + ['equals' => 'Wrapped with custom template'], )); test('Wrapper with custom template', expectAll( fn() => v::dateTimeDiff('years', v::equals(2))->setTemplate('Wrapper with custom template')->assert('1 year ago'), 'Wrapper with custom template', '- Wrapper with custom template', - ['dateTimeDiffEquals' => 'Wrapper with custom template'] + ['dateTimeDiffEquals' => 'Wrapper with custom template'], )); test('Without adjacent result', expectAll( @@ -124,7 +124,7 @@ '__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', - ] + ], )); test('Without adjacent result with templates', expectAll( @@ -144,5 +144,5 @@ '__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 e63ec8b25..706ae9844 100644 --- a/tests/feature/Rules/EachTest.php +++ b/tests/feature/Rules/EachTest.php @@ -11,14 +11,14 @@ fn() => v::each(v::intType())->assert(null), '`null` must be iterable', '- `null` must be iterable', - ['each' => '`null` must be iterable'] + ['each' => '`null` must be iterable'], )); test('Empty', expectAll( fn() => v::each(v::intType())->assert([]), 'The value must not be empty', '- The value must not be empty', - ['each' => 'The value must not be empty'] + ['each' => 'The value must not be empty'], )); test('Default', expectAll( @@ -35,7 +35,7 @@ 0 => '"a" must be an integer', 1 => '"b" must be an integer', 2 => '"c" must be an integer', - ] + ], )); test('Inverted', expectAll( @@ -52,21 +52,21 @@ 0 => '1 must not be an integer', 1 => '2 must not be an integer', 2 => '3 must not be an integer', - ] + ], )); test('With name, non-iterable', expectAll( fn() => v::each(v::intType()->setName('Wrapped'))->setName('Wrapper')->assert(null), 'Wrapped must be iterable', '- Wrapped must be iterable', - ['Wrapped' => 'Wrapped must be iterable'] + ['Wrapped' => 'Wrapped must be iterable'], )); test('With name, empty', expectAll( fn() => v::each(v::intType()->setName('Wrapped'))->setName('Wrapper')->assert([]), 'Wrapped must not be empty', '- Wrapped must not be empty', - ['Wrapped' => 'Wrapped must not be empty'] + ['Wrapped' => 'Wrapped must not be empty'], )); test('With name, default', expectAll( @@ -83,7 +83,7 @@ 0 => 'Wrapped must be an integer', 1 => 'Wrapped must be an integer', 2 => 'Wrapped must be an integer', - ] + ], )); test('With name, inverted', expectAll( @@ -100,7 +100,7 @@ 0 => 'Wrapped must not be an integer', 1 => 'Wrapped must not be an integer', 2 => 'Wrapped must not be an integer', - ] + ], )); test('With wrapper name, default', expectAll( @@ -117,7 +117,7 @@ 0 => 'Wrapper must be an integer', 1 => 'Wrapper must be an integer', 2 => 'Wrapper must be an integer', - ] + ], )); test('With wrapper name, inverted', expectAll( @@ -134,7 +134,7 @@ 0 => 'Wrapper must not be an integer', 1 => 'Wrapper must not be an integer', 2 => 'Wrapper must not be an integer', - ] + ], )); test('With Not name, inverted', expectAll( @@ -151,14 +151,14 @@ 0 => 'Not must not be an integer', 1 => 'Not must not be an integer', 2 => 'Not must not be an integer', - ] + ], )); test('With template, non-iterable', expectAll( fn() => v::each(v::intType())->setTemplate('You should have passed an iterable')->assert(null), 'You should have passed an iterable', '- You should have passed an iterable', - ['each' => 'You should have passed an iterable'] + ['each' => 'You should have passed an iterable'], )); test('With template, empty', expectAll( @@ -166,7 +166,7 @@ ->assert([]), 'You should have passed an non-empty', '- You should have passed an non-empty', - ['each' => 'You should have passed an non-empty'] + ['each' => 'You should have passed an non-empty'], )); test('With template, default', expectAll( @@ -175,7 +175,7 @@ ->assert(['a', 'b', 'c']), 'All items should have been integers', '- All items should have been integers', - ['each' => 'All items should have been integers'] + ['each' => 'All items should have been integers'], )); test('with template, inverted', expectAll( @@ -184,7 +184,7 @@ ->assert([1, 2, 3]), 'All items should not have been integers', '- All items should not have been integers', - ['notEach' => 'All items should not have been integers'] + ['notEach' => 'All items should not have been integers'], )); test('With array template, default', expectAll( @@ -210,7 +210,7 @@ 0 => 'First item should have been an integer', 1 => 'Second item should have been an integer', 2 => 'Third item should have been an integer', - ] + ], )); test('With array template and name, default', expectAll( @@ -237,7 +237,7 @@ 0 => 'Wrapped must be an integer', 1 => 'Wrapped must be an integer', 2 => 'Wrapped must be an integer', - ] + ], )); test('Chained wrapped rule', expectAll( @@ -264,7 +264,7 @@ 'between' => '4 must be between 5 and 7', 'odd' => '4 must be an odd number', ], - ] + ], )); test('Multiple nested rules', expectAll( @@ -289,5 +289,5 @@ 'arrayType' => '"not an array" must be an array', 'my_int' => 'my_int must be present', ], - ] + ], )); diff --git a/tests/feature/Rules/HetuTest.php b/tests/feature/Rules/HetuTest.php index 7120a7b12..162fe7316 100644 --- a/tests/feature/Rules/HetuTest.php +++ b/tests/feature/Rules/HetuTest.php @@ -11,26 +11,26 @@ fn() => v::hetu()->assert('010106A901O'), '"010106A901O" must be a valid Finnish personal identity code', '- "010106A901O" must be a valid Finnish personal identity code', - ['hetu' => '"010106A901O" must be a valid Finnish personal identity code'] + ['hetu' => '"010106A901O" must be a valid Finnish personal identity code'], )); test('Inverted', expectAll( fn() => v::not(v::hetu())->assert('010106A9012'), '"010106A9012" must not be a valid Finnish personal identity code', '- "010106A9012" must not be a valid Finnish personal identity code', - ['notHetu' => '"010106A9012" must not be a valid Finnish personal identity code'] + ['notHetu' => '"010106A9012" must not be a valid Finnish personal identity code'], )); test('With template', expectAll( fn() => v::hetu()->assert('010106A901O', 'That is not a HETU'), 'That is not a HETU', '- That is not a HETU', - ['hetu' => 'That is not a HETU'] + ['hetu' => 'That is not a HETU'], )); test('With name', expectAll( fn() => v::hetu()->setName('Hetu')->assert('010106A901O'), 'Hetu must be a valid Finnish personal identity code', '- Hetu must be a valid Finnish personal identity code', - ['hetu' => 'Hetu must be a valid Finnish personal identity code'] + ['hetu' => 'Hetu must be a valid Finnish personal identity code'], )); diff --git a/tests/feature/Rules/IterableTypeTest.php b/tests/feature/Rules/IterableTypeTest.php index 46fac32bd..d7333129d 100644 --- a/tests/feature/Rules/IterableTypeTest.php +++ b/tests/feature/Rules/IterableTypeTest.php @@ -11,26 +11,26 @@ fn() => v::iterableType()->assert(null), '`null` must be iterable', '- `null` must be iterable', - ['iterableType' => '`null` must be iterable'] + ['iterableType' => '`null` must be iterable'], )); test('Inverted', expectAll( fn() => v::not(v::iterableType())->assert([1, 2, 3]), '`[1, 2, 3]` must not iterable', '- `[1, 2, 3]` must not iterable', - ['notIterableType' => '`[1, 2, 3]` must not iterable'] + ['notIterableType' => '`[1, 2, 3]` must not iterable'], )); test('With template', expectAll( fn() => v::iterableType()->assert(null, 'Not an iterable at all'), 'Not an iterable at all', '- Not an iterable at all', - ['iterableType' => 'Not an iterable at all'] + ['iterableType' => 'Not an iterable at all'], )); test('With name', expectAll( fn() => v::iterableType()->setName('Options')->assert(null), 'Options must be iterable', '- Options must be iterable', - ['iterableType' => 'Options must be iterable'] + ['iterableType' => 'Options must be iterable'], )); diff --git a/tests/feature/Rules/KeyExistsTest.php b/tests/feature/Rules/KeyExistsTest.php index 209ded4de..54d4ecf5e 100644 --- a/tests/feature/Rules/KeyExistsTest.php +++ b/tests/feature/Rules/KeyExistsTest.php @@ -11,26 +11,26 @@ fn() => v::keyExists('foo')->assert(['bar' => 'baz']), 'foo must be present', '- foo must be present', - ['foo' => 'foo must be present'] + ['foo' => 'foo must be present'], )); test('Inverted mode', expectAll( fn() => v::not(v::keyExists('foo'))->assert(['foo' => 'baz']), 'foo must not be present', '- foo must not be present', - ['foo' => 'foo must not be present'] + ['foo' => 'foo must not be present'], )); test('Custom name', expectAll( fn() => v::keyExists('foo')->setName('Custom name')->assert(['bar' => 'baz']), 'Custom name must be present', '- Custom name must be present', - ['foo' => 'Custom name must be present'] + ['foo' => 'Custom name must be present'], )); test('Custom template', expectAll( fn() => v::keyExists('foo')->assert(['bar' => 'baz'], 'Custom template for `{{name}}`'), 'Custom template for `foo`', '- Custom template for `foo`', - ['foo' => 'Custom template for `foo`'] + ['foo' => 'Custom template for `foo`'], )); diff --git a/tests/feature/Rules/KeyOptionalTest.php b/tests/feature/Rules/KeyOptionalTest.php index cb75c6132..543d3cf16 100644 --- a/tests/feature/Rules/KeyOptionalTest.php +++ b/tests/feature/Rules/KeyOptionalTest.php @@ -11,68 +11,68 @@ fn() => v::keyOptional('foo', v::intType())->assert(['foo' => 'string']), 'foo must be an integer', '- foo must be an integer', - ['foo' => 'foo must be an integer'] + ['foo' => 'foo must be an integer'], )); test('Inverted', expectAll( fn() => v::not(v::keyOptional('foo', v::intType()))->assert(['foo' => 12]), 'foo must not be an integer', '- foo must not be an integer', - ['foo' => 'foo must not be an integer'] + ['foo' => 'foo must not be an integer'], )); test('Inverted with missing key', expectAll( fn() => v::not(v::keyOptional('foo', v::intType()))->assert([]), 'foo must be present', '- foo must be present', - ['foo' => 'foo must be present'] + ['foo' => 'foo must be present'], )); test('With wrapped name, default', expectAll( fn() => v::keyOptional('foo', v::intType()->setName('Wrapped'))->setName('Wrapper')->assert(['foo' => 'string']), 'Wrapped must be an integer', '- Wrapped must be an integer', - ['foo' => 'Wrapped must be an integer'] + ['foo' => 'Wrapped must be an integer'], )); test('With wrapped name, inverted', expectAll( fn() => v::not(v::keyOptional('foo', v::intType()->setName('Wrapped'))->setName('Wrapper'))->setName('Not')->assert(['foo' => 12]), 'Wrapped must not be an integer', '- Wrapped must not be an integer', - ['foo' => 'Wrapped must not be an integer'] + ['foo' => 'Wrapped must not be an integer'], )); test('With wrapper name, default', expectAll( fn() => v::keyOptional('foo', v::intType())->setName('Wrapper')->assert(['foo' => 'string']), 'foo must be an integer', '- foo must be an integer', - ['foo' => 'foo must be an integer'] + ['foo' => 'foo must be an integer'], )); test('With wrapper name, inverted', expectAll( fn() => v::not(v::keyOptional('foo', v::intType())->setName('Wrapper'))->setName('Not')->assert(['foo' => 12]), 'foo must not be an integer', '- foo must not be an integer', - ['foo' => 'foo must not be an integer'] + ['foo' => 'foo must not be an integer'], )); test('With "Not" name, inverted', expectAll( fn() => v::not(v::keyOptional('foo', v::intType()))->setName('Not')->assert(['foo' => 12]), 'foo must not be an integer', '- foo must not be an integer', - ['foo' => 'foo must not be an integer'] + ['foo' => 'foo must not be an integer'], )); test('With template, default', expectAll( fn() => v::keyOptional('foo', v::intType())->assert(['foo' => 'string'], 'That key is off-key'), 'That key is off-key', '- That key is off-key', - ['foo' => 'That key is off-key'] + ['foo' => 'That key is off-key'], )); test('With template, inverted', expectAll( fn() => v::not(v::keyOptional('foo', v::intType()))->assert(['foo' => 12], 'No off-key key'), 'No off-key key', '- No off-key key', - ['foo' => 'No off-key key'] + ['foo' => 'No off-key key'], )); diff --git a/tests/feature/Rules/KeySetTest.php b/tests/feature/Rules/KeySetTest.php index 836759cd1..c5155b28a 100644 --- a/tests/feature/Rules/KeySetTest.php +++ b/tests/feature/Rules/KeySetTest.php @@ -11,21 +11,21 @@ fn() => v::keySet(v::key('foo', v::intType()))->assert(['foo' => 'string']), 'foo must be an integer', '- foo must be an integer', - ['foo' => 'foo must be an integer'] + ['foo' => 'foo must be an integer'], )); test('one rule / one missing key', expectAll( fn() => v::keySet(v::keyExists('foo'))->assert([]), 'foo must be present', '- foo must be present', - ['foo' => 'foo must be present'] + ['foo' => 'foo must be present'], )); test('one rule / one extra key', expectAll( fn() => v::keySet(v::keyExists('foo'))->assert(['foo' => 42, 'bar' => 'string']), 'bar must not be present', '- bar must not be present', - ['bar' => 'bar must not be present'] + ['bar' => 'bar must not be present'], )); test('one rule / one extra key / one missing key', expectAll( @@ -40,7 +40,7 @@ '__root__' => '`["bar": true]` contains both missing and extra keys', 'foo' => 'foo must be present', 'bar' => 'bar must not be present', - ] + ], )); test('one rule / two extra keys', expectAll( @@ -55,7 +55,7 @@ '__root__' => '`["foo": 42, "bar": "string", "baz": true]` contains extra keys', 'bar' => 'bar must not be present', 'baz' => 'baz must not be present', - ] + ], )); test('one rule / more than ten extra keys', expectAll( @@ -101,14 +101,14 @@ 'waldo' => 'waldo must not be present', 'fred' => 'fred must not be present', 'plugh' => 'plugh must not be present', - ] + ], )); test('multiple rules / one failed', expectAll( fn() => v::keySet(v::keyExists('foo'), v::keyExists('bar'))->assert(['foo' => 42]), 'bar must be present', '- bar must be present', - ['bar' => 'bar must be present'] + ['bar' => 'bar must be present'], )); test('multiple rules / all failed', expectAll( @@ -123,23 +123,23 @@ '__root__' => '`[]` contains missing keys', 'foo' => 'foo must be present', 'bar' => 'bar must be present', - ] + ], )); test('multiple rules / one extra key', expectAll( fn() => v::keySet( v::keyExists('foo'), - v::keyExists('bar') + v::keyExists('bar'), )->assert(['foo' => 42, 'bar' => 'string', 'baz' => true]), 'baz must not be present', '- baz must not be present', - ['baz' => 'baz must not be present'] + ['baz' => 'baz must not be present'], )); test('multiple rules / one extra key / one missing', expectAll( fn() => v::keySet( v::keyExists('foo'), - v::keyExists('bar') + v::keyExists('bar'), )->assert(['bar' => 'string', 'baz' => true]), 'foo must be present', <<<'FULL_MESSAGE' @@ -151,14 +151,14 @@ '__root__' => '`["bar": "string", "baz": true]` contains both missing and extra keys', 'foo' => 'foo must be present', 'baz' => 'baz must not be present', - ] + ], )); test('multiple rules / two extra keys', expectAll( fn() => v::keySet( v::keyExists('foo'), v::keyExists('bar'), - v::keyOptional('qux', v::intType()) + v::keyOptional('qux', v::intType()), )->assert(['foo' => 42, 'bar' => 'string', 'baz' => true, 'qux' => false]), 'qux must be an integer', <<<'FULL_MESSAGE' @@ -170,14 +170,14 @@ '__root__' => '`["foo": 42, "bar": "string", "baz": true, "qux": false]` contains extra keys', 'qux' => 'qux must be an integer', 'baz' => 'baz must not be present', - ] + ], )); test('multiple rules / all failed validation', expectAll( fn() => v::keySet( v::key('foo', v::intType()), v::key('bar', v::intType()), - v::key('baz', v::intType()) + v::key('baz', v::intType()), ) ->assert(['foo' => 42, 'bar' => 'string', 'baz' => true]), 'bar must be an integer', @@ -190,7 +190,7 @@ '__root__' => '`["foo": 42, "bar": "string", "baz": true]` validation failed', 'bar' => 'bar must be an integer', 'baz' => 'baz must be an integer', - ] + ], )); test('multiple rules / single missing key / single failed validation', expectAll( @@ -198,7 +198,7 @@ v::create() ->key('foo', v::intType()) ->key('bar', v::intType()) - ->key('baz', v::intType()) + ->key('baz', v::intType()), ) ->assert(['foo' => 42, 'bar' => 'string']), 'bar must be an integer', @@ -211,5 +211,5 @@ '__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/KeyTest.php b/tests/feature/Rules/KeyTest.php index e9457f7c2..34eebf79c 100644 --- a/tests/feature/Rules/KeyTest.php +++ b/tests/feature/Rules/KeyTest.php @@ -11,89 +11,89 @@ fn() => v::key('foo', v::intType())->assert([]), 'foo must be present', '- foo must be present', - ['foo' => 'foo must be present'] + ['foo' => 'foo must be present'], )); test('Default', expectAll( fn() => v::key('foo', v::intType())->assert(['foo' => 'string']), 'foo must be an integer', '- foo must be an integer', - ['foo' => 'foo must be an integer'] + ['foo' => 'foo must be an integer'], )); test('Inverted', expectAll( fn() => v::not(v::key('foo', v::intType()))->assert(['foo' => 12]), 'foo must not be an integer', '- foo must not be an integer', - ['foo' => 'foo must not be an integer'] + ['foo' => 'foo must not be an integer'], )); test('Double-inverted with missing key', expectAll( fn() => v::not(v::not(v::key('foo', v::intType())))->assert([]), 'foo must be present', '- foo must be present', - ['foo' => 'foo must be present'] + ['foo' => 'foo must be present'], )); test('With wrapped name, missing key', expectAll( fn() => v::key('foo', v::intType()->setName('Wrapped'))->setName('Wrapper')->assert([]), 'Wrapped must be present', '- Wrapped must be present', - ['foo' => 'Wrapped must be present'] + ['foo' => 'Wrapped must be present'], )); test('With wrapped name, default', expectAll( fn() => v::key('foo', v::intType()->setName('Wrapped'))->setName('Wrapper')->assert(['foo' => 'string']), 'Wrapped must be an integer', '- Wrapped must be an integer', - ['foo' => 'Wrapped must be an integer'] + ['foo' => 'Wrapped must be an integer'], )); test('With wrapped name, inverted', expectAll( fn() => v::not(v::key('foo', v::intType()->setName('Wrapped'))->setName('Wrapper'))->setName('Not')->assert(['foo' => 12]), 'Wrapped must not be an integer', '- Wrapped must not be an integer', - ['foo' => 'Wrapped must not be an integer'] + ['foo' => 'Wrapped must not be an integer'], )); test('With wrapper name, default', expectAll( fn() => v::key('foo', v::intType())->setName('Wrapper')->assert(['foo' => 'string']), 'foo must be an integer', '- foo must be an integer', - ['foo' => 'foo must be an integer'] + ['foo' => 'foo must be an integer'], )); test('With wrapper name, missing key', expectAll( fn() => v::key('foo', v::intType())->setName('Wrapper')->assert([]), 'foo must be present', '- foo must be present', - ['foo' => 'foo must be present'] + ['foo' => 'foo must be present'], )); test('With wrapper name, inverted', expectAll( fn() => v::not(v::key('foo', v::intType())->setName('Wrapper'))->setName('Not')->assert(['foo' => 12]), 'foo must not be an integer', '- foo must not be an integer', - ['foo' => 'foo must not be an integer'] + ['foo' => 'foo must not be an integer'], )); test('With "Not" name, inverted', expectAll( fn() => v::not(v::key('foo', v::intType()))->setName('Not')->assert(['foo' => 12]), 'foo must not be an integer', '- foo must not be an integer', - ['foo' => 'foo must not be an integer'] + ['foo' => 'foo must not be an integer'], )); test('With template, default', expectAll( fn() => v::key('foo', v::intType())->assert(['foo' => 'string'], 'That key is off-key'), 'That key is off-key', '- That key is off-key', - ['foo' => 'That key is off-key'] + ['foo' => 'That key is off-key'], )); test('With template, inverted', expectAll( fn() => v::not(v::key('foo', v::intType()))->assert(['foo' => 12], 'No off-key key'), 'No off-key key', '- No off-key key', - ['foo' => 'No off-key key'] + ['foo' => 'No off-key key'], )); diff --git a/tests/feature/Rules/LazyTest.php b/tests/feature/Rules/LazyTest.php index 8b99ddae4..a2b2716a0 100644 --- a/tests/feature/Rules/LazyTest.php +++ b/tests/feature/Rules/LazyTest.php @@ -11,54 +11,54 @@ fn() => v::lazy(fn() => v::intType())->assert(true), '`true` must be an integer', '- `true` must be an integer', - ['intType' => '`true` must be an integer'] + ['intType' => '`true` must be an integer'], )); test('Inverted', expectAll( fn() => v::not(v::lazy(fn() => v::intType()))->assert(2), '2 must not be an integer', '- 2 must not be an integer', - ['notIntType' => '2 must not be an integer'] + ['notIntType' => '2 must not be an integer'], )); test('With created name, default', expectAll( fn() => v::lazy(fn() => v::intType()->setName('Created'))->setName('Wrapper')->assert(true), 'Created must be an integer', '- Created must be an integer', - ['intType' => 'Created must be an integer'] + ['intType' => 'Created must be an integer'], )); test('With wrapper name, default', expectAll( fn() => v::lazy(fn() => v::intType())->setName('Wrapper')->assert(true), 'Wrapper must be an integer', '- Wrapper must be an integer', - ['intType' => 'Wrapper must be an integer'] + ['intType' => 'Wrapper must be an integer'], )); test('With created name, inverted', expectAll( fn() => v::not(v::lazy(fn() => v::intType()->setName('Created'))->setName('Wrapped'))->setName('Not')->assert(2), 'Created must not be an integer', '- Created must not be an integer', - ['notIntType' => 'Created must not be an integer'] + ['notIntType' => 'Created must not be an integer'], )); test('With wrapper name, inverted', expectAll( fn() => v::not(v::lazy(fn() => v::intType())->setName('Wrapped'))->setName('Not')->assert(2), 'Wrapped must not be an integer', '- Wrapped must not be an integer', - ['notIntType' => 'Wrapped must not be an integer'] + ['notIntType' => 'Wrapped must not be an integer'], )); test('With not name, inverted', expectAll( fn() => v::not(v::lazy(fn() => v::intType()))->setName('Not')->assert(2), 'Not must not be an integer', '- Not must not be an integer', - ['notIntType' => 'Not must not be an integer'] + ['notIntType' => 'Not must not be an integer'], )); test('With template, default', expectAll( fn() => v::lazy(fn() => v::intType())->assert(true, 'Lazy lizards lounging like lords in the local lagoon'), 'Lazy lizards lounging like lords in the local lagoon', '- Lazy lizards lounging like lords in the local lagoon', - ['intType' => 'Lazy lizards lounging like lords in the local lagoon'] + ['intType' => 'Lazy lizards lounging like lords in the local lagoon'], )); diff --git a/tests/feature/Rules/LengthTest.php b/tests/feature/Rules/LengthTest.php index 427535e78..a8edb476a 100644 --- a/tests/feature/Rules/LengthTest.php +++ b/tests/feature/Rules/LengthTest.php @@ -11,35 +11,35 @@ fn() => v::length(v::equals(3))->assert('tulip'), 'The length of "tulip" must be equal to 3', '- The length of "tulip" must be equal to 3', - ['lengthEquals' => 'The length of "tulip" must be equal to 3'] + ['lengthEquals' => 'The length of "tulip" must be equal to 3'], )); test('Inverted wrapped', expectAll( fn() => v::length(v::not(v::equals(4)))->assert('rose'), 'The length of "rose" must not be equal to 4', '- The length of "rose" must not be equal to 4', - ['lengthNotEquals' => 'The length of "rose" must not be equal to 4'] + ['lengthNotEquals' => 'The length of "rose" must not be equal to 4'], )); test('Inverted wrapper', expectAll( fn() => v::not(v::length(v::equals(4)))->assert('fern'), 'The length of "fern" must not be equal to 4', '- The length of "fern" must not be equal to 4', - ['notLengthEquals' => 'The length of "fern" must not be equal to 4'] + ['notLengthEquals' => 'The length of "fern" must not be equal to 4'], )); test('With template', expectAll( fn() => v::length(v::equals(3))->assert('azalea', 'This is a template'), 'This is a template', '- This is a template', - ['lengthEquals' => 'This is a template'] + ['lengthEquals' => 'This is a template'], )); test('With wrapper name', expectAll( fn() => v::length(v::equals(3))->setName('Cactus')->assert('peyote'), 'The length of Cactus must be equal to 3', '- The length of Cactus must be equal to 3', - ['lengthEquals' => 'The length of Cactus must be equal to 3'] + ['lengthEquals' => 'The length of Cactus must be equal to 3'], )); test('Chained wrapped rule', expectAll( @@ -54,5 +54,5 @@ '__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..f2237c219 100644 --- a/tests/feature/Rules/MaxTest.php +++ b/tests/feature/Rules/MaxTest.php @@ -11,63 +11,63 @@ fn() => v::max(v::negative())->assert(null), '`null` must be iterable', '- `null` must be iterable', - ['max' => '`null` must be iterable'] + ['max' => '`null` must be iterable'], )); test('Empty', expectAll( fn() => v::max(v::negative())->assert([]), 'The value must not be empty', '- The value must not be empty', - ['max' => 'The value must not be empty'] + ['max' => 'The value must not be empty'], )); test('Default', expectAll( fn() => v::max(v::negative())->assert([1, 2, 3]), 'The maximum of `[1, 2, 3]` must be a negative number', '- The maximum of `[1, 2, 3]` must be a negative number', - ['maxNegative' => 'The maximum of `[1, 2, 3]` must be a negative number'] + ['maxNegative' => 'The maximum of `[1, 2, 3]` must be a negative number'], )); test('Inverted', expectAll( fn() => v::not(v::max(v::negative()))->assert([-3, -2, -1]), 'The maximum of `[-3, -2, -1]` must not be a negative number', '- The maximum of `[-3, -2, -1]` must not be a negative number', - ['notMaxNegative' => 'The maximum of `[-3, -2, -1]` must not be a negative number'] + ['notMaxNegative' => 'The maximum of `[-3, -2, -1]` must not be a negative number'], )); test('With wrapped name, default', expectAll( fn() => v::max(v::negative()->setName('Wrapped'))->setName('Wrapper')->assert([1, 2, 3]), 'The maximum of Wrapped must be a negative number', '- The maximum of Wrapped must be a negative number', - ['maxNegative' => 'The maximum of Wrapped must be a negative number'] + ['maxNegative' => 'The maximum of Wrapped must be a negative number'], )); test('With wrapper name, default', expectAll( fn() => v::max(v::negative())->setName('Wrapper')->assert([1, 2, 3]), 'The maximum of Wrapper must be a negative number', '- The maximum of Wrapper must be a negative number', - ['maxNegative' => 'The maximum of Wrapper must be a negative number'] + ['maxNegative' => 'The maximum of Wrapper must be a negative number'], )); test('With wrapped name, inverted', expectAll( fn() => v::not(v::max(v::negative()->setName('Wrapped')))->setName('Wrapper')->assert([-3, -2, -1]), 'The maximum of Wrapped must not be a negative number', '- The maximum of Wrapped must not be a negative number', - ['notMaxNegative' => 'The maximum of Wrapped must not be a negative number'] + ['notMaxNegative' => 'The maximum of Wrapped must not be a negative number'], )); test('With wrapper name, inverted', expectAll( fn() => v::not(v::max(v::negative()))->setName('Wrapper')->assert([-3, -2, -1]), 'The maximum of Wrapper must not be a negative number', '- The maximum of Wrapper must not be a negative number', - ['notMaxNegative' => 'The maximum of Wrapper must not be a negative number'] + ['notMaxNegative' => 'The maximum of Wrapper must not be a negative number'], )); test('With template, default', expectAll( fn() => v::max(v::negative())->assert([1, 2, 3], 'The maximum of the value is not what we expect'), 'The maximum of the value is not what we expect', '- The maximum of the value is not what we expect', - ['maxNegative' => 'The maximum of the value is not what we expect'] + ['maxNegative' => 'The maximum of the value is not what we expect'], )); test('Chained wrapped rule', expectAll( @@ -82,5 +82,5 @@ '__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..3ffd58b29 100644 --- a/tests/feature/Rules/MinTest.php +++ b/tests/feature/Rules/MinTest.php @@ -11,28 +11,28 @@ fn() => v::min(v::equals(1))->assert([2, 3]), 'The minimum of `[2, 3]` must be equal to 1', '- The minimum of `[2, 3]` must be equal to 1', - ['minEquals' => 'The minimum of `[2, 3]` must be equal to 1'] + ['minEquals' => 'The minimum of `[2, 3]` must be equal to 1'], )); test('Inverted', expectAll( fn() => v::not(v::min(v::equals(1)))->assert([1, 2, 3]), 'The minimum of `[1, 2, 3]` must not be equal to 1', '- The minimum of `[1, 2, 3]` must not be equal to 1', - ['notMinEquals' => 'The minimum of `[1, 2, 3]` must not be equal to 1'] + ['notMinEquals' => 'The minimum of `[1, 2, 3]` must not be equal to 1'], )); test('With template', expectAll( fn() => v::min(v::equals(1))->assert([2, 3], 'That did not go as planned'), 'That did not go as planned', '- That did not go as planned', - ['minEquals' => 'That did not go as planned'] + ['minEquals' => 'That did not go as planned'], )); test('With name', expectAll( fn() => v::min(v::equals(1))->setName('Options')->assert([2, 3]), 'The minimum of Options must be equal to 1', '- The minimum of Options must be equal to 1', - ['minEquals' => 'The minimum of Options must be equal to 1'] + ['minEquals' => 'The minimum of Options must be equal to 1'], )); test('Chained wrapped rule', expectAll( @@ -47,5 +47,5 @@ '__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..16b24b91a 100644 --- a/tests/feature/Rules/NullOrTest.php +++ b/tests/feature/Rules/NullOrTest.php @@ -11,70 +11,70 @@ fn() => v::nullOr(v::alpha())->assert(1234), '1234 must contain only letters (a-z) or must be null', '- 1234 must contain only letters (a-z) or must be null', - ['nullOrAlpha' => '1234 must contain only letters (a-z) or must be null'] + ['nullOrAlpha' => '1234 must contain only letters (a-z) or must be null'], )); test('Inverted wrapper', expectAll( fn() => v::not(v::nullOr(v::alpha()))->assert('alpha'), '"alpha" must not contain letters (a-z) and must not be null', '- "alpha" must not contain letters (a-z) and must not be null', - ['notNullOrAlpha' => '"alpha" must not contain letters (a-z) and must not be null'] + ['notNullOrAlpha' => '"alpha" must not contain letters (a-z) and must not be null'], )); test('Inverted wrapped', expectAll( fn() => v::nullOr(v::not(v::alpha()))->assert('alpha'), '"alpha" must not contain letters (a-z) or must be null', '- "alpha" must not contain letters (a-z) or must be null', - ['nullOrNotAlpha' => '"alpha" must not contain letters (a-z) or must be null'] + ['nullOrNotAlpha' => '"alpha" must not contain letters (a-z) or must be null'], )); test('Inverted nullined', expectAll( fn() => v::not(v::nullOr(v::alpha()))->assert(null), '`null` must not contain letters (a-z) and must not be null', '- `null` must not contain letters (a-z) and must not be null', - ['notNullOrAlpha' => '`null` must not contain letters (a-z) and must not be null'] + ['notNullOrAlpha' => '`null` must not contain letters (a-z) and must not be null'], )); test('Inverted nullined, wrapped name', expectAll( fn() => v::not(v::nullOr(v::alpha()->setName('Wrapped')))->assert(null), 'Wrapped must not contain letters (a-z) and must not be null', '- Wrapped must not contain letters (a-z) and must not be null', - ['notNullOrAlpha' => 'Wrapped must not contain letters (a-z) and must not be null'] + ['notNullOrAlpha' => 'Wrapped must not contain letters (a-z) and must not be null'], )); test('Inverted nullined, wrapper name', expectAll( fn() => v::not(v::nullOr(v::alpha())->setName('Wrapper'))->assert(null), 'Wrapper must not contain letters (a-z) and must not be null', '- Wrapper must not contain letters (a-z) and must not be null', - ['notNullOrAlpha' => 'Wrapper must not contain letters (a-z) and must not be null'] + ['notNullOrAlpha' => 'Wrapper must not contain letters (a-z) and must not be null'], )); test('Inverted nullined, not name', expectAll( fn() => v::not(v::nullOr(v::alpha()))->setName('Not')->assert(null), 'Not must not contain letters (a-z) and must not be null', '- Not must not contain letters (a-z) and must not be null', - ['notNullOrAlpha' => 'Not must not contain letters (a-z) and must not be null'] + ['notNullOrAlpha' => 'Not must not contain letters (a-z) and must not be null'], )); test('With template', expectAll( fn() => v::nullOr(v::alpha())->assert(123, 'Nine nimble numismatists near Naples'), 'Nine nimble numismatists near Naples', '- Nine nimble numismatists near Naples', - ['nullOrAlpha' => 'Nine nimble numismatists near Naples'] + ['nullOrAlpha' => 'Nine nimble numismatists near Naples'], )); test('With array template', expectAll( fn() => v::nullOr(v::alpha())->assert(123, ['nullOrAlpha' => 'Next to nifty null notations']), 'Next to nifty null notations', '- Next to nifty null notations', - ['nullOrAlpha' => 'Next to nifty null notations'] + ['nullOrAlpha' => 'Next to nifty null notations'], )); test('Inverted nullined with template', expectAll( fn() => v::not(v::nullOr(v::alpha()))->assert(null, ['notNullOrAlpha' => 'Next to nifty null notations']), 'Next to nifty null notations', '- Next to nifty null notations', - ['notNullOrAlpha' => 'Next to nifty null notations'] + ['notNullOrAlpha' => 'Next to nifty null notations'], )); test('Without adjacent result', expectAll( @@ -89,7 +89,7 @@ '__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', - ] + ], )); test('Without adjacent result with templates', expectAll( @@ -107,5 +107,5 @@ '__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/PhoneTest.php b/tests/feature/Rules/PhoneTest.php index 32abdc27b..88f97e248 100644 --- a/tests/feature/Rules/PhoneTest.php +++ b/tests/feature/Rules/PhoneTest.php @@ -11,33 +11,33 @@ fn() => v::phone()->assert('123'), '"123" must be a valid telephone number', '- "123" must be a valid telephone number', - ['phone' => '"123" must be a valid telephone number'] + ['phone' => '"123" must be a valid telephone number'], )); test('Country-specific', expectAll( fn() => v::phone('BR')->assert('+1 650 253 00 00'), '"+1 650 253 00 00" must be a valid telephone number for country Brazil', '- "+1 650 253 00 00" must be a valid telephone number for country Brazil', - ['phone' => '"+1 650 253 00 00" must be a valid telephone number for country Brazil'] + ['phone' => '"+1 650 253 00 00" must be a valid telephone number for country Brazil'], )); test('Inverted', expectAll( fn() => v::not(v::phone())->assert('+55 11 91111 1111'), '"+55 11 91111 1111" must not be a valid telephone number', '- "+55 11 91111 1111" must not be a valid telephone number', - ['notPhone' => '"+55 11 91111 1111" must not be a valid telephone number'] + ['notPhone' => '"+55 11 91111 1111" must not be a valid telephone number'], )); test('Default with name', expectAll( fn() => v::phone()->setName('Phone')->assert('123'), 'Phone must be a valid telephone number', '- Phone must be a valid telephone number', - ['phone' => 'Phone must be a valid telephone number'] + ['phone' => 'Phone must be a valid telephone number'], )); test('Country-specific with name', expectAll( fn() => v::phone('US')->setName('Phone')->assert('123'), 'Phone must be a valid telephone number for country United States', '- Phone must be a valid telephone number for country United States', - ['phone' => 'Phone must be a valid telephone number for country United States'] + ['phone' => 'Phone must be a valid telephone number for country United States'], )); diff --git a/tests/feature/Rules/PropertyExistsTest.php b/tests/feature/Rules/PropertyExistsTest.php index bcba8fb55..6327a8286 100644 --- a/tests/feature/Rules/PropertyExistsTest.php +++ b/tests/feature/Rules/PropertyExistsTest.php @@ -11,26 +11,26 @@ fn() => v::propertyExists('foo')->assert((object) ['bar' => 'baz']), 'foo must be present', '- foo must be present', - ['foo' => 'foo must be present'] + ['foo' => 'foo must be present'], )); test('Inverted mode', expectAll( fn() => v::not(v::propertyExists('foo'))->assert((object) ['foo' => 'baz']), 'foo must not be present', '- foo must not be present', - ['foo' => 'foo must not be present'] + ['foo' => 'foo must not be present'], )); test('Custom name', expectAll( fn() => v::propertyExists('foo')->setName('Custom name')->assert((object) ['bar' => 'baz']), 'Custom name must be present', '- Custom name must be present', - ['foo' => 'Custom name must be present'] + ['foo' => 'Custom name must be present'], )); test('Custom template', expectAll( fn() => v::propertyExists('foo')->assert((object) ['bar' => 'baz'], 'Custom template for `{{name}}`'), 'Custom template for `foo`', '- Custom template for `foo`', - ['foo' => 'Custom template for `foo`'] + ['foo' => 'Custom template for `foo`'], )); diff --git a/tests/feature/Rules/PropertyOptionalTest.php b/tests/feature/Rules/PropertyOptionalTest.php index e984b154c..777e176b3 100644 --- a/tests/feature/Rules/PropertyOptionalTest.php +++ b/tests/feature/Rules/PropertyOptionalTest.php @@ -11,35 +11,35 @@ fn() => v::propertyOptional('foo', v::intType())->assert((object) ['foo' => 'string']), 'foo must be an integer', '- foo must be an integer', - ['foo' => 'foo must be an integer'] + ['foo' => 'foo must be an integer'], )); test('Inverted', expectAll( fn() => v::not(v::propertyOptional('foo', v::intType()))->assert((object) ['foo' => 12]), 'foo must not be an integer', '- foo must not be an integer', - ['foo' => 'foo must not be an integer'] + ['foo' => 'foo must not be an integer'], )); test('Inverted with missing property', expectAll( fn() => v::not(v::propertyOptional('foo', v::intType()))->assert(new stdClass()), 'foo must be present', '- foo must be present', - ['foo' => 'foo must be present'] + ['foo' => 'foo must be present'], )); test('With wrapped name, default', expectAll( fn() => v::propertyOptional('foo', v::intType()->setName('Wrapped'))->setName('Wrapper')->assert((object) ['foo' => 'string']), 'Wrapped must be an integer', '- Wrapped must be an integer', - ['foo' => 'Wrapped must be an integer'] + ['foo' => 'Wrapped must be an integer'], )); test('With wrapped name, inverted', expectAll( fn() => v::not(v::propertyOptional('foo', v::intType()->setName('Wrapped'))->setName('Wrapper'))->setName('Not')->assert((object) ['foo' => 12]), 'Wrapped must not be an integer', '- Wrapped must not be an integer', - ['foo' => 'Wrapped must not be an integer'] + ['foo' => 'Wrapped must not be an integer'], )); test('With wrapper name, default', expectAll( @@ -48,7 +48,7 @@ ->assert((object) ['foo' => 'string']), 'foo must be an integer', '- foo must be an integer', - ['foo' => 'foo must be an integer'] + ['foo' => 'foo must be an integer'], )); test('With wrapper name, inverted', expectAll( @@ -56,14 +56,14 @@ ->setName('Not')->assert((object) ['foo' => 12]), 'foo must not be an integer', '- foo must not be an integer', - ['foo' => 'foo must not be an integer'] + ['foo' => 'foo must not be an integer'], )); test('With "Not" name, inverted', expectAll( fn() => v::not(v::propertyOptional('foo', v::intType()))->setName('Not')->assert((object) ['foo' => 12]), 'foo must not be an integer', '- foo must not be an integer', - ['foo' => 'foo must not be an integer'] + ['foo' => 'foo must not be an integer'], )); test('With template, default', expectAll( @@ -71,7 +71,7 @@ ->assert((object) ['foo' => 'string'], 'Proper property planners plan precise property plots'), 'Proper property planners plan precise property plots', '- Proper property planners plan precise property plots', - ['foo' => 'Proper property planners plan precise property plots'] + ['foo' => 'Proper property planners plan precise property plots'], )); test('With template, inverted', expectAll( @@ -79,5 +79,5 @@ ->assert((object) ['foo' => 12], 'Not proving prudent property planning promotes prosperity'), 'Not proving prudent property planning promotes prosperity', '- Not proving prudent property planning promotes prosperity', - ['foo' => 'Not proving prudent property planning promotes prosperity'] + ['foo' => 'Not proving prudent property planning promotes prosperity'], )); diff --git a/tests/feature/Rules/PropertyTest.php b/tests/feature/Rules/PropertyTest.php index 0833cf719..49b693c0c 100644 --- a/tests/feature/Rules/PropertyTest.php +++ b/tests/feature/Rules/PropertyTest.php @@ -11,67 +11,67 @@ fn() => v::property('foo', v::intType())->assert(new stdClass()), 'foo must be present', '- foo must be present', - ['foo' => 'foo must be present'] + ['foo' => 'foo must be present'], )); test('Default', expectAll( fn() => v::property('foo', v::intType())->assert((object) ['foo' => 'string']), 'foo must be an integer', '- foo must be an integer', - ['foo' => 'foo must be an integer'] + ['foo' => 'foo must be an integer'], )); test('Inverted', expectAll( fn() => v::not(v::property('foo', v::intType()))->assert((object) ['foo' => 12]), 'foo must not be an integer', '- foo must not be an integer', - ['foo' => 'foo must not be an integer'] + ['foo' => 'foo must not be an integer'], )); test('Double-inverted with missing property', expectAll( fn() => v::not(v::not(v::property('foo', v::intType())))->assert(new stdClass()), 'foo must be present', '- foo must be present', - ['foo' => 'foo must be present'] + ['foo' => 'foo must be present'], )); test('With wrapped name, missing property', expectAll( fn() => v::property('foo', v::intType()->setName('Wrapped'))->setName('Wrapper')->assert(new stdClass()), 'Wrapped must be present', '- Wrapped must be present', - ['foo' => 'Wrapped must be present'] + ['foo' => 'Wrapped must be present'], )); test('With wrapped name, default', expectAll( fn() => v::property('foo', v::intType()->setName('Wrapped'))->setName('Wrapper')->assert((object) ['foo' => 'string']), 'Wrapped must be an integer', '- Wrapped must be an integer', - ['foo' => 'Wrapped must be an integer'] + ['foo' => 'Wrapped must be an integer'], )); test('With wrapped name, inverted', expectAll( fn() => v::not( - v::property('foo', v::intType()->setName('Wrapped'))->setName('Wrapper') + v::property('foo', v::intType()->setName('Wrapped'))->setName('Wrapper'), ) ->setName('Not') ->assert((object) ['foo' => 12]), 'Wrapped must not be an integer', '- Wrapped must not be an integer', - ['foo' => 'Wrapped must not be an integer'] + ['foo' => 'Wrapped must not be an integer'], )); test('With wrapper name, default', expectAll( fn() => v::property('foo', v::intType())->setName('Wrapper')->assert((object) ['foo' => 'string']), 'foo must be an integer', '- foo must be an integer', - ['foo' => 'foo must be an integer'] + ['foo' => 'foo must be an integer'], )); test('With wrapper name, missing property', expectAll( fn() => v::property('foo', v::intType())->setName('Wrapper')->assert(new stdClass()), 'foo must be present', '- foo must be present', - ['foo' => 'foo must be present'] + ['foo' => 'foo must be present'], )); test('With wrapper name, inverted', expectAll( @@ -79,14 +79,14 @@ ->assert((object) ['foo' => 12]), 'foo must not be an integer', '- foo must not be an integer', - ['foo' => 'foo must not be an integer'] + ['foo' => 'foo must not be an integer'], )); test('With "Not" name, inverted', expectAll( fn() => v::not(v::property('foo', v::intType()))->setName('Not')->assert((object) ['foo' => 12]), 'foo must not be an integer', '- foo must not be an integer', - ['foo' => 'foo must not be an integer'] + ['foo' => 'foo must not be an integer'], )); test('With template, default', expectAll( @@ -94,7 +94,7 @@ ->assert((object) ['foo' => 'string'], 'Particularly precautions perplexing property'), 'Particularly precautions perplexing property', '- Particularly precautions perplexing property', - ['foo' => 'Particularly precautions perplexing property'] + ['foo' => 'Particularly precautions perplexing property'], )); test('With template, inverted', expectAll( @@ -102,5 +102,5 @@ ->assert((object) ['foo' => 12], 'Not a prompt prospect of a particularly primitive property'), 'Not a prompt prospect of a particularly primitive property', '- Not a prompt prospect of a particularly primitive property', - ['foo' => 'Not a prompt prospect of a particularly primitive property'] + ['foo' => 'Not a prompt prospect of a particularly primitive property'], )); diff --git a/tests/feature/Rules/SizeTest.php b/tests/feature/Rules/SizeTest.php index 568c05dc5..f5bf95d5f 100644 --- a/tests/feature/Rules/SizeTest.php +++ b/tests/feature/Rules/SizeTest.php @@ -26,35 +26,35 @@ fn() => v::size('KB', v::lessThan(2))->assert($this->file2Kb->url()), 'The size in kilobytes of "vfs://root/2kb.txt" must be less than 2', '- The size in kilobytes of "vfs://root/2kb.txt" must be less than 2', - ['sizeLessThan' => 'The size in kilobytes of "vfs://root/2kb.txt" must be less than 2'] + ['sizeLessThan' => 'The size in kilobytes of "vfs://root/2kb.txt" must be less than 2'], )); test('Wrong type', expectAll( fn() => v::size('KB', v::lessThan(2))->assert(new stdClass()), '`stdClass {}` must be a filename or an instance of SplFileInfo or a PSR-7 interface', '- `stdClass {}` must be a filename or an instance of SplFileInfo or a PSR-7 interface', - ['sizeLessThan' => '`stdClass {}` must be a filename or an instance of SplFileInfo or a PSR-7 interface'] + ['sizeLessThan' => '`stdClass {}` must be a filename or an instance of SplFileInfo or a PSR-7 interface'], )); test('Inverted', expectAll( fn() => v::size('MB', v::not(v::equals(3)))->assert($this->file2Mb->url()), 'The size in megabytes of "vfs://root/3mb.txt" must not be equal to 3', '- The size in megabytes of "vfs://root/3mb.txt" must not be equal to 3', - ['sizeNotEquals' => 'The size in megabytes of "vfs://root/3mb.txt" must not be equal to 3'] + ['sizeNotEquals' => 'The size in megabytes of "vfs://root/3mb.txt" must not be equal to 3'], )); test('Wrapped with name', expectAll( fn() => v::size('KB', v::lessThan(2)->setName('Wrapped'))->assert($this->file2Kb->url()), 'The size in kilobytes of Wrapped must be less than 2', '- The size in kilobytes of Wrapped must be less than 2', - ['sizeLessThan' => 'The size in kilobytes of Wrapped must be less than 2'] + ['sizeLessThan' => 'The size in kilobytes of Wrapped must be less than 2'], )); test('Wrapper with name', expectAll( fn() => v::size('KB', v::lessThan(2))->setName('Wrapper')->assert($this->file2Kb->url()), 'The size in kilobytes of Wrapper must be less than 2', '- The size in kilobytes of Wrapper must be less than 2', - ['sizeLessThan' => 'The size in kilobytes of Wrapper must be less than 2'] + ['sizeLessThan' => 'The size in kilobytes of Wrapper must be less than 2'], )); test('Chained wrapped rule', expectAll( @@ -69,5 +69,5 @@ '__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..fd4753b64 100644 --- a/tests/feature/Rules/UndefOrTest.php +++ b/tests/feature/Rules/UndefOrTest.php @@ -11,70 +11,70 @@ fn() => v::undefOr(v::alpha())->assert(1234), '1234 must contain only letters (a-z) or must be undefined', '- 1234 must contain only letters (a-z) or must be undefined', - ['undefOrAlpha' => '1234 must contain only letters (a-z) or must be undefined'] + ['undefOrAlpha' => '1234 must contain only letters (a-z) or must be undefined'], )); test('Inverted wrapper', expectAll( fn() => v::not(v::undefOr(v::alpha()))->assert('alpha'), '"alpha" must not contain letters (a-z) and must not be undefined', '- "alpha" must not contain letters (a-z) and must not be undefined', - ['notUndefOrAlpha' => '"alpha" must not contain letters (a-z) and must not be undefined'] + ['notUndefOrAlpha' => '"alpha" must not contain letters (a-z) and must not be undefined'], )); test('Inverted wrapped', expectAll( fn() => v::undefOr(v::not(v::alpha()))->assert('alpha'), '"alpha" must not contain letters (a-z) or must be undefined', '- "alpha" must not contain letters (a-z) or must be undefined', - ['undefOrNotAlpha' => '"alpha" must not contain letters (a-z) or must be undefined'] + ['undefOrNotAlpha' => '"alpha" must not contain letters (a-z) or must be undefined'], )); test('Inverted undefined', expectAll( fn() => v::not(v::undefOr(v::alpha()))->assert(null), '`null` must not contain letters (a-z) and must not be undefined', '- `null` must not contain letters (a-z) and must not be undefined', - ['notUndefOrAlpha' => '`null` must not contain letters (a-z) and must not be undefined'] + ['notUndefOrAlpha' => '`null` must not contain letters (a-z) and must not be undefined'], )); test('Inverted undefined, wrapped name', expectAll( fn() => v::not(v::undefOr(v::alpha()->setName('Wrapped')))->assert(null), 'Wrapped must not contain letters (a-z) and must not be undefined', '- Wrapped must not contain letters (a-z) and must not be undefined', - ['notUndefOrAlpha' => 'Wrapped must not contain letters (a-z) and must not be undefined'] + ['notUndefOrAlpha' => 'Wrapped must not contain letters (a-z) and must not be undefined'], )); test('Inverted undefined, wrapper name', expectAll( fn() => v::not(v::undefOr(v::alpha())->setName('Wrapper'))->assert(null), 'Wrapper must not contain letters (a-z) and must not be undefined', '- Wrapper must not contain letters (a-z) and must not be undefined', - ['notUndefOrAlpha' => 'Wrapper must not contain letters (a-z) and must not be undefined'] + ['notUndefOrAlpha' => 'Wrapper must not contain letters (a-z) and must not be undefined'], )); test('Inverted undefined, not name', expectAll( fn() => v::not(v::undefOr(v::alpha()))->setName('Not')->assert(null), 'Not must not contain letters (a-z) and must not be undefined', '- Not must not contain letters (a-z) and must not be undefined', - ['notUndefOrAlpha' => 'Not must not contain letters (a-z) and must not be undefined'] + ['notUndefOrAlpha' => 'Not must not contain letters (a-z) and must not be undefined'], )); test('With template', expectAll( fn() => v::undefOr(v::alpha())->assert(123, 'Underneath the undulating umbrella'), 'Underneath the undulating umbrella', '- Underneath the undulating umbrella', - ['undefOrAlpha' => 'Underneath the undulating umbrella'] + ['undefOrAlpha' => 'Underneath the undulating umbrella'], )); test('With array template', expectAll( fn() => v::undefOr(v::alpha())->assert(123, ['undefOrAlpha' => 'Undefined number of unique unicorns']), 'Undefined number of unique unicorns', '- Undefined number of unique unicorns', - ['undefOrAlpha' => 'Undefined number of unique unicorns'] + ['undefOrAlpha' => 'Undefined number of unique unicorns'], )); test('Inverted undefined with template', expectAll( fn() => v::not(v::undefOr(v::alpha()))->assert('', ['notUndefOrAlpha' => 'Should not be undefined or alpha']), 'Should not be undefined or alpha', '- Should not be undefined or alpha', - ['notUndefOrAlpha' => 'Should not be undefined or alpha'] + ['notUndefOrAlpha' => 'Should not be undefined or alpha'], )); test('Without adjacent result', expectAll( @@ -89,7 +89,7 @@ '__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', - ] + ], )); test('Without adjacent result with templates', expectAll( @@ -107,5 +107,5 @@ '__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/feature/Rules/WhenTest.php b/tests/feature/Rules/WhenTest.php index 5d1fad7c5..9e874b3fe 100644 --- a/tests/feature/Rules/WhenTest.php +++ b/tests/feature/Rules/WhenTest.php @@ -11,28 +11,28 @@ fn() => v::when(v::intVal(), v::positive(), v::notEmpty())->assert(-1), '-1 must be a positive number', '- -1 must be a positive number', - ['positive' => '-1 must be a positive number'] + ['positive' => '-1 must be a positive number'], )); test('When invalid use "else"', expectAll( fn() => v::when(v::intVal(), v::positive(), v::notEmpty())->assert(''), 'The value must not be empty', '- The value must not be empty', - ['notEmpty' => 'The value must not be empty'] + ['notEmpty' => 'The value must not be empty'], )); test('When valid use "then" using single template', expectAll( fn() => v::when(v::intVal(), v::positive(), v::notEmpty())->assert(-1, 'That did not go as planned'), 'That did not go as planned', '- That did not go as planned', - ['positive' => 'That did not go as planned'] + ['positive' => 'That did not go as planned'], )); test('When invalid use "else" using single template', expectAll( fn() => v::when(v::intVal(), v::positive(), v::notEmpty())->assert('', 'That could have been better'), 'That could have been better', '- That could have been better', - ['notEmpty' => 'That could have been better'] + ['notEmpty' => 'That could have been better'], )); test('When valid use "then" using array template', expectAll( @@ -42,7 +42,7 @@ ]), 'Not positive', '- Not positive', - ['positive' => 'Not positive'] + ['positive' => 'Not positive'], )); test('When invalid use "else" using array template', expectAll( @@ -52,5 +52,5 @@ ]), 'Not empty', '- Not empty', - ['notEmpty' => 'Not empty'] + ['notEmpty' => 'Not empty'], )); diff --git a/tests/feature/SetTemplateWithSingleValidatorShouldUseTemplateAsMainMessageTest.php b/tests/feature/SetTemplateWithSingleValidatorShouldUseTemplateAsMainMessageTest.php index 1c6c19b7d..25b8864cb 100644 --- a/tests/feature/SetTemplateWithSingleValidatorShouldUseTemplateAsMainMessageTest.php +++ b/tests/feature/SetTemplateWithSingleValidatorShouldUseTemplateAsMainMessageTest.php @@ -10,6 +10,6 @@ use Respect\Validation\Validator; test('Scenario', expectMessage( - fn() => Validator::callback('is_int')->setTemplate('{{name}} is not tasty')->assert('something'), + fn() => Validator::callback('is_int')->setTemplate('{{name}} is not tasty')->assert('something'), '"something" is not tasty', )); diff --git a/tests/feature/Transformers/AliasesTest.php b/tests/feature/Transformers/AliasesTest.php index eeef9da93..80f3a9d59 100644 --- a/tests/feature/Transformers/AliasesTest.php +++ b/tests/feature/Transformers/AliasesTest.php @@ -13,5 +13,5 @@ fn() => v::optional(v::scalarVal())->assert([]), '`[]` must be a scalar value or must be undefined', '- `[]` must be a scalar value or must be undefined', - ['undefOrScalarVal' => '`[]` must be a scalar value or must be undefined'] + ['undefOrScalarVal' => '`[]` must be a scalar value or must be undefined'], )); diff --git a/tests/feature/Transformers/DeprecatedAttributeTest.php b/tests/feature/Transformers/DeprecatedAttributeTest.php index 2989305a1..f8c43a2be 100644 --- a/tests/feature/Transformers/DeprecatedAttributeTest.php +++ b/tests/feature/Transformers/DeprecatedAttributeTest.php @@ -14,47 +14,47 @@ test('Scenario #1', expectMessageAndError( fn() => v::attribute('baz')->assert($object), 'baz must be present', - 'The attribute() rule has been deprecated and will be removed in the next major version. Use propertyExists() instead.' + 'The attribute() rule has been deprecated and will be removed in the next major version. Use propertyExists() instead.', )); test('Scenario #2', expectMessageAndError( fn() => v::not(v::attribute('foo'))->assert($object), 'foo must not be present', - 'The attribute() rule has been deprecated and will be removed in the next major version. Use propertyExists() instead.' + 'The attribute() rule has been deprecated and will be removed in the next major version. Use propertyExists() instead.', )); test('Scenario #3', expectMessageAndError( fn() => v::attribute('foo', v::falseVal())->assert($object), 'foo must evaluate to `false`', - 'The attribute() rule has been deprecated and will be removed in the next major version. Use property() instead.' + 'The attribute() rule has been deprecated and will be removed in the next major version. Use property() instead.', )); test('Scenario #4', expectMessageAndError( fn() => v::not(v::attribute('foo', v::trueVal()))->assert($object), 'foo must not evaluate to `true`', - 'The attribute() rule has been deprecated and will be removed in the next major version. Use property() instead.' + 'The attribute() rule has been deprecated and will be removed in the next major version. Use property() instead.', )); test('Scenario #5', expectMessageAndError( fn() => v::attribute('foo', v::falseVal(), true)->assert($object), 'foo must evaluate to `false`', - 'The attribute() rule has been deprecated and will be removed in the next major version. Use property() instead.' + 'The attribute() rule has been deprecated and will be removed in the next major version. Use property() instead.', )); test('Scenario #6', expectMessageAndError( fn() => v::not(v::attribute('foo', v::trueVal(), true))->assert($object), 'foo must not evaluate to `true`', - 'The attribute() rule has been deprecated and will be removed in the next major version. Use property() instead.' + 'The attribute() rule has been deprecated and will be removed in the next major version. Use property() instead.', )); test('Scenario #7', expectMessageAndError( fn() => v::attribute('foo', v::falseVal(), false)->assert($object), 'foo must evaluate to `false`', - 'The attribute() rule has been deprecated and will be removed in the next major version. Use propertyOptional() instead.' + 'The attribute() rule has been deprecated and will be removed in the next major version. Use propertyOptional() instead.', )); test('Scenario #8', expectMessageAndError( fn() => v::not(v::attribute('foo', v::trueVal(), false))->assert($object), 'foo must not evaluate to `true`', - 'The attribute() rule has been deprecated and will be removed in the next major version. Use propertyOptional() instead.' + 'The attribute() rule has been deprecated and will be removed in the next major version. Use propertyOptional() instead.', )); diff --git a/tests/feature/Transformers/DeprecatedKeyNestedTest.php b/tests/feature/Transformers/DeprecatedKeyNestedTest.php index baeaa9f9d..33264833d 100644 --- a/tests/feature/Transformers/DeprecatedKeyNestedTest.php +++ b/tests/feature/Transformers/DeprecatedKeyNestedTest.php @@ -16,23 +16,23 @@ test('Scenario #1', expectMessageAndError( fn() => v::keyNested('foo.bar.baz')->assert(['foo.bar.baz' => false]), 'foo must be present', - 'The keyNested() rule is deprecated and will be removed in the next major version. Use nested key() or property() instead.' + 'The keyNested() rule is deprecated and will be removed in the next major version. Use nested key() or property() instead.', )); test('Scenario #2', expectMessageAndError( fn() => v::keyNested('foo.bar', v::negative())->assert($input), 'bar must be a negative number', - 'The keyNested() rule is deprecated and will be removed in the next major version. Use nested key() or property() instead.' + 'The keyNested() rule is deprecated and will be removed in the next major version. Use nested key() or property() instead.', )); test('Scenario #3', expectMessageAndError( fn() => v::keyNested('foo.bar', v::stringType())->assert(new ArrayObject($input)), 'bar must be a string', - 'The keyNested() rule is deprecated and will be removed in the next major version. Use nested key() or property() instead.' + 'The keyNested() rule is deprecated and will be removed in the next major version. Use nested key() or property() instead.', )); test('Scenario #4', expectMessageAndError( fn() => v::keyNested('foo.bar', v::floatType(), false)->assert($input), 'bar must be float', - 'The keyNested() rule is deprecated and will be removed in the next major version. Use nested key() or property() instead.' + 'The keyNested() rule is deprecated and will be removed in the next major version. Use nested key() or property() instead.', )); diff --git a/tests/feature/Transformers/DeprecatedKeyTest.php b/tests/feature/Transformers/DeprecatedKeyTest.php index 0948f83fb..c9ae85154 100644 --- a/tests/feature/Transformers/DeprecatedKeyTest.php +++ b/tests/feature/Transformers/DeprecatedKeyTest.php @@ -12,35 +12,35 @@ test('Scenario #1', expectMessageAndError( fn() => v::key('baz')->assert($array), 'baz must be present', - 'Calling key() without a second parameter has been deprecated, and will be not be allowed in the next major version. Use keyExists() instead.' + 'Calling key() without a second parameter has been deprecated, and will be not be allowed in the next major version. Use keyExists() instead.', )); test('Scenario #2', expectMessageAndError( fn() => v::not(v::key('foo'))->assert($array), 'foo must not be present', - 'Calling key() without a second parameter has been deprecated, and will be not be allowed in the next major version. Use keyExists() instead.' + 'Calling key() without a second parameter has been deprecated, and will be not be allowed in the next major version. Use keyExists() instead.', )); test('Scenario #3', expectMessageAndError( fn() => v::key('foo', v::falseVal(), true)->assert($array), 'foo must evaluate to `false`', - 'Calling key() with a third parameter has been deprecated, and will be not be allowed in the next major version. Use key() without the third parameter.' + 'Calling key() with a third parameter has been deprecated, and will be not be allowed in the next major version. Use key() without the third parameter.', )); test('Scenario #4', expectMessageAndError( fn() => v::not(v::key('foo', v::trueVal(), true))->assert($array), 'foo must not evaluate to `true`', - 'Calling key() with a third parameter has been deprecated, and will be not be allowed in the next major version. Use key() without the third parameter.' + 'Calling key() with a third parameter has been deprecated, and will be not be allowed in the next major version. Use key() without the third parameter.', )); test('Scenario #5', expectMessageAndError( fn() => v::key('foo', v::falseVal(), false)->assert($array), 'foo must evaluate to `false`', - 'Calling key() with a third parameter has been deprecated, and will be not be allowed in the next major version. Use keyOptional() instead.' + 'Calling key() with a third parameter has been deprecated, and will be not be allowed in the next major version. Use keyOptional() instead.', )); test('Scenario #6', expectMessageAndError( fn() => v::not(v::key('foo', v::trueVal(), false))->assert($array), 'foo must not evaluate to `true`', - 'Calling key() with a third parameter has been deprecated, and will be not be allowed in the next major version. Use keyOptional() instead.' + 'Calling key() with a third parameter has been deprecated, and will be not be allowed in the next major version. Use keyOptional() instead.', )); diff --git a/tests/feature/Transformers/DeprecatedKeyValueTest.php b/tests/feature/Transformers/DeprecatedKeyValueTest.php index 00e1a10e3..b0465f64b 100644 --- a/tests/feature/Transformers/DeprecatedKeyValueTest.php +++ b/tests/feature/Transformers/DeprecatedKeyValueTest.php @@ -10,59 +10,59 @@ test('Scenario #1', expectMessageAndError( fn() => v::keyValue('foo', 'equals', 'bar')->assert(['bar' => 42]), 'foo must be present', - 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.' + 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.', )); test('Scenario #2', expectMessageAndError( fn() => v::keyValue('foo', 'equals', 'bar')->assert(['foo' => 42]), 'bar must be present', - 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.' + 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.', )); test('Scenario #3', expectMessageAndError( fn() => v::keyValue('foo', 'json', 'bar')->assert(['foo' => 42, 'bar' => 43]), 'bar must be valid to validate foo', - 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.' + 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.', )); test('Scenario #4', expectMessageAndError( fn() => v::keyValue('foo', 'equals', 'bar')->assert(['foo' => 1, 'bar' => 2]), 'foo must be equal to 2', - 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.' + 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.', )); test('Scenario #5', expectMessageAndError( fn() => v::not(v::keyValue('foo', 'equals', 'bar'))->assert(['foo' => 1, 'bar' => 1]), 'foo must not be equal to 1', - 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.' + 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.', )); test('Scenario #6', expectMessageAndError( fn() => v::keyValue('foo', 'equals', 'bar')->assert(['bar' => 42]), 'foo must be present', - 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.' + 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.', )); test('Scenario #7', expectMessageAndError( fn() => v::keyValue('foo', 'equals', 'bar')->assert(['foo' => 42]), 'bar must be present', - 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.' + 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.', )); test('Scenario #8', expectMessageAndError( fn() => v::keyValue('foo', 'json', 'bar')->assert(['foo' => 42, 'bar' => 43]), 'bar must be valid to validate foo', - 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.' + 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.', )); test('Scenario #9', expectMessageAndError( fn() => v::keyValue('foo', 'equals', 'bar')->assert(['foo' => 1, 'bar' => 2]), 'foo must be equal to 2', - 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.' + 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.', )); test('Scenario #10', expectMessageAndError( fn() => v::not(v::keyValue('foo', 'equals', 'bar'))->assert(['foo' => 1, 'bar' => 1]), 'foo must not be equal to 1', - 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.' + 'The keyValue() rule has been deprecated and will be removed in the next major version. Use nested lazy() instead.', )); diff --git a/tests/feature/Transformers/DeprecatedLengthTest.php b/tests/feature/Transformers/DeprecatedLengthTest.php index 834775df7..248844409 100644 --- a/tests/feature/Transformers/DeprecatedLengthTest.php +++ b/tests/feature/Transformers/DeprecatedLengthTest.php @@ -12,143 +12,143 @@ test('Scenario #1', expectMessageAndError( fn() => v::length(0, 5, false)->assert('forest'), 'The length of "forest" must be less than 5', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThan(5) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThan(5) instead.', )); test('Scenario #2', expectMessageAndError( fn() => v::length(10, 20)->assert('river'), 'The length of "river" must be between 10 and 20', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetween(10, 20) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetween(10, 20) instead.', )); test('Scenario #3', expectMessageAndError( fn() => v::length(15, null, false)->assert('mountain'), 'The length of "mountain" must be greater than 15', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThan(15) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThan(15) instead.', )); test('Scenario #4', expectMessageAndError( fn() => v::length(20)->assert('ocean'), 'The length of "ocean" must be greater than or equal to 20', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThanOrEqual(20) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThanOrEqual(20) instead.', )); test('Scenario #5', expectMessageAndError( fn() => v::length(2, 5)->assert('desert'), 'The length of "desert" must be between 2 and 5', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetween(2, 5) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetween(2, 5) instead.', )); test('Scenario #6', expectMessageAndError( fn() => v::not(v::length(0, 15))->assert('rainforest'), 'The length of "rainforest" must be greater than 15', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThanOrEqual(15) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThanOrEqual(15) instead.', )); test('Scenario #7', expectMessageAndError( fn() => v::not(v::length(0, 20, false))->assert('glacier'), 'The length of "glacier" must not be less than 20', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThan(20) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThan(20) instead.', )); test('Scenario #8', expectMessageAndError( fn() => v::not(v::length(3, null))->assert('meadow'), 'The length of "meadow" must be less than 3', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThanOrEqual(3) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThanOrEqual(3) instead.', )); test('Scenario #9', expectMessageAndError( fn() => v::not(v::length(5, null, false))->assert('volcano'), 'The length of "volcano" must not be greater than 5', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThan(5) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThan(5) instead.', )); test('Scenario #10', expectMessageAndError( fn() => v::not(v::length(5, 20))->assert('canyon'), 'The length of "canyon" must not be between 5 and 20', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetween(5, 20) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetween(5, 20) instead.', )); test('Scenario #11', expectMessageAndError( fn() => v::length(0, 5, false)->assert('prairie'), 'The length of "prairie" must be less than 5', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThan(5) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThan(5) instead.', )); test('Scenario #12', expectMessageAndError( fn() => v::length(0, 5)->assert('wetland'), 'The length of "wetland" must be less than or equal to 5', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThanOrEqual(5) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThanOrEqual(5) instead.', )); test('Scenario #13', expectMessageAndError( fn() => v::length(15, null, false)->assert('tundra'), 'The length of "tundra" must be greater than 15', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThan(15) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThan(15) instead.', )); test('Scenario #14', expectMessageAndError( fn() => v::length(20)->assert('savanna'), 'The length of "savanna" must be greater than or equal to 20', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThanOrEqual(20) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThanOrEqual(20) instead.', )); test('Scenario #15', expectMessageAndError( fn() => v::length(7, 10)->assert('marsh'), 'The length of "marsh" must be between 7 and 10', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetween(7, 10) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetween(7, 10) instead.', )); test('Scenario #16', expectMessageAndError( fn() => v::length(4, 10, false)->assert('reef'), 'The length of "reef" must be greater than 4 and less than 10', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetweenExclusive(4, 10) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetweenExclusive(4, 10) instead.', )); test('Scenario #17', expectMessageAndError( fn() => v::not(v::length(0, 15))->assert('valley'), 'The length of "valley" must be greater than 15', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThanOrEqual(15) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThanOrEqual(15) instead.', )); test('Scenario #18', expectMessageAndError( fn() => v::not(v::length(0, 20, false))->assert('island'), 'The length of "island" must not be less than 20', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThan(20) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthLessThan(20) instead.', )); test('Scenario #19', expectMessageAndError( fn() => v::not(v::length(5, null))->assert('plateau'), 'The length of "plateau" must be less than 5', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThanOrEqual(5) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThanOrEqual(5) instead.', )); test('Scenario #20', expectMessageAndError( fn() => v::not(v::length(3, null, false))->assert('fjord'), 'The length of "fjord" must not be greater than 3', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThan(3) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthGreaterThan(3) instead.', )); test('Scenario #21', expectMessageAndError( fn() => v::not(v::length(5, 20))->assert('delta'), 'The length of "delta" must not be between 5 and 20', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetween(5, 20) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetween(5, 20) instead.', )); test('Scenario #22', expectMessageAndError( fn() => v::not(v::length(5, 11, false))->assert('waterfall'), 'The length of "waterfall" must not be greater than 5 or less than 11', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetweenExclusive(5, 11) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthBetweenExclusive(5, 11) instead.', )); test('Scenario #23', expectMessageAndError( fn() => v::length(8, 8)->assert('estuary'), 'The length of "estuary" must be equal to 8', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthEquals(8) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthEquals(8) instead.', )); test('Scenario #24', expectMessageAndError( fn() => v::not(v::length(5, 5))->assert('grove'), 'The length of "grove" must not be equal to 5', - 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthEquals(5) instead.' + 'Calling length() with scalar values has been deprecated, and will not be allowed in the next major version. Use lengthEquals(5) instead.', )); diff --git a/tests/feature/Transformers/DeprecatedMaxTest.php b/tests/feature/Transformers/DeprecatedMaxTest.php index 22a588812..46b2e421c 100644 --- a/tests/feature/Transformers/DeprecatedMaxTest.php +++ b/tests/feature/Transformers/DeprecatedMaxTest.php @@ -22,11 +22,11 @@ test('Scenario #3', expectMessageAndError( fn() => v::max('today')->assert('tomorrow'), '"tomorrow" must be less than or equal to "today"', - 'Calling max() with a scalar value has been deprecated, and will be not allows in the next major version. Use lessThanOrEqual() instead.' + 'Calling max() with a scalar value has been deprecated, and will be not allows in the next major version. Use lessThanOrEqual() instead.', )); test('Scenario #4', expectMessageAndError( fn() => v::not(v::max('b'))->assert('a'), '"a" must be greater than "b"', - 'Calling max() with a scalar value has been deprecated, and will be not allows in the next major version. Use lessThanOrEqual() instead.' + 'Calling max() with a scalar value has been deprecated, and will be not allows in the next major version. Use lessThanOrEqual() instead.', )); diff --git a/tests/feature/Transformers/DeprecatedMinTest.php b/tests/feature/Transformers/DeprecatedMinTest.php index 650a1fd42..101a40cad 100644 --- a/tests/feature/Transformers/DeprecatedMinTest.php +++ b/tests/feature/Transformers/DeprecatedMinTest.php @@ -10,23 +10,23 @@ test('Scenario #1', expectMessageAndError( fn() => v::min(INF)->assert(10), '10 must be greater than or equal to `INF`', - 'Calling min() with a scalar value has been deprecated, and will be not allows in the next major version. Use greaterThanOrEqual() instead.' + 'Calling min() with a scalar value has been deprecated, and will be not allows in the next major version. Use greaterThanOrEqual() instead.', )); test('Scenario #2', expectMessageAndError( fn() => v::not(v::min(5))->assert(INF), '`INF` must be less than 5', - 'Calling min() with a scalar value has been deprecated, and will be not allows in the next major version. Use greaterThanOrEqual() instead.' + 'Calling min() with a scalar value has been deprecated, and will be not allows in the next major version. Use greaterThanOrEqual() instead.', )); test('Scenario #3', expectMessageAndError( fn() => v::min('today')->assert('yesterday'), '"yesterday" must be greater than or equal to "today"', - 'Calling min() with a scalar value has been deprecated, and will be not allows in the next major version. Use greaterThanOrEqual() instead.' + 'Calling min() with a scalar value has been deprecated, and will be not allows in the next major version. Use greaterThanOrEqual() instead.', )); test('Scenario #4', expectMessageAndError( fn() => v::not(v::min('a'))->assert('z'), '"z" must be less than "a"', - 'Calling min() with a scalar value has been deprecated, and will be not allows in the next major version. Use greaterThanOrEqual() instead.' + 'Calling min() with a scalar value has been deprecated, and will be not allows in the next major version. Use greaterThanOrEqual() instead.', )); diff --git a/tests/feature/Transformers/DeprecatedSizeTest.php b/tests/feature/Transformers/DeprecatedSizeTest.php index b1d5c0546..839855eca 100644 --- a/tests/feature/Transformers/DeprecatedSizeTest.php +++ b/tests/feature/Transformers/DeprecatedSizeTest.php @@ -24,49 +24,49 @@ test('Greater than, only integer', expectMessageAndError( fn() => v::size(6042, null)->assert($this->filename), 'The size in bytes of "vfs://root/filename.blob" must be greater than or equal to 6042', - $baseError . 'Use size(\'B\', greaterThanOrEqual(6042)) instead.' + $baseError . 'Use size(\'B\', greaterThanOrEqual(6042)) instead.', )); test('Greater than, with storage unit', expectMessageAndError( fn() => v::size('2.5MB', null)->assert($this->filename), 'The size in megabytes of "vfs://root/filename.blob" must be greater than or equal to 2.5', - $baseError . 'Use size(\'MB\', greaterThanOrEqual(2.5)) instead.' + $baseError . 'Use size(\'MB\', greaterThanOrEqual(2.5)) instead.', )); test('Less than, only integer', expectMessageAndError( fn() => v::size(null, 526)->assert($this->filename), 'The size in bytes of "vfs://root/filename.blob" must be less than or equal to 526', - $baseError . 'Use size(\'B\', lessThanOrEqual(526)) instead.' + $baseError . 'Use size(\'B\', lessThanOrEqual(526)) instead.', )); test('Less than, with storage unit', expectMessageAndError( fn() => v::size(null, '1KB')->assert($this->filename), 'The size in kilobytes of "vfs://root/filename.blob" must be less than or equal to 1', - $baseError . 'Use size(\'KB\', lessThanOrEqual(1)) instead.' + $baseError . 'Use size(\'KB\', lessThanOrEqual(1)) instead.', )); test('Equal, only integer', expectMessageAndError( fn() => v::size(1024, 1024)->assert($this->filename), 'The size in bytes of "vfs://root/filename.blob" must be equal to 1024', - $baseError . 'Use size(\'B\', equals(1024)) instead.' + $baseError . 'Use size(\'B\', equals(1024)) instead.', )); test('Equal, with storage unit', expectMessageAndError( fn() => v::size('1PB', '1PB')->assert($this->filename), 'The size in petabytes of "vfs://root/filename.blob" must be equal to 1', - $baseError . 'Use size(\'PB\', equals(1)) instead.' + $baseError . 'Use size(\'PB\', equals(1)) instead.', )); test('Between, only integer', expectMessageAndError( fn() => v::size(1, 1024)->assert($this->filename), 'The size in bytes of "vfs://root/filename.blob" must be between 1 and 1024', - $baseError . 'Use size(\'B\', between(1, 1024)) instead.' + $baseError . 'Use size(\'B\', between(1, 1024)) instead.', )); test('Between, with storage unit', expectMessageAndError( fn() => v::size('1zb', '2.5zb')->assert($this->filename), 'The size in zettabytes of "vfs://root/filename.blob" must be between 1 and 2.5', - $baseError . 'Use size(\'ZB\', between(1, 2.5)) instead.' + $baseError . 'Use size(\'ZB\', between(1, 2.5)) instead.', )); test('Wrong storage unit', expectDeprecation( diff --git a/tests/feature/Transformers/DeprecatedTypeTest.php b/tests/feature/Transformers/DeprecatedTypeTest.php index 5540908b4..2e8477604 100644 --- a/tests/feature/Transformers/DeprecatedTypeTest.php +++ b/tests/feature/Transformers/DeprecatedTypeTest.php @@ -10,71 +10,71 @@ test('Scenario #1', expectMessageAndError( fn() => v::type('array')->assert(1), '1 must be an array', - 'The type() rule is deprecated and will be removed in the next major version. Use arrayType() instead.' + 'The type() rule is deprecated and will be removed in the next major version. Use arrayType() instead.', )); test('Scenario #2', expectMessageAndError( fn() => v::type('bool')->assert(1), '1 must be a boolean', - 'The type() rule is deprecated and will be removed in the next major version. Use boolType() instead.' + 'The type() rule is deprecated and will be removed in the next major version. Use boolType() instead.', )); test('Scenario #3', expectMessageAndError( fn() => v::type('boolean')->assert(1), '1 must be a boolean', - 'The type() rule is deprecated and will be removed in the next major version. Use boolType() instead.' + 'The type() rule is deprecated and will be removed in the next major version. Use boolType() instead.', )); test('Scenario #4', expectMessageAndError( fn() => v::type('callable')->assert(1), '1 must be a callable', - 'The type() rule is deprecated and will be removed in the next major version. Use callableType() instead.' + 'The type() rule is deprecated and will be removed in the next major version. Use callableType() instead.', )); test('Scenario #5', expectMessageAndError( fn() => v::type('double')->assert(1), '1 must be float', - 'The type() rule is deprecated and will be removed in the next major version. Use floatType() instead.' + 'The type() rule is deprecated and will be removed in the next major version. Use floatType() instead.', )); test('Scenario #6', expectMessageAndError( fn() => v::type('float')->assert(1), '1 must be float', - 'The type() rule is deprecated and will be removed in the next major version. Use floatType() instead.' + 'The type() rule is deprecated and will be removed in the next major version. Use floatType() instead.', )); test('Scenario #7', expectMessageAndError( fn() => v::type('int')->assert('1'), '"1" must be an integer', - 'The type() rule is deprecated and will be removed in the next major version. Use intType() instead.' + 'The type() rule is deprecated and will be removed in the next major version. Use intType() instead.', )); test('Scenario #8', expectMessageAndError( fn() => v::type('integer')->assert('1'), '"1" must be an integer', - 'The type() rule is deprecated and will be removed in the next major version. Use intType() instead.' + 'The type() rule is deprecated and will be removed in the next major version. Use intType() instead.', )); test('Scenario #9', expectMessageAndError( fn() => v::type('null')->assert(1), '1 must be null', - 'The type() rule is deprecated and will be removed in the next major version. Use nullType() instead.' + 'The type() rule is deprecated and will be removed in the next major version. Use nullType() instead.', )); test('Scenario #10', expectMessageAndError( fn() => v::type('object')->assert(1), '1 must be an object', - 'The type() rule is deprecated and will be removed in the next major version. Use objectType() instead.' + 'The type() rule is deprecated and will be removed in the next major version. Use objectType() instead.', )); test('Scenario #11', expectMessageAndError( fn() => v::type('resource')->assert(1), '1 must be a resource', - 'The type() rule is deprecated and will be removed in the next major version. Use resourceType() instead.' + 'The type() rule is deprecated and will be removed in the next major version. Use resourceType() instead.', )); test('Scenario #12', expectMessageAndError( fn() => v::type('string')->assert(1), '1 must be a string', - 'The type() rule is deprecated and will be removed in the next major version. Use stringType() instead.' + 'The type() rule is deprecated and will be removed in the next major version. Use stringType() instead.', )); diff --git a/tests/feature/Transformers/PrefixTest.php b/tests/feature/Transformers/PrefixTest.php index 6dbd205d7..83689aaa8 100644 --- a/tests/feature/Transformers/PrefixTest.php +++ b/tests/feature/Transformers/PrefixTest.php @@ -13,54 +13,54 @@ fn() => v::keyEquals('foo', 12)->assert(['foo' => 10]), 'foo must be equal to 12', '- foo must be equal to 12', - ['foo' => 'foo must be equal to 12'] + ['foo' => 'foo must be equal to 12'], )); test('Length', expectAll( fn() => v::lengthGreaterThan(3)->assert('foo'), 'The length of "foo" must be greater than 3', '- The length of "foo" must be greater than 3', - ['lengthGreaterThan' => 'The length of "foo" must be greater than 3'] + ['lengthGreaterThan' => 'The length of "foo" must be greater than 3'], )); test('Max', expectAll( fn() => v::maxOdd()->assert([1, 2, 3, 4]), 'The maximum of `[1, 2, 3, 4]` must be an odd number', '- The maximum of `[1, 2, 3, 4]` must be an odd number', - ['maxOdd' => 'The maximum of `[1, 2, 3, 4]` must be an odd number'] + ['maxOdd' => 'The maximum of `[1, 2, 3, 4]` must be an odd number'], )); test('Min', expectAll( fn() => v::minEven()->assert([1, 2, 3]), 'The minimum of `[1, 2, 3]` must be an even number', '- The minimum of `[1, 2, 3]` must be an even number', - ['minEven' => 'The minimum of `[1, 2, 3]` must be an even number'] + ['minEven' => 'The minimum of `[1, 2, 3]` must be an even number'], )); test('Not', expectAll( fn() => v::notBetween(1, 3)->assert(2), '2 must not be between 1 and 3', '- 2 must not be between 1 and 3', - ['notBetween' => '2 must not be between 1 and 3'] + ['notBetween' => '2 must not be between 1 and 3'], )); test('NullOr', expectAll( fn() => v::nullOrBoolType()->assert('string'), '"string" must be a boolean or must be null', '- "string" must be a boolean or must be null', - ['nullOrBoolType' => '"string" must be a boolean or must be null'] + ['nullOrBoolType' => '"string" must be a boolean or must be null'], )); test('Property', expectAll( fn() => v::propertyBetween('foo', 1, 3)->assert((object) ['foo' => 5]), 'foo must be between 1 and 3', '- foo must be between 1 and 3', - ['foo' => 'foo must be between 1 and 3'] + ['foo' => 'foo must be between 1 and 3'], )); test('UndefOr', expectAll( fn() => v::undefOrUrl()->assert('string'), '"string" must be a URL or must be undefined', '- "string" must be a URL or must be undefined', - ['undefOrUrl' => '"string" must be a URL or must be undefined'] + ['undefOrUrl' => '"string" must be a URL or must be undefined'], )); diff --git a/tests/feature/TranslatorTest.php b/tests/feature/TranslatorTest.php index ddd11403c..45f5547e1 100644 --- a/tests/feature/TranslatorTest.php +++ b/tests/feature/TranslatorTest.php @@ -18,8 +18,7 @@ function (): void { 'The length of' => 'O comprimento de', '{{name}} must be a string' => '{{name}} deve ser uma string', '{{name}} must be between {{minValue}} and {{maxValue}}' => '{{name}} deve possuir de {{minValue}} a {{maxValue}} caracteres', - '{{name}} must be a valid telephone number for country {{countryName|trans}}' - => '{{name}} deve ser um número de telefone válido para o país {{countryName|trans}}', + '{{name}} must be a valid telephone number for country {{countryName|trans}}' => '{{name}} deve ser um número de telefone válido para o país {{countryName|trans}}', 'United States' => 'Estados Unidos', ]));