‪TYPO3CMS  10.4
PageLayoutResolverTest.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
22 
23 class ‪PageLayoutResolverTest extends UnitTestCase
24 {
29  {
30  $subject = new ‪PageLayoutResolver();
31  $result = $subject->getLayoutForPage(['backend_layout' => '1'], ['does-not-matter']);
32  self::assertEquals($result, '1');
33  }
34 
39  {
40  $subject = new ‪PageLayoutResolver();
41  $result = $subject->getLayoutForPage(['backend_layout' => '-1'], ['does-not-matter']);
42  self::assertEquals($result, 'none');
43  }
44 
49  {
50  $subject = new ‪PageLayoutResolver();
51  $parentPages = [['backend_layout' => '']];
52  $page = ['backend_layout' => '0'];
53  $result = $subject->getLayoutForPage($page, array_merge([$page], $parentPages));
54  self::assertEquals($result, 'default');
55  $page = ['backend_layout' => ''];
56  $result = $subject->getLayoutForPage($page, array_merge([$page], $parentPages));
57  self::assertEquals($result, 'default');
58  }
59 
64  {
65  $subject = new ‪PageLayoutResolver();
66  // No layout specified for current page
67  $page = ['backend_layout' => ''];
68  $parentPages = [['uid' => 13, 'backend_layout' => 'does-not-matter'], ['uid' => 1, 'backend_layout_next_level' => '0']];
69  $result = $subject->getLayoutForPage($page, array_merge([$page], $parentPages));
70  self::assertEquals($result, 'default');
71  }
72 
77  {
78  $subject = new ‪PageLayoutResolver();
79  // No layout specified for current page
80  $page = ['backend_layout' => ''];
81  $parentPages = [['uid' => 13, 'backend_layout' => 'does-not-matter', 'backend_layout_next_level' => ''], ['uid' => 1, 'backend_layout_next_level' => 'regular']];
82  $result = $subject->getLayoutForPage($page, array_merge([$page], $parentPages));
83  self::assertEquals($result, 'regular');
84  }
85 
90  {
91  $subject = new ‪PageLayoutResolver();
92  // No layout specified for current page
93  $page = ['backend_layout' => ''];
94  $parentPages = [['uid' => 13, 'backend_layout' => 'does-not-matter'], ['uid' => 15, 'backend_layout_next_level' => '-1'], ['uid' => 1, 'backend_layout_next_level' => 'regular']];
95  $result = $subject->getLayoutForPage($page, array_merge([$page], $parentPages));
96  self::assertEquals($result, 'none');
97  }
98 }
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageLayoutResolverTest\getLayoutForPageFetchesSelectedPageDirectly
‪getLayoutForPageFetchesSelectedPageDirectly()
Definition: PageLayoutResolverTest.php:28
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageLayoutResolverTest
Definition: PageLayoutResolverTest.php:24
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageLayoutResolverTest\getLayoutForPageFetchesRootLinePagesUpUntilSomethingWasFound
‪getLayoutForPageFetchesRootLinePagesUpUntilSomethingWasFound()
Definition: PageLayoutResolverTest.php:76
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageLayoutResolverTest\getLayoutForPageTreatsSpecialValueZeroOrEmptyAsDefaultWithEmptyRootLine
‪getLayoutForPageTreatsSpecialValueZeroOrEmptyAsDefaultWithEmptyRootLine()
Definition: PageLayoutResolverTest.php:48
‪TYPO3\CMS\Frontend\Tests\Unit\Page
Definition: CacheHashCalculatorTest.php:18
‪TYPO3\CMS\Frontend\Page\PageLayoutResolver
Definition: PageLayoutResolver.php:32
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageLayoutResolverTest\getLayoutForPageFetchesRootLinePagesUpWhenNoneWasSelectedExplicitly
‪getLayoutForPageFetchesRootLinePagesUpWhenNoneWasSelectedExplicitly()
Definition: PageLayoutResolverTest.php:89
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageLayoutResolverTest\getLayoutForPageTreatsSpecialValueZeroOrEmptyAsDefaultWhenNothingGivenInRootLine
‪getLayoutForPageTreatsSpecialValueZeroOrEmptyAsDefaultWhenNothingGivenInRootLine()
Definition: PageLayoutResolverTest.php:63
‪TYPO3\CMS\Frontend\Tests\Unit\Page\PageLayoutResolverTest\getLayoutForPageTreatsSpecialMinusOneValueAsNone
‪getLayoutForPageTreatsSpecialMinusOneValueAsNone()
Definition: PageLayoutResolverTest.php:38