Skip to content

Commit

Permalink
Improve format of Pest files
Browse files Browse the repository at this point in the history
I added some trailing commas to the files.
  • Loading branch information
henriquemoody committed Dec 22, 2024
1 parent b354161 commit aa633db
Show file tree
Hide file tree
Showing 62 changed files with 360 additions and 364 deletions.
4 changes: 2 additions & 2 deletions tests/feature/AssertWithKeysTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
->key('host', v::stringType())
->key('user', v::stringType())
->key('password', v::stringType())
->key('schema', v::stringType())
->key('schema', v::stringType()),
)
->key(
'postgresql',
v::create()
->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([
Expand Down
4 changes: 2 additions & 2 deletions tests/feature/AssertWithPropertiesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,15 @@ function (): void {
->property('host', v::stringType())
->property('user', v::stringType())
->property('password', v::stringType())
->property('schema', v::stringType())
->property('schema', v::stringType()),
)
->property(
'postgresql',
v::create()
->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);
Expand Down
8 changes: 4 additions & 4 deletions tests/feature/AssertWithTemplatesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
));
6 changes: 3 additions & 3 deletions tests/feature/GetMessagesWithReplacementsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ function (): void {
->key('host', v::stringType())
->key('user', v::stringType())
->key('password', v::stringType())
->key('schema', v::stringType())
->key('schema', v::stringType()),
)
->key(
'postgresql',
v::create()
->key('host', v::stringType())
->key('user', v::stringType())
->key('password', v::stringType())
->key('schema', v::stringType())
->key('schema', v::stringType()),
)
->assert(
[
Expand All @@ -45,7 +45,7 @@ function (): void {
'postgresql' => [
'schema' => 'You must provide a valid PostgreSQL schema',
],
]
],
);
},
[
Expand Down
2 changes: 1 addition & 1 deletion tests/feature/Issues/Issue1033Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]
],
));
2 changes: 1 addition & 1 deletion tests/feature/Issues/Issue1244Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
));
12 changes: 6 additions & 6 deletions tests/feature/Issues/Issue1289Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
'default',
new OneOf(
new StringType(),
new BoolType()
)
new BoolType(),
),
),
new KeyOptional(
'description',
Expand All @@ -34,9 +34,9 @@
new KeyOptional(
'children',
new ArrayType(),
)
)
)
),
),
),
)
->assert([
[
Expand All @@ -63,5 +63,5 @@
],
'description' => 'description must be a string value',
],
]
],
));
2 changes: 1 addition & 1 deletion tests/feature/Issues/Issue1333Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
]
],
));
6 changes: 3 additions & 3 deletions tests/feature/Issues/Issue1334Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -45,5 +45,5 @@ function (): void {
1 => 'street must not be empty',
2 => 'street must be a string',
],
]
],
));
6 changes: 3 additions & 3 deletions tests/feature/Issues/Issue1348Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -78,5 +78,5 @@
],
],
],
]
],
));
2 changes: 1 addition & 1 deletion tests/feature/Issues/Issue1376Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@
'lengthBetween' => 'The length of author must be between 1 and 2',
],
'user' => 'user must be present',
]
],
));
2 changes: 1 addition & 1 deletion tests/feature/Issues/Issue1469Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,5 @@ function (): void {
'product_title2' => 'product_title2 must not be present',
],
],
]
],
));
4 changes: 2 additions & 2 deletions tests/feature/Issues/Issue1477Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!'],
));
2 changes: 1 addition & 1 deletion tests/feature/Issues/Issue179Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@ function (): void {
'__root__' => 'These rules must pass for Settings',
'host' => 'host must be a string',
'user' => 'user must be present',
]
],
));
2 changes: 1 addition & 1 deletion tests/feature/Issues/Issue425Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ function (): void {
},
'reference must be present',
'- reference must be present',
['reference' => 'reference must be present']
['reference' => 'reference must be present'],
));
2 changes: 1 addition & 1 deletion tests/feature/Issues/Issue446Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
));
2 changes: 1 addition & 1 deletion tests/feature/Issues/Issue619Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
fn() => v::instance(stdClass::class)->setTemplate('invalid object')->assert('test'),
'invalid object',
'- invalid object',
['instance' => 'invalid object']
['instance' => 'invalid object'],
));
2 changes: 1 addition & 1 deletion tests/feature/Issues/Issue739Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
));
8 changes: 4 additions & 4 deletions tests/feature/Issues/Issue796Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
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',
v::create()
->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([
Expand Down Expand Up @@ -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',
]
],
));
12 changes: 5 additions & 7 deletions tests/feature/Issues/Issue799Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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"'],
));
2 changes: 1 addition & 1 deletion tests/feature/Issues/Issue805Test.php
Original file line number Diff line number Diff line change
Expand Up @@ -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!!!!!!'],
));
1 change: 0 additions & 1 deletion tests/feature/KeysAsValidatorNamesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

date_default_timezone_set('UTC');


use Respect\Validation\Validator;

test('Scenario #1', expectFullMessage(
Expand Down
2 changes: 1 addition & 1 deletion tests/feature/NotShouldWorkWithBuilderTestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
);
20 changes: 10 additions & 10 deletions tests/feature/NotWithRecursionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
));
Expand All @@ -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
Expand Down
Loading

0 comments on commit aa633db

Please sign in to comment.