Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c612385

Browse filesBrowse files
author
Amrouche Hamza
committed
fix dunglas's comments
1 parent a264e76 commit c612385
Copy full SHA for c612385

File tree

4 files changed

+47
-0
lines changed
Filter options

4 files changed

+47
-0
lines changed

‎src/Symfony/Component/Validator/Tests/Constraints/Fixtures/ChildA.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/Fixtures/ChildA.php
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,14 @@ class ChildA
1717
{
1818
/**
1919
* @Assert\Valid
20+
* @Assert\NotNull
2021
* @Assert\NotBlank
2122
*/
2223
public $name;
24+
/**
25+
* @var ChildB
26+
* @Assert\Valid
27+
* @Assert\NotNull
28+
*/
29+
public $childB;
2330
}

‎src/Symfony/Component/Validator/Tests/Constraints/Fixtures/ChildB.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Constraints/Fixtures/ChildB.php
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,10 @@ class ChildB
2020
* @Assert\NotBlank
2121
*/
2222
public $name;
23+
/**
24+
* @var ChildA
25+
* @Assert\Valid
26+
* @Assert\NotBlank
27+
*/
28+
public $childA;
2329
}

‎src/Symfony/Component/Validator/Tests/Validator/RecursiveContextualValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Validator/RecursiveContextualValidatorTest.php
Whitespace-only changes.

‎src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Validator/Tests/Validator/RecursiveValidatorTest.php
+34Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,38 @@ public function testEmptyGroupsArrayDoesNotTriggerDeprecation()
6161

6262
$validator->validate($entity, null, array());
6363
}
64+
65+
public function testRelationBetweenChildAAndChildB()
66+
{
67+
$entity = new Entity();
68+
$childA = new ChildA();
69+
$childB = new ChildB();
70+
71+
$childA->childB = $childB;
72+
$childB->childA = $childA;
73+
74+
$childA->name = false;
75+
$childB->name = 'fake';
76+
$entity->childA = array($childA);
77+
$entity->childB = array($childB);
78+
79+
$validatorContext = $this->getMock('Symfony\Component\Validator\Validator\ContextualValidatorInterface');
80+
$validatorContext
81+
->expects($this->once())
82+
->method('validate')
83+
->with($entity, null, array())
84+
->willReturnSelf();
85+
86+
$validator = $this
87+
->getMockBuilder('Symfony\Component\Validator\Validator\RecursiveValidator')
88+
->disableOriginalConstructor()
89+
->setMethods(array('startContext'))
90+
->getMock();
91+
$validator
92+
->expects($this->once())
93+
->method('startContext')
94+
->willReturn($validatorContext);
95+
96+
$validator->validate($entity, null, array());
97+
}
6498
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.