File tree Expand file tree Collapse file tree 4 files changed +16
-4
lines changed
Resources/templates/content Expand file tree Collapse file tree 4 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -19,9 +19,10 @@ public function handle()
1919 $ request = $ this ->getRequest ();
2020
2121 if ($ this ->getApp ()->config ->site_index !== null ) {
22+ $ indexTpl = $ this ->getApp ()->config ->site_index_tpl ?? 'content/single.html.twig ' ;
2223 $ content = $ content_provider ->fetch ($ this ->getApp ()->config ->site_index );
2324 if ($ content ) {
24- $ response = new Response ($ twig ->render (' content/single.html.twig ' , [
25+ $ response = new Response ($ twig ->render ($ indexTpl , [
2526 'content ' => $ content
2627 ]));
2728
Original file line number Diff line number Diff line change 55 $ app ->runCommand (['minicli ' , 'web ' , 'index ' ]);
66})->expectOutputRegex ("/template listing/ " );
77
8+ test ('Custom Index page is correctly loaded ' , function () {
9+ $ app = getLibrarianIndex ("posts/test0 " );
10+ $ app ->runCommand (['minicli ' , 'web ' , 'index ' ]);
11+ })->expectOutputRegex ("/custom index/ " );
812
913test ('Content page posts/test0 is correctly loaded ' , function () {
1014 $ app = getLibrarianContent ('test0 ' );
Original file line number Diff line number Diff line change 4747|
4848*/
4949
50- function getLibrarianIndex (): App
50+ function getLibrarianIndex (string $ custom = null ): App
5151{
52- $ app = new App ( [
52+ $ config = [
5353 'app_path ' => [
5454 __DIR__ . '/../Command '
5555 ],
5656 'data_path ' => __DIR__ . '/Resources/data ' ,
5757 'cache_path ' => __DIR__ . '/Resources/cache ' ,
5858 'templates_path ' => __DIR__ . '/Resources/templates ' ,
5959 'debug ' => true
60- ]);
60+ ];
61+
62+ if ($ custom ) {
63+ $ config ['site_index ' ] = $ custom ;
64+ $ config ['site_index_tpl ' ] = "content/custom_index.html.twig " ;
65+ }
6166
67+ $ app = new App ($ config );
6268 $ router = Mockery::mock (RouterServiceProvider::class);
6369 $ request = Mockery::mock (Request::class);
6470 $ request ->shouldReceive ('getParams ' );
Original file line number Diff line number Diff line change 1+ custom index
You can’t perform that action at this time.
0 commit comments