@@ -39,14 +39,11 @@ final class ViewRendererTest extends TestCase
39
39
{
40
40
use TestTrait;
41
41
42
- /**
43
- * @dataProvider extensionsProvider
44
- */
45
- public function testRenderAndRenderAsString (string $ extension ): void
42
+ public function testRenderAndRenderAsString (): void
46
43
{
47
44
$ renderer = $ this
48
- ->getRenderer ($ extension )
49
- ->withLayout ('@views/with-injection/layout ' )
45
+ ->getRenderer ()
46
+ ->withLayout ('@views/with-injection/layout.php ' )
50
47
->withControllerName ('with-injection ' )
51
48
->withInjections (new TestInjection ());
52
49
@@ -77,14 +74,6 @@ public function testRenderAndRenderAsString(string $extension): void
77
74
);
78
75
}
79
76
80
- public function extensionsProvider (): array
81
- {
82
- return [
83
- ['php ' ],
84
- ['tpl ' ],
85
- ];
86
- }
87
-
88
77
public function testRenderWithAbsoluteLayoutPath (): void
89
78
{
90
79
$ renderer = $ this
@@ -371,7 +360,7 @@ public function testLayoutParametersInjectionsToNestedViews(): void
371
360
{
372
361
$ renderer = $ this
373
362
->getRenderer ()
374
- ->withLayout ('@views/nested-layout/layout ' )
363
+ ->withLayout ('@views/nested-layout/layout.php ' )
375
364
->withInjections (new TitleInjection ());
376
365
377
366
$ response = $ renderer ->render ('empty ' );
@@ -386,7 +375,7 @@ public function testChangeInjectionsAfterCreateProxyAndBeforeRender(): void
386
375
{
387
376
$ renderer = $ this
388
377
->getRenderer ()
389
- ->withLayout ('@views/with-injection/layout ' )
378
+ ->withLayout ('@views/with-injection/layout.php ' )
390
379
->withControllerName ('with-injection ' )
391
380
->withInjections (new TestInjection ());
392
381
@@ -419,7 +408,7 @@ public function testPassingCommonParametersFromContentToLayout(): void
419
408
$ renderer = $ this
420
409
->getRenderer ()
421
410
->withViewPath ('@views/passing-parameters-to-layout ' )
422
- ->withLayout ('@views/passing-parameters-to-layout/layout ' );
411
+ ->withLayout ('@views/passing-parameters-to-layout/layout.php ' );
423
412
424
413
$ response = $ renderer ->render ('content ' , [
425
414
'h1 ' => 'HELLO ' ,
@@ -434,7 +423,7 @@ public function testCommonParametersOverrideLayout(): void
434
423
{
435
424
$ renderer = $ this
436
425
->getRenderer ()
437
- ->withLayout ('@views/override-layout-parameters/layout ' )
426
+ ->withLayout ('@views/override-layout-parameters/layout.php ' )
438
427
->withInjections (new CommonParametersInjection ());
439
428
440
429
$ response = $ renderer ->render ('empty ' );
@@ -449,7 +438,7 @@ public function testInRenderSetParametersOverrideLayout(): void
449
438
$ renderer = $ this
450
439
->getRenderer ()
451
440
->withViewPath ('@views/override-layout-parameters ' )
452
- ->withLayout ('@views/override-layout-parameters/layout ' )
441
+ ->withLayout ('@views/override-layout-parameters/layout.php ' )
453
442
->withInjections (new CommonParametersInjection (), new LayoutParametersInjection ());
454
443
455
444
$ response = $ renderer ->render ('content ' );
@@ -463,7 +452,7 @@ public function testRenderParametersNotOverrideLayout(): void
463
452
{
464
453
$ renderer = $ this
465
454
->getRenderer ()
466
- ->withLayout ('@views/override-layout-parameters/layout ' )
455
+ ->withLayout ('@views/override-layout-parameters/layout.php ' )
467
456
->withInjections (new LayoutParametersInjection ());
468
457
469
458
$ response = $ renderer ->render ('empty ' , ['seoTitle ' => 'custom ' ]);
@@ -494,7 +483,7 @@ public function testLazyLoadingInjection(): void
494
483
495
484
$ renderer = $ this
496
485
->getRenderer (injectionContainer: new InjectionContainer ($ container ))
497
- ->withLayout ('@views/simple/layout ' )
486
+ ->withLayout ('@views/simple/layout.php ' )
498
487
->withControllerName ('simple ' )
499
488
->withInjections (CharsetInjection::class);
500
489
@@ -515,7 +504,7 @@ public function testLazyLoadingInjectionWithoutContainer(): void
515
504
{
516
505
$ renderer = $ this
517
506
->getRenderer ()
518
- ->withLayout ('@views/simple/layout ' )
507
+ ->withLayout ('@views/simple/layout.php ' )
519
508
->withControllerName ('simple ' )
520
509
->withInjections (CharsetInjection::class);
521
510
@@ -528,14 +517,14 @@ public function testLayoutSpecificInjections(): void
528
517
{
529
518
$ renderer = $ this
530
519
->getRenderer ()
531
- ->withLayout ('@views/nested-layout/layout ' )
520
+ ->withLayout ('@views/nested-layout/layout.php ' )
532
521
->withInjections (
533
522
new LayoutSpecificInjections (
534
- '@views/nested-layout/layout ' ,
523
+ '@views/nested-layout/layout.php ' ,
535
524
new TitleInjection (),
536
525
),
537
526
new LayoutSpecificInjections (
538
- '@views/layout ' ,
527
+ '@views/layout.php ' ,
539
528
new TestInjection (),
540
529
),
541
530
new class () implements MetaTagsInjectionInterface {
@@ -568,15 +557,14 @@ public function testImmutability(): void
568
557
}
569
558
570
559
private function getRenderer (
571
- string $ defaultExtension = 'php ' ,
572
560
?InjectionContainerInterface $ injectionContainer = null ,
573
561
): ViewRenderer {
574
562
return new ViewRenderer (
575
563
new DataResponseFactory (new ResponseFactory (), new StreamFactory ()),
576
564
new Aliases (['@views ' => $ this ->getViewsDir ()]),
577
- ( new WebView ('@views ' , new SimpleEventDispatcher ()))-> withDefaultExtension ( $ defaultExtension ),
565
+ new WebView ('@views ' , new SimpleEventDispatcher ()),
578
566
'@views ' ,
579
- '@views/layout ' ,
567
+ '@views/layout.php ' ,
580
568
injectionContainer: $ injectionContainer
581
569
);
582
570
}
0 commit comments