| @@ 256-294 (lines=39) @@ | ||
| 253 | $this->contentViewBuilder->buildView($parameters); |
|
| 254 | } |
|
| 255 | ||
| 256 | public function testBuildViewWithDeprecatedControllerReference(): void |
|
| 257 | { |
|
| 258 | $contentInfo = new ContentInfo(['id' => 120]); |
|
| 259 | $content = new Content([ |
|
| 260 | 'versionInfo' => new VersionInfo([ |
|
| 261 | 'contentInfo' => $contentInfo, |
|
| 262 | ]), |
|
| 263 | ]); |
|
| 264 | $location = new Location( |
|
| 265 | [ |
|
| 266 | 'invisible' => false, |
|
| 267 | 'contentInfo' => $contentInfo, |
|
| 268 | 'content' => $content, |
|
| 269 | ] |
|
| 270 | ); |
|
| 271 | ||
| 272 | $expectedView = new ContentView(null, [], 'full'); |
|
| 273 | $expectedView->setControllerReference(new ControllerReference('ez_content:viewAction')); |
|
| 274 | $expectedView->setLocation($location); |
|
| 275 | $expectedView->setContent($content); |
|
| 276 | ||
| 277 | $parameters = [ |
|
| 278 | 'viewType' => 'full', |
|
| 279 | '_controller' => 'ez_content:viewLocation', |
|
| 280 | 'locationId' => 2, |
|
| 281 | ]; |
|
| 282 | ||
| 283 | $this->repository |
|
| 284 | ->expects($this->once()) |
|
| 285 | ->method('sudo') |
|
| 286 | ->willReturn($location); |
|
| 287 | ||
| 288 | $this->authorizationChecker |
|
| 289 | ->expects($this->at(0)) |
|
| 290 | ->method('isGranted') |
|
| 291 | ->willReturn(true); |
|
| 292 | ||
| 293 | $this->assertEquals($expectedView, $this->contentViewBuilder->buildView($parameters)); |
|
| 294 | } |
|
| 295 | ||
| 296 | public function testBuildView(): void |
|
| 297 | { |
|
| @@ 296-334 (lines=39) @@ | ||
| 293 | $this->assertEquals($expectedView, $this->contentViewBuilder->buildView($parameters)); |
|
| 294 | } |
|
| 295 | ||
| 296 | public function testBuildView(): void |
|
| 297 | { |
|
| 298 | $contentInfo = new ContentInfo(['id' => 120]); |
|
| 299 | $content = new Content([ |
|
| 300 | 'versionInfo' => new VersionInfo([ |
|
| 301 | 'contentInfo' => $contentInfo, |
|
| 302 | ]), |
|
| 303 | ]); |
|
| 304 | $location = new Location( |
|
| 305 | [ |
|
| 306 | 'invisible' => false, |
|
| 307 | 'contentInfo' => $contentInfo, |
|
| 308 | 'content' => $content, |
|
| 309 | ] |
|
| 310 | ); |
|
| 311 | ||
| 312 | $expectedView = new ContentView(null, [], 'full'); |
|
| 313 | $expectedView->setControllerReference(new ControllerReference('ez_content:viewAction')); |
|
| 314 | $expectedView->setLocation($location); |
|
| 315 | $expectedView->setContent($content); |
|
| 316 | ||
| 317 | $parameters = [ |
|
| 318 | 'viewType' => 'full', |
|
| 319 | '_controller' => 'ez_content:viewContent', |
|
| 320 | 'locationId' => 2, |
|
| 321 | ]; |
|
| 322 | ||
| 323 | $this->repository |
|
| 324 | ->expects($this->once()) |
|
| 325 | ->method('sudo') |
|
| 326 | ->willReturn($location); |
|
| 327 | ||
| 328 | $this->authorizationChecker |
|
| 329 | ->expects($this->at(0)) |
|
| 330 | ->method('isGranted') |
|
| 331 | ->willReturn(true); |
|
| 332 | ||
| 333 | $this->assertEquals($expectedView, $this->contentViewBuilder->buildView($parameters)); |
|
| 334 | } |
|
| 335 | } |
|
| 336 | ||