8000 Renamed classes · symfony/symfony@f4acb0e · GitHub
[go: up one dir, main page]

Skip to content

Commit f4acb0e

Browse files
Renamed classes
1 parent 9dffde9 commit f4acb0e

File tree

4 files changed

+24
-21
lines changed

4 files changed

+24
-21
lines changed

src/Symfony/Component/Validator/Constraints/AtLeastOne.php renamed to src/Symfony/Component/Validator/Constraints/AtLeastOneOf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
* @author Przemysław Bogusz <przemyslaw.bogusz@tubotax.pl>
1919
*/
20-
class AtLeastOne extends Composite
20+
class AtLeastOneOf extends Composite
2121
{
2222
public const AT_LEAST_ONE_ERROR = 'f27e6d6c-261a-4056-b391-6673a623531c';
2323

src/Symfony/Component/Validator/Constraints/AtLeastOneValidator.php renamed to src/Symfony/Component/Validator/Constraints/AtLeastOneOfValidator.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818
/**
1919
* @author Przemysław Bogusz <przemyslaw.bogusz@tubotax.pl>
2020
*/
21-
class AtLeastOneValidator extends ConstraintValidator
21+
class AtLeastOneOfValidator extends ConstraintValidator
2222
{
2323
/**
2424
* {@inheritdoc}
2525
*/
2626
public function validate($value, Constraint $constraint)
2727
{
28-
if (!$constraint instanceof AtLeastOne) {
29-
throw new UnexpectedTypeException($constraint, AtLeastOne::class);
28+
if (!$constraint instanceof AtLeastOneOf) {
29+
throw new UnexpectedTypeException($constraint, AtLeastOneOf::class);
3030
}
3131

3232
$validator = $this->context->getValidator();
@@ -54,7 +54,7 @@ public function validate($value, Constraint $constraint)
5454
}
5555

5656
$this->context->buildViolation(implode('', $messages))
57-
->setCode(AtLeastOne::AT_LEAST_ONE_ERROR)
57+
->setCode(AtLeastOneOf::AT_LEAST_ONE_ERROR)
5858
->addViolation()
5959
;
6060
}

src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneTest.php renamed to src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneOfTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@
1212
namespace Symfony\Component\Validator\Tests\Constraints;
1313

1414
use PHPUnit\Framework\TestCase;
15-
use Symfony\Component\Validator\Constraints\AtLeastOne;
15+
use Symfony\Component\Validator\Constraints\AtLeastOneOf;
1616
use Symfony\Component\Validator\Constraints\Valid;
1717

1818
/**
1919
* @author Przemysław Bogusz <przemyslaw.bogusz@tubotax.pl>
2020
*/
21-
class AtLeastOneTest extends TestCase
21+
class AtLeastOneOfTest extends TestCase
2222
{
2323
public function testRejectNonConstraints()
2424
{
2525
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
26-
new AtLeastOne([
26+
new AtLeastOneOf([
2727
'foo',
2828
]);
2929
}
3030

3131
public function testRejectValidConstraint()
3232
{
3333
$this->expectException('Symfony\Component\Validator\Exception\ConstraintDefinitionException');
34-
new AtLeastOne([
34+
new AtLeastOneOf([
3535
new Valid(),
3636
]);
3737
}

src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneValidatorTest.php renamed to src/Symfony/Component/Validator/Tests/Constraints/AtLeastOneOfValidatorTest.php

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111

1212
namespace Symfony\Component\Validator\Tests\Constraints;
1313

14-
use Symfony\Component\Validator\Constraints\AtLeastOne;
15-
use Symfony\Component\Validator\Constraints\AtLeastOneValidator;
14+
use Symfony\Component\Validator\Constraints\AtLeastOneOf;
15+
use Symfony\Component\Validator\Constraints\AtLeastOneOfValidator;
1616
use Symfony\Component\Validator\Constraints\Choice;
1717
use Symfony\Component\Validator\Constraints\Count;
1818
use Symfony\Component\Validator\Constraints\Country;
@@ -29,11 +29,14 @@
2929
use Symfony\Component\Validator\Constraints\Unique;
3030
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;
3131

32-
class AtLeastOneValidatorTest extends ConstraintValidatorTestCase
32+
/**
33+
* @author Przemysław Bogusz <przemyslaw.bogusz@tubotax.pl>
34+
*/
35+
class AtLeastOneOfValidatorTest extends ConstraintValidatorTestCase
3336
{
3437
protected function createValidator()
3538
{
36-
return new AtLeastOneValidator();
39+
return new AtLeastOneOfValidator();
3740
}
3841

3942
/**
@@ -47,7 +50,7 @@ public function testValidCombinations($value, $constraints)
4750
$this->expectViolationsAt($i++, $value, $constraint);
4851
}
4952

50-
$this->validator->validate($value, new AtLeastOne($constraints));
53+
$this->validator->validate($value, new AtLeastOneOf($constraints));
5154

5255
$this->assertNoViolation();
5356
}
@@ -91,37 +94,37 @@ public function getValidCombinations()
9194
*/
9295
public function testInvalidCombinationsWithDefaultMessage($value, $constraints)
9396
{
94-
$atLeastOne = new AtLeastOne(['constraints' => $constraints]);
97+
$atLeastOneOf = new AtLeastOneOf(['constraints' => $constraints]);
9598

96-
$message = [$atLeastOne->message];
99+
$message = [$atLeastOneOf->message];
97100

98101
$i = 0;
99102

100103
foreach ($constraints as $constraint) {
101104
$message[] = ' ['.($i + 1).'] '.$this->expectViolationsAt($i++, $value, $constraint)->get(0)->getMessage();
102105
}
103106

104-
$this->validator->validate($value, $atLeastOne);
107+
$this->validator->validate($value, $atLeastOneOf);
105108

106-
$this->buildViolation(implode('', $message))->setCode(AtLeastOne::AT_LEAST_ONE_ERROR)->assertRaised();
109+
$this->buildViolation(implode('', $message))->setCode(AtLeastOneOf::AT_LEAST_ONE_ERROR)->assertRaised();
107110
}
108111

109112
/**
110113
* @dataProvider getInvalidCombinations
111114
*/
112115
public function testInvalidCombinationsWithCustomMessage($value, $constraints)
113116
{
114-
$atLeastOne = new AtLeastOne(['constraints' => $constraints, 'message' => 'foo', 'includeInternalMessages' => false]);
117+
$atLeastOneOf = new AtLeastOneOf(['constraints' => $constraints, 'message' => 'foo', 'includeInternalMessages' => false]);
115118

116119
$i = 0;
117120

118121
foreach ($constraints as $constraint) {
119122
$this->expectViolationsAt($i++, $value, $constraint);
120123
}
121124

122-
$this->validator->validate($value, $atLeastOne);
125+
$this->validator->validate($value, $atLeastOneOf);
123126

124-
$this->buildViolation('foo')->setCode(AtLeastOne::AT_LEAST_ONE_ERROR)->assertRaised();
127+
$this->buildViolation('foo')->setCode(AtLeastOneOf::AT_LEAST_ONE_ERROR)->assertRaised();
125128
}
126129

127130
public function getInvalidCombinations()

0 commit comments

Comments
 (0)
0