Skip to content

Commit

Permalink
Merge branch '5.4' into 6.4
Browse files Browse the repository at this point in the history
* 5.4: (21 commits)
  [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
  [String] Fix #54611 pluralization of -on ending words + singularization of -a ending foreign words
  [Validator] [UniqueValidator] Use correct variable as parameter in (custom) error message
  [Messenger] Comply with Amazon SQS requirements for message body
  fix cssColor HSLA test dataProvider
  properly handle invalid data for false/true types
  chore: upgrade class doc
  add space in error message
  [Messenger] [Amqp] Handle AMQPConnectionException when publishing a message.
  ...
  • Loading branch information
xabbuh committed Jun 21, 2024
2 parents dab2781 + e00b254 commit 1be7d1d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Constraints/UniqueValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function validate(mixed $value, Constraint $constraint)

if (\in_array($element, $collectionElements, true)) {
$this->context->buildViolation($constraint->message)
->setParameter('{{ value }}', $this->formatValue($value))
->setParameter('{{ value }}', $this->formatValue($element))
->setCode(Unique::IS_NOT_UNIQUE)
->addViolation();

Expand Down
2 changes: 1 addition & 1 deletion Resources/translations/validators.ro.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@
</trans-unit>
<trans-unit id="113">
<source>This URL is missing a top-level domain.</source>
<target state="needs-review-translation">Acest URL îi lipsește un domeniu de nivel superior.</target>
<target>Acestui URL îi lipsește un domeniu de nivel superior.</target>
</trans-unit>
</body>
</file>
Expand Down
2 changes: 1 addition & 1 deletion Tests/Constraints/CssColorValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ public static function getInvalidHSL(): array
}

/**
* @dataProvider getInvalidHSL
* @dataProvider getInvalidHSLA
*/
public function testInvalidHSLA($cssColor)
{
Expand Down
22 changes: 11 additions & 11 deletions Tests/Constraints/UniqueValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand All @@ -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'],
];
}

Expand All @@ -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();
}
Expand Down Expand Up @@ -174,7 +174,7 @@ public function testExpectsInvalidNonStrictComparison()
]));

$this->buildViolation('myMessage')
->setParameter('{{ value }}', 'array')
->setParameter('{{ value }}', '1')
->setCode(Unique::IS_NOT_UNIQUE)
->assertRaised();
}
Expand All @@ -200,7 +200,7 @@ public function testExpectsInvalidCaseInsensitiveComparison()
]));

$this->buildViolation('myMessage')
->setParameter('{{ value }}', 'array')
->setParameter('{{ value }}', '"hello"')
->setCode(Unique::IS_NOT_UNIQUE)
->assertRaised();
}
Expand Down

0 comments on commit 1be7d1d

Please sign in to comment.