8000 bug #34458 [Validator] ConstraintValidatorTestCase: add missing retur… · symfony/symfony@814bdeb · GitHub
[go: up one dir, main page]

Skip to content

Commit 814bdeb

Browse files
author
Robin Chalas
committed
bug #34458 [Validator] ConstraintValidatorTestCase: add missing return value to mocked validate method calls (ogizanagi)
This PR was merged into the 3.4 branch. Discussion ---------- [Validator] ConstraintValidatorTestCase: add missing return value to mocked validate method calls | Q | A | ------------- | --- | Branch? | 3.4 <!-- see below --> | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | N/A <!-- prefix each issue number with "Fix #", if any --> | License | MIT | Doc PR | N/A Spotted while working on #34456. Not sure it should really qualify as a bugfix, but the `ContextualValidatorInterface::validate` method is expected to return the instance. If [chaining in a validator](https://github.com/symfony/symfony/pull/34456/files#diff-0e6e3106aa637d750d47e86a14cef8d4R43), trying to use this test methods would throw an error, trying to call a method on `null`. Commits ------- 8d1f326 [Validator] ConstraintValidatorTestCase: add missing return value to mocked validate method calls
2 parents b104760 + 8d1f326 commit 814bdeb

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Symfony/Component/Validator/Test/ConstraintValidatorTestCase.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ protected function expectValidateAt($i, $propertyPath, $value, $group)
177177
->willReturn($validator);
178178
$validator->expects($this->at(2 * $i + 1))
179179
->method('validate')
180-
->with($value, $this->logicalOr(null, [], $this->isInstanceOf('\Symfony\Component\Validator\Constraints\Valid')), $group);
180+
->with($value, $this->logicalOr(null, [], $this->isInstanceOf('\Symfony\Component\Validator\Constraints\Valid')), $group)
181+
->willReturn($validator);
181182
}
182183

183184
protected function expectValidateValueAt($i, $propertyPath, $value, $constraints, $group = null)
@@ -189,7 +190,8 @@ protected function expectValidateValueAt($i, $propertyPath, $value, $constraints
189190
->willReturn($contextualValidator);
190191
$contextualValidator->expects($this->at(2 * $i + 1))
191192
->method('validate')
192-
->with($value, $constraints, $group);
193+
->with($value, $constraints, $group)
194+
->willReturn($contextualValidator);
193195
}
194196

195197
protected function assertNoViolation()

0 commit comments

Comments
 (0)
0