|
@@ 325-345 (lines=21) @@
|
| 322 |
|
$this->assertSame($form, $this->parameterResolver->resolveForm($resource)); |
| 323 |
|
} |
| 324 |
|
|
| 325 |
|
public function testResolveFormExplicit() |
| 326 |
|
{ |
| 327 |
|
$resource = $this->createResourceMock(); |
| 328 |
|
$resource |
| 329 |
|
->expects($this->once()) |
| 330 |
|
->method('getForm') |
| 331 |
|
->will($this->returnValue($form = 'form')); |
| 332 |
|
|
| 333 |
|
$this->requestStack |
| 334 |
|
->expects($this->once()) |
| 335 |
|
->method('getMasterRequest') |
| 336 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 337 |
|
|
| 338 |
|
$request->attributes |
| 339 |
|
->expects($this->once()) |
| 340 |
|
->method('get') |
| 341 |
|
->with($this->identicalTo('_lug_form'), $this->identicalTo($form)) |
| 342 |
|
->will($this->returnValue($explicitForm = 'explicit_form')); |
| 343 |
|
|
| 344 |
|
$this->assertSame($explicitForm, $this->parameterResolver->resolveForm($resource)); |
| 345 |
|
} |
| 346 |
|
|
| 347 |
|
public function testResolveGrid() |
| 348 |
|
{ |
|
@@ 801-824 (lines=24) @@
|
| 798 |
|
); |
| 799 |
|
} |
| 800 |
|
|
| 801 |
|
public function testResolveSerializerGroupsDefault() |
| 802 |
|
{ |
| 803 |
|
$this->requestStack |
| 804 |
|
->expects($this->once()) |
| 805 |
|
->method('getMasterRequest') |
| 806 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 807 |
|
|
| 808 |
|
$resource = $this->createResourceMock(); |
| 809 |
|
$resource |
| 810 |
|
->expects($this->once()) |
| 811 |
|
->method('getName') |
| 812 |
|
->will($this->returnValue($name = 'name')); |
| 813 |
|
|
| 814 |
|
$request->attributes |
| 815 |
|
->expects($this->once()) |
| 816 |
|
->method('get') |
| 817 |
|
->with( |
| 818 |
|
$this->identicalTo('_lug_serializer_groups'), |
| 819 |
|
$this->identicalTo($groups = [GroupsExclusionStrategy::DEFAULT_GROUP, 'lug.'.$name]) |
| 820 |
|
) |
| 821 |
|
->will($this->returnValue($groups)); |
| 822 |
|
|
| 823 |
|
$this->assertSame($groups, $this->parameterResolver->resolveSerializerGroups($resource)); |
| 824 |
|
} |
| 825 |
|
|
| 826 |
|
public function testResolveSerializerGroupsExplicit() |
| 827 |
|
{ |
|
@@ 826-849 (lines=24) @@
|
| 823 |
|
$this->assertSame($groups, $this->parameterResolver->resolveSerializerGroups($resource)); |
| 824 |
|
} |
| 825 |
|
|
| 826 |
|
public function testResolveSerializerGroupsExplicit() |
| 827 |
|
{ |
| 828 |
|
$this->requestStack |
| 829 |
|
->expects($this->once()) |
| 830 |
|
->method('getMasterRequest') |
| 831 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 832 |
|
|
| 833 |
|
$resource = $this->createResourceMock(); |
| 834 |
|
$resource |
| 835 |
|
->expects($this->once()) |
| 836 |
|
->method('getName') |
| 837 |
|
->will($this->returnValue($name = 'name')); |
| 838 |
|
|
| 839 |
|
$request->attributes |
| 840 |
|
->expects($this->once()) |
| 841 |
|
->method('get') |
| 842 |
|
->with( |
| 843 |
|
$this->identicalTo('_lug_serializer_groups'), |
| 844 |
|
$this->identicalTo([GroupsExclusionStrategy::DEFAULT_GROUP, 'lug.'.$name]) |
| 845 |
|
) |
| 846 |
|
->will($this->returnValue($groups = ['group'])); |
| 847 |
|
|
| 848 |
|
$this->assertSame($groups, $this->parameterResolver->resolveSerializerGroups($resource)); |
| 849 |
|
} |
| 850 |
|
|
| 851 |
|
public function testResolveSerializerNullWithoutRequest() |
| 852 |
|
{ |
|
@@ 1120-1143 (lines=24) @@
|
| 1117 |
|
); |
| 1118 |
|
} |
| 1119 |
|
|
| 1120 |
|
public function testResolveValidationGroupsDefault() |
| 1121 |
|
{ |
| 1122 |
|
$this->requestStack |
| 1123 |
|
->expects($this->once()) |
| 1124 |
|
->method('getMasterRequest') |
| 1125 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 1126 |
|
|
| 1127 |
|
$resource = $this->createResourceMock(); |
| 1128 |
|
$resource |
| 1129 |
|
->expects($this->once()) |
| 1130 |
|
->method('getName') |
| 1131 |
|
->will($this->returnValue($name = 'name')); |
| 1132 |
|
|
| 1133 |
|
$request->attributes |
| 1134 |
|
->expects($this->once()) |
| 1135 |
|
->method('get') |
| 1136 |
|
->with( |
| 1137 |
|
$this->identicalTo('_lug_validation_groups'), |
| 1138 |
|
$this->identicalTo($groups = [Constraint::DEFAULT_GROUP, 'lug.'.$name]) |
| 1139 |
|
) |
| 1140 |
|
->will($this->returnValue($groups)); |
| 1141 |
|
|
| 1142 |
|
$this->assertSame($groups, $this->parameterResolver->resolveValidationGroups($resource)); |
| 1143 |
|
} |
| 1144 |
|
|
| 1145 |
|
public function testResolveValidationGroupsExplicit() |
| 1146 |
|
{ |
|
@@ 1145-1168 (lines=24) @@
|
| 1142 |
|
$this->assertSame($groups, $this->parameterResolver->resolveValidationGroups($resource)); |
| 1143 |
|
} |
| 1144 |
|
|
| 1145 |
|
public function testResolveValidationGroupsExplicit() |
| 1146 |
|
{ |
| 1147 |
|
$this->requestStack |
| 1148 |
|
->expects($this->once()) |
| 1149 |
|
->method('getMasterRequest') |
| 1150 |
|
->will($this->returnValue($request = $this->createRequestMock())); |
| 1151 |
|
|
| 1152 |
|
$resource = $this->createResourceMock(); |
| 1153 |
|
$resource |
| 1154 |
|
->expects($this->once()) |
| 1155 |
|
->method('getName') |
| 1156 |
|
->will($this->returnValue($name = 'name')); |
| 1157 |
|
|
| 1158 |
|
$request->attributes |
| 1159 |
|
->expects($this->once()) |
| 1160 |
|
->method('get') |
| 1161 |
|
->with( |
| 1162 |
|
$this->identicalTo('_lug_validation_groups'), |
| 1163 |
|
$this->identicalTo([Constraint::DEFAULT_GROUP, 'lug.'.$name]) |
| 1164 |
|
) |
| 1165 |
|
->will($this->returnValue($groups = ['group'])); |
| 1166 |
|
|
| 1167 |
|
$this->assertSame($groups, $this->parameterResolver->resolveValidationGroups($resource)); |
| 1168 |
|
} |
| 1169 |
|
|
| 1170 |
|
public function testResolveVoterWithoutRequest() |
| 1171 |
|
{ |