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 ef5aa96 commit f2883ba
Showing 1 changed file with 7 additions and 5 deletions.
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' => 'bar@email.com'],
['id' => 1, 'email' => 'foo@email.com'],
], ['id']],
], ['id'], 'array'],
'unique null' => [
[null, null],
[],
'null',
],
'unique field null' => [
[['nullField' => null], ['nullField' => null]],
['nullField'],
'array',
],
];
}
Expand Down

0 comments on commit f2883ba

Please sign in to comment.