|
@@ 324-344 (lines=21) @@
|
| 321 |
|
$this->assertSame($form, $this->parameterResolver->resolveForm($resource)); |
| 322 |
|
} |
| 323 |
|
|
| 324 |
|
public function testResolveFormExplicit() |
| 325 |
|
{ |
| 326 |
|
$resource = $this->createResourceMock(); |
| 327 |
|
$resource |
| 328 |
|
->expects($this->once()) |
| 329 |
|
->method('getForm') |
| 330 |
|
->will($this->returnValue($form = 'form')); |
| 331 |
|
|
| 332 |
|
$this->requestStack |
| 333 |
|
->expects($this->once()) |
| 334 |
|
->method('getMasterRequest') |
| 335 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 336 |
|
|
| 337 |
|
$request->attributes |
| 338 |
|
->expects($this->once()) |
| 339 |
|
->method('get') |
| 340 |
|
->with($this->identicalTo('_lug_form'), $this->identicalTo($form)) |
| 341 |
|
->will($this->returnValue($explicitForm = 'explicit_form')); |
| 342 |
|
|
| 343 |
|
$this->assertSame($explicitForm, $this->parameterResolver->resolveForm($resource)); |
| 344 |
|
} |
| 345 |
|
|
| 346 |
|
public function testResolveGrid() |
| 347 |
|
{ |
|
@@ 1092-1115 (lines=24) @@
|
| 1089 |
|
); |
| 1090 |
|
} |
| 1091 |
|
|
| 1092 |
|
public function testResolveValidationGroupsDefault() |
| 1093 |
|
{ |
| 1094 |
|
$this->requestStack |
| 1095 |
|
->expects($this->once()) |
| 1096 |
|
->method('getMasterRequest') |
| 1097 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 1098 |
|
|
| 1099 |
|
$resource = $this->createResourceMock(); |
| 1100 |
|
$resource |
| 1101 |
|
->expects($this->once()) |
| 1102 |
|
->method('getName') |
| 1103 |
|
->will($this->returnValue($name = 'name')); |
| 1104 |
|
|
| 1105 |
|
$request->attributes |
| 1106 |
|
->expects($this->once()) |
| 1107 |
|
->method('get') |
| 1108 |
|
->with( |
| 1109 |
|
$this->identicalTo('_lug_validation_groups'), |
| 1110 |
|
$this->identicalTo($groups = [Constraint::DEFAULT_GROUP, 'lug.'.$name]) |
| 1111 |
|
) |
| 1112 |
|
->will($this->returnValue($groups)); |
| 1113 |
|
|
| 1114 |
|
$this->assertSame($groups, $this->parameterResolver->resolveValidationGroups($resource)); |
| 1115 |
|
} |
| 1116 |
|
|
| 1117 |
|
public function testResolveValidationGroupsExplicit() |
| 1118 |
|
{ |
|
@@ 1117-1140 (lines=24) @@
|
| 1114 |
|
$this->assertSame($groups, $this->parameterResolver->resolveValidationGroups($resource)); |
| 1115 |
|
} |
| 1116 |
|
|
| 1117 |
|
public function testResolveValidationGroupsExplicit() |
| 1118 |
|
{ |
| 1119 |
|
$this->requestStack |
| 1120 |
|
->expects($this->once()) |
| 1121 |
|
->method('getMasterRequest') |
| 1122 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 1123 |
|
|
| 1124 |
|
$resource = $this->createResourceMock(); |
| 1125 |
|
$resource |
| 1126 |
|
->expects($this->once()) |
| 1127 |
|
->method('getName') |
| 1128 |
|
->will($this->returnValue($name = 'name')); |
| 1129 |
|
|
| 1130 |
|
$request->attributes |
| 1131 |
|
->expects($this->once()) |
| 1132 |
|
->method('get') |
| 1133 |
|
->with( |
| 1134 |
|
$this->identicalTo('_lug_validation_groups'), |
| 1135 |
|
$this->identicalTo([Constraint::DEFAULT_GROUP, 'lug.'.$name]) |
| 1136 |
|
) |
| 1137 |
|
->will($this->returnValue($groups = ['group'])); |
| 1138 |
|
|
| 1139 |
|
$this->assertSame($groups, $this->parameterResolver->resolveValidationGroups($resource)); |
| 1140 |
|
} |
| 1141 |
|
|
| 1142 |
|
public function testResolveVoterWithoutRequest() |
| 1143 |
|
{ |