‪TYPO3CMS  9.5
BackendLayoutViewTest.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
17 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
18 
22 class ‪BackendLayoutViewTest extends UnitTestCase
23 {
27  protected ‪$backendLayoutView;
28 
32  protected function ‪setUp()
33  {
34  $this->backendLayoutView = $this->getAccessibleMock(
35  \‪TYPO3\CMS\Backend\View\BackendLayoutView::class,
36  ['getPage', 'getRootLine'],
37  [],
38  '',
39  false
40  );
41  }
42 
50  public function ‪selectedCombinedIdentifierIsDetermined($expected, array $page, array $rootLine)
51  {
52  $pageId = $page['uid'];
53 
54  $this->backendLayoutView->expects($this->once())
55  ->method('getPage')->with($this->equalTo($pageId))
56  ->will($this->returnValue($page));
57  $this->backendLayoutView->expects($this->any())
58  ->method('getRootLine')->with($this->equalTo($pageId))
59  ->will($this->returnValue($rootLine));
60 
61  $selectedCombinedIdentifier = $this->backendLayoutView->_call('getSelectedCombinedIdentifier', $pageId);
62  $this->assertEquals($expected, $selectedCombinedIdentifier);
63  }
64 
69  {
70  return [
71  'first level w/o layout' => [
72  '0',
73  ['uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '0'],
74  [
75  ['uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '0'],
76  ['uid' => 0, 'pid' => null],
77  ]
78  ],
79  'first level with layout' => [
80  '1',
81  ['uid' => 1, 'pid' => 0, 'backend_layout' => '1', 'backend_layout_next_level' => '0'],
82  [
83  ['uid' => 1, 'pid' => 0, 'backend_layout' => '1', 'backend_layout_next_level' => '0'],
84  ['uid' => 0, 'pid' => null],
85  ]
86  ],
87  'first level with provided layout' => [
88  'mine_current',
89  ['uid' => 1, 'pid' => 0, 'backend_layout' => 'mine_current', 'backend_layout_next_level' => '0'],
90  [
91  ['uid' => 1, 'pid' => 0, 'backend_layout' => 'mine_current', 'backend_layout_next_level' => '0'],
92  ['uid' => 0, 'pid' => null],
93  ]
94  ],
95  'first level with next layout' => [
96  '0',
97  ['uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'],
98  [
99  ['uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'],
100  ['uid' => 0, 'pid' => null],
101  ]
102  ],
103  'first level with provided next layout' => [
104  '0',
105  ['uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => 'mine_next'],
106  [
107  ['uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => 'mine_next'],
108  ['uid' => 0, 'pid' => null],
109  ]
110  ],
111  'second level w/o layout, first level with layout' => [
112  '0',
113  ['uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '0'],
114  [
115  ['uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '0'],
116  ['uid' => 1, 'pid' => 0, 'backend_layout' => '1', 'backend_layout_next_level' => '0'],
117  ['uid' => 0, 'pid' => null],
118  ]
119  ],
120  'second level w/o layout, first level with next layout' => [
121  '1',
122  ['uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '0'],
123  [
124  ['uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '0'],
125  ['uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'],
126  ['uid' => 0, 'pid' => null],
127  ]
128  ],
129  'second level with layout, first level with next layout' => [
130  '2',
131  ['uid' => 2, 'pid' => 1, 'backend_layout' => '2', 'backend_layout_next_level' => '0'],
132  [
133  ['uid' => 2, 'pid' => 1, 'backend_layout' => '2', 'backend_layout_next_level' => '0'],
134  ['uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'],
135  ['uid' => 0, 'pid' => null],
136  ]
137  ],
138  'second level with layouts, first level resetting all layouts' => [
139  '1',
140  ['uid' => 2, 'pid' => 1, 'backend_layout' => '1', 'backend_layout_next_level' => '1'],
141  [
142  ['uid' => 2, 'pid' => 1, 'backend_layout' => '1', 'backend_layout_next_level' => '1'],
143  ['uid' => 1, 'pid' => 0, 'backend_layout' => '-1', 'backend_layout_next_level' => '-1'],
144  ['uid' => 0, 'pid' => null],
145  ]
146  ],
147  'second level with provided layouts, first level resetting all layouts' => [
148  'mine_current',
149  ['uid' => 2, 'pid' => 1, 'backend_layout' => 'mine_current', 'backend_layout_next_level' => 'mine_next'],
150  [
151  ['uid' => 2, 'pid' => 1, 'backend_layout' => 'mine_current', 'backend_layout_next_level' => 'mine_next'],
152  ['uid' => 1, 'pid' => 0, 'backend_layout' => '-1', 'backend_layout_next_level' => '-1'],
153  ['uid' => 0, 'pid' => null],
154  ]
155  ],
156  'second level resetting layout, first level with next layout' => [
157  false,
158  ['uid' => 2, 'pid' => 1, 'backend_layout' => '-1', 'backend_layout_next_level' => '0'],
159  [
160  ['uid' => 2, 'pid' => 1, 'backend_layout' => '-1', 'backend_layout_next_level' => '0'],
161  ['uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'],
162  ['uid' => 0, 'pid' => null],
163  ]
164  ],
165  'second level resetting next layout, first level with next layout' => [
166  '1',
167  ['uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '-1'],
168  [
169  ['uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '-1'],
170  ['uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'],
171  ['uid' => 0, 'pid' => null],
172  ]
173  ],
174  'third level w/o layout, second level resetting layout, first level with next layout' => [
175  '1',
176  ['uid' => 3, 'pid' => 2, 'backend_layout' => '0', 'backend_layout_next_level' => '0'],
177  [
178  ['uid' => 3, 'pid' => 2, 'backend_layout' => '0', 'backend_layout_next_level' => '0'],
179  ['uid' => 2, 'pid' => 1, 'backend_layout' => '-1', 'backend_layout_next_level' => '0'],
180  ['uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'],
181  ['uid' => 0, 'pid' => null],
182  ]
183  ],
184  'third level w/o layout, second level resetting next layout, first level with next layout' => [
185  false,
186  ['uid' => 3, 'pid' => 2, 'backend_layout' => '0', 'backend_layout_next_level' => '0'],
187  [
188  ['uid' => 3, 'pid' => 2, 'backend_layout' => '0', 'backend_layout_next_level' => '0'],
189  ['uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '-1'],
190  ['uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'],
191  ['uid' => 0, 'pid' => null],
192  ]
193  ],
194  'third level with provided layouts, second level w/o layout, first level resetting layouts' => [
195  'mine_current',
196  ['uid' => 3, 'pid' => 2, 'backend_layout' => 'mine_current', 'backend_layout_next_level' => 'mine_next'],
197  [
198  ['uid' => 3, 'pid' => 2, 'backend_layout' => 'mine_current', 'backend_layout_next_level' => 'mine_next'],
199  ['uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '0'],
200  ['uid' => 1, 'pid' => 0, 'backend_layout' => '-1', 'backend_layout_next_level' => '-1'],
201  ['uid' => 0, 'pid' => null],
202  ]
203  ],
204  ];
205  }
206 }
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayoutViewTest\selectedCombinedIdentifierIsDeterminedDataProvider
‪array selectedCombinedIdentifierIsDeterminedDataProvider()
Definition: BackendLayoutViewTest.php:67
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayoutViewTest\$backendLayoutView
‪TYPO3 CMS Backend View BackendLayoutView PHPUnit_Framework_MockObject_MockObject $backendLayoutView
Definition: BackendLayoutViewTest.php:26
‪TYPO3
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayoutViewTest
Definition: BackendLayoutViewTest.php:23
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayoutViewTest\selectedCombinedIdentifierIsDetermined
‪selectedCombinedIdentifierIsDetermined($expected, array $page, array $rootLine)
Definition: BackendLayoutViewTest.php:49
‪TYPO3\CMS\Backend\Tests\Unit\View\BackendLayoutViewTest\setUp
‪setUp()
Definition: BackendLayoutViewTest.php:31
‪TYPO3\CMS\Backend\Tests\Unit\View