8000 fix remarks · symfony/symfony@4815e23 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4815e23

Browse files
committed
fix remarks
1 parent ea6879a commit 4815e23

File tree

4 files changed

+11
-28
lines changed

4 files changed

+11
-28
lines changed

src/Symfony/Component/Validator/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CHANGELOG
66

77
* Deprecate the "loose" e-mail validation mode, use "html5" instead
88
* Add the `negate` option to the `Expression` constraint, to inverse the logic of the violation's creation
9-
* Add `is_valid` function to the `Expression` constraint, api the same as `ValidatorInterface::validate`
9+
* Add `is_valid` function to the `Expression` constraint, its behavior is the same as `ValidatorInterface::validate`
1010

1111
6.1
1212
---

src/Symfony/Component/Validator/Constraints/ExpressionValidator.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ class ExpressionValidator extends ConstraintValidator
2727
public function __construct(ExpressionLanguage $expressionLanguage = null)
2828
{
2929
$this->expressionLanguage = $expressionLanguage;
30-
3130
$this->expressionLanguage?->registerProvider(new ExpressionLanguageProvider());
3231
}
3332

src/Symfony/Component/Validator/Tests/Constraints/ExpressionLanguageProviderTest.php

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class ExpressionLanguageProviderTest extends TestCase
2626
/**
2727
* @dataProvider dataProviderCompile
2828
*/
29-
public function testCompile(string $expression, array $names, string $expected): void
29+
public function testCompile(string $expression, array $names, string $expected)
3030
{
3131
$provider = new ExpressionLanguageProvider();
3232

@@ -50,27 +50,23 @@ public function dataProviderCompile(): array
5050
'is_valid(this.data, constraints, groups)',
5151
['this', 'constraints', 'groups'],
5252
'0 === $context->getValidator()->inContext($context)->validate($this->data, $constraints, $groups)->getViolations()->count()',
53-
]
53+
],
5454
];
5555
}
5656

5757
/**
5858
* @dataProvider dataProviderEvaluate
5959
*/
60-
public function testEvaluate(bool $expected, int $errorsCount): void
60+
public function testEvaluate(bool $expected, int $errorsCount)
6161
{
6262
$constraints = [new NotNull(), new Range(['min' => 2])];
6363

64-
$violationList = $this->getMockBuilder(ConstraintViolationListInterface::class)
65-
->onlyMethods(['count'])
66-
->getMockForAbstractClass();
64+
$violationList = $this->createMock(ConstraintViolationListInterface::class);
6765
$violationList->expects($this->once())
6866
->method('count')
6967
->will 10000 Return($errorsCount);
7068

71-
$contextualValidator = $this->getMockBuilder(ContextualValidatorInterface::class)
72-
->onlyMethods(['getViolations', 'validate'])
73-
->getMockForAbstractClass();
69+
$contextualValidator = $this->createMock(ContextualValidatorInterface::class);
7470
$contextualValidator->expects($this->once())
7571
->method('validate')
7672
->with('foo', $constraints)
@@ -79,13 +75,9 @@ public function testEvaluate(bool $expected, int $errorsCount): void
7975
->method('getViolations')
8076
->willReturn($violationList);
8177

82-
$validator = $this->getMockBuilder(ValidatorInterface::class)
83-
->onlyMethods(['inContext'])
84-
->getMockForAbstractClass();
78+
$validator = $this->createMock(ValidatorInterface::class);
8579

86-
$context = $this->getMockBuilder(ExecutionContextInterface::class)
87-
->onlyMethods(['getValidator'])
88-
->getMockForAbstractClass();
80+
$context = $this->createMock(ExecutionContextInterface::class);
8981
$context->expects($this->once())
9082
->method('getValidator')
9183
->willReturn($validator);

src/Symfony/Component/Validator/Tests/Constraints/ExpressionValidatorTest.php

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ public function testViolationOnPass()
308308
->assertRaised();
309309
}
310310

311-
public function testIsValidExpression(): void
311+
public function testIsValidExpression()
312312
{
313313
$constraints = [new NotNull(), new Range(['min' => 2])];
314314

@@ -328,7 +328,7 @@ public function testIsValidExpression(): void
328328
$this->assertNoViolation();
329329
}
330330

331-
public function testIsValidExpressionInvalid(): void
331+
public function testIsValidExpressionInvalid()
332332
{
333333
$constraints = [new Range(['min' => 2, 'max' => 5])];
334334

@@ -346,15 +346,7 @@ public function testIsValidExpressionInvalid(): void
346346
7,
347347
$constraints,
348348
null,
349-
new ConstraintViolation(
350-
'error_range',
351-
null, [],
352-
null,
353-
'',
354-
null,
355-
null,
356-
'range'
357-
)
349+
new ConstraintViolation('error_range', '', [], '', '', 7, null, 'range')
358350
);
359351

360352
$this->validator->validate($object, $constraint);

0 commit comments

Comments
 (0)
0