-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 6.4: (29 commits) fix tests add missing method fix merge fix test fix merge fix test change test to use a real ObjectManager [Mailer] Document the usage of custom headers in Infobip bridge [SecurityBundle] Add `provider` XML attribute to the authenticators it’s missing from [DoctrineBridge] Test reset with a true manager Sync php-cs-fixer config file with 7.2 [HttpClient] Fix parsing SSE [Notifier] Fix thread key in GoogleChat bridge [HttpKernel][Security] Fix accessing session for stateless request [Serializer] Fix `ObjectNormalizer` with property path test handling of special "value" constraint option [PhpUnitBridge] Add missing import [FrameworkBundle] Fix setting default context for certain normalizers [57251] Missing translations for Romanian (ro) [ErrorHandler] Fix rendered exception code highlighting on PHP 8.3 ...
- Loading branch information
Showing
4 changed files
with
21 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,15 +61,15 @@ public static function getValidValues() | |
/** | ||
* @dataProvider getInvalidValues | ||
*/ | ||
public function testInvalidValues($value) | ||
public function testInvalidValues($value, $expectedMessageParam) | ||
{ | ||
$constraint = new Unique([ | ||
'message' => 'myMessage', | ||
]); | ||
$this->validator->validate($value, $constraint); | ||
|
||
$this->buildViolation('myMessage') | ||
->setParameter('{{ value }}', 'array') | ||
->setParameter('{{ value }}', $expectedMessageParam) | ||
->setCode(Unique::IS_NOT_UNIQUE) | ||
->assertRaised(); | ||
} | ||
|
@@ -79,12 +79,12 @@ public static function getInvalidValues() | |
$object = new \stdClass(); | ||
|
||
return [ | ||
yield 'not unique booleans' => [[true, true]], | ||
yield 'not unique integers' => [[1, 2, 3, 3]], | ||
yield 'not unique floats' => [[0.1, 0.2, 0.1]], | ||
yield 'not unique string' => [['a', 'b', 'a']], | ||
yield 'not unique arrays' => [[[1, 1], [2, 3], [1, 1]]], | ||
yield 'not unique objects' => [[$object, $object]], | ||
yield 'not unique booleans' => [[true, true], 'true'], | ||
yield 'not unique integers' => [[1, 2, 3, 3], 3], | ||
yield 'not unique floats' => [[0.1, 0.2, 0.1], 0.1], | ||
yield 'not unique string' => [['a', 'b', 'a'], '"a"'], | ||
yield 'not unique arrays' => [[[1, 1], [2, 3], [1, 1]], 'array'], | ||
yield 'not unique objects' => [[$object, $object], 'object'], | ||
]; | ||
} | ||
|
||
|
@@ -94,7 +94,7 @@ public function testInvalidValueNamed() | |
$this->validator->validate([1, 2, 3, 3], $constraint); | ||
|
||
$this->buildViolation('myMessage') | ||
->setParameter('{{ value }}', 'array') | ||
->setParameter('{{ value }}', '3') | ||
->setCode(Unique::IS_NOT_UNIQUE) | ||
->assertRaised(); | ||
} | ||
|
@@ -174,7 +174,7 @@ public function testExpectsInvalidNonStrictComparison() | |
])); | ||
|
||
$this->buildViolation('myMessage') | ||
->setParameter('{{ value }}', 'array') | ||
->setParameter('{{ value }}', '1') | ||
->setCode(Unique::IS_NOT_UNIQUE) | ||
->assertRaised(); | ||
} | ||
|
@@ -200,7 +200,7 @@ public function testExpectsInvalidCaseInsensitiveComparison() | |
])); | ||
|
||
$this->buildViolation('myMessage') | ||
->setParameter('{{ value }}', 'array') | ||
->setParameter('{{ value }}', '"hello"') | ||
->setCode(Unique::IS_NOT_UNIQUE) | ||
->assertRaised(); | ||
} | ||
|
@@ -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(); | ||
} | ||
|
@@ -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', | ||
], | ||
]; | ||
} | ||
|