Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Jun 22, 2024
1 parent 1be7d1d commit ee0a4d6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Tests/Constraints/UniqueValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ public static function getInvalidFieldNames(): array
/**
* @dataProvider getInvalidCollectionValues
*/
public function testInvalidCollectionValues(array $value, array $fields)
public function testInvalidCollectionValues(array $value, array $fields, string $expectedMessageParam)
{
$this->validator->validate($value, new Unique([
'message' => 'myMessage',
], fields: $fields));

$this->buildViolation('myMessage')
->setParameter('{{ value }}', 'array')
->setParameter('{{ value }}', $expectedMessageParam)
->setCode(Unique::IS_NOT_UNIQUE)
->assertRaised();
}
Expand All @@ -264,23 +264,25 @@ public static function getInvalidCollectionValues(): array
'unique string' => [[
['lang' => 'eng', 'translation' => 'hi'],
['lang' => 'eng', 'translation' => 'hello'],
], ['lang']],
], ['lang'], 'array'],
'unique floats' => [[
['latitude' => 51.509865, 'longitude' => -0.118092, 'poi' => 'capital'],
['latitude' => 52.520008, 'longitude' => 13.404954],
['latitude' => 51.509865, 'longitude' => -0.118092],
], ['latitude', 'longitude']],
], ['latitude', 'longitude'], 'array'],
'unique int' => [[
['id' => 1, 'email' => '[email protected]'],
['id' => 1, 'email' => '[email protected]'],
], ['id']],
], ['id'], 'array'],
'unique null' => [
[null, null],
[],
'null',
],
'unique field null' => [
[['nullField' => null], ['nullField' => null]],
['nullField'],
'array',
],
];
}
Expand Down

0 comments on commit ee0a4d6

Please sign in to comment.