TYPO3 CMS  TYPO3_6-2
BackendLayoutViewTest.php
Go to the documentation of this file.
1 <?php
3 
23 
27  protected $backendLayoutView;
28 
32  protected function setUp() {
33  $this->backendLayoutView = $this->getAccessibleMock(
34  'TYPO3\\CMS\\Backend\\View\\BackendLayoutView',
35  array('getPage', 'getRootLine'),
36  array(), '', FALSE
37  );
38  }
39 
47  public function selectedCombinedIdentifierIsDetermined($expected, array $page, array $rootLine) {
48  $pageId = $page['uid'];
49 
50  $this->backendLayoutView->expects($this->once())
51  ->method('getPage')->with($this->equalTo($pageId))
52  ->will($this->returnValue($page));
53  $this->backendLayoutView->expects($this->any())
54  ->method('getRootLine')->with($this->equalTo($pageId))
55  ->will($this->returnValue($rootLine));
56 
57  $selectedCombinedIdentifier = $this->backendLayoutView->_call('getSelectedCombinedIdentifier', $pageId);
58  $this->assertEquals($expected, $selectedCombinedIdentifier);
59  }
60 
65  return array(
66  'first level w/o layout' => array(
67  '0',
68  array('uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '0'),
69  array(
70  array('uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '0'),
71  array('uid' => 0, 'pid' => NULL,),
72  )
73  ),
74  'first level with layout' => array(
75  '1',
76  array('uid' => 1, 'pid' => 0, 'backend_layout' => '1', 'backend_layout_next_level' => '0'),
77  array(
78  array('uid' => 1, 'pid' => 0, 'backend_layout' => '1', 'backend_layout_next_level' => '0'),
79  array('uid' => 0, 'pid' => NULL,),
80  )
81  ),
82  'first level with provided layout' => array(
83  'mine_current',
84  array('uid' => 1, 'pid' => 0, 'backend_layout' => 'mine_current', 'backend_layout_next_level' => '0'),
85  array(
86  array('uid' => 1, 'pid' => 0, 'backend_layout' => 'mine_current', 'backend_layout_next_level' => '0'),
87  array('uid' => 0, 'pid' => NULL,),
88  )
89  ),
90  'first level with next layout' => array(
91  '0',
92  array('uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'),
93  array(
94  array('uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'),
95  array('uid' => 0, 'pid' => NULL,),
96  )
97  ),
98  'first level with provided next layout' => array(
99  '0',
100  array('uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => 'mine_next'),
101  array(
102  array('uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => 'mine_next'),
103  array('uid' => 0, 'pid' => NULL,),
104  )
105  ),
106  'second level w/o layout, first level with layout' => array(
107  '0',
108  array('uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '0'),
109  array(
110  array('uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '0'),
111  array('uid' => 1, 'pid' => 0, 'backend_layout' => '1', 'backend_layout_next_level' => '0'),
112  array('uid' => 0, 'pid' => NULL,),
113  )
114  ),
115  'second level w/o layout, first level with next layout' => array(
116  '1',
117  array('uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '0'),
118  array(
119  array('uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '0'),
120  array('uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'),
121  array('uid' => 0, 'pid' => NULL,),
122  )
123  ),
124  'second level with layout, first level with next layout' => array(
125  '2',
126  array('uid' => 2, 'pid' => 1, 'backend_layout' => '2', 'backend_layout_next_level' => '0'),
127  array(
128  array('uid' => 2, 'pid' => 1, 'backend_layout' => '2', 'backend_layout_next_level' => '0'),
129  array('uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'),
130  array('uid' => 0, 'pid' => NULL,),
131  )
132  ),
133  'second level with layouts, first level resetting all layouts' => array(
134  '1',
135  array('uid' => 2, 'pid' => 1, 'backend_layout' => '1', 'backend_layout_next_level' => '1'),
136  array(
137  array('uid' => 2, 'pid' => 1, 'backend_layout' => '1', 'backend_layout_next_level' => '1'),
138  array('uid' => 1, 'pid' => 0, 'backend_layout' => '-1', 'backend_layout_next_level' => '-1'),
139  array('uid' => 0, 'pid' => NULL,),
140  )
141  ),
142  'second level with provided layouts, first level resetting all layouts' => array(
143  'mine_current',
144  array('uid' => 2, 'pid' => 1, 'backend_layout' => 'mine_current', 'backend_layout_next_level' => 'mine_next'),
145  array(
146  array('uid' => 2, 'pid' => 1, 'backend_layout' => 'mine_current', 'backend_layout_next_level' => 'mine_next'),
147  array('uid' => 1, 'pid' => 0, 'backend_layout' => '-1', 'backend_layout_next_level' => '-1'),
148  array('uid' => 0, 'pid' => NULL,),
149  )
150  ),
151  'second level resetting layout, first level with next layout' => array(
152  FALSE,
153  array('uid' => 2, 'pid' => 1, 'backend_layout' => '-1', 'backend_layout_next_level' => '0'),
154  array(
155  array('uid' => 2, 'pid' => 1, 'backend_layout' => '-1', 'backend_layout_next_level' => '0'),
156  array('uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'),
157  array('uid' => 0, 'pid' => NULL,),
158  )
159  ),
160  'second level resetting next layout, first level with next layout' => array(
161  '1',
162  array('uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '-1'),
163  array(
164  array('uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '-1'),
165  array('uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'),
166  array('uid' => 0, 'pid' => NULL,),
167  )
168  ),
169  'third level w/o layout, second level resetting layout, first level with next layout' => array(
170  '1',
171  array('uid' => 3, 'pid' => 2, 'backend_layout' => '0', 'backend_layout_next_level' => '0'),
172  array(
173  array('uid' => 3, 'pid' => 2, 'backend_layout' => '0', 'backend_layout_next_level' => '0'),
174  array('uid' => 2, 'pid' => 1, 'backend_layout' => '-1', 'backend_layout_next_level' => '0'),
175  array('uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'),
176  array('uid' => 0, 'pid' => NULL,),
177  )
178  ),
179  'third level w/o layout, second level resetting next layout, first level with next layout' => array(
180  FALSE,
181  array('uid' => 3, 'pid' => 2, 'backend_layout' => '0', 'backend_layout_next_level' => '0'),
182  array(
183  array('uid' => 3, 'pid' => 2, 'backend_layout' => '0', 'backend_layout_next_level' => '0'),
184  array('uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '-1'),
185  array('uid' => 1, 'pid' => 0, 'backend_layout' => '0', 'backend_layout_next_level' => '1'),
186  array('uid' => 0, 'pid' => NULL,),
187  )
188  ),
189  'third level with provided layouts, second level w/o layout, first level resetting layouts' => array(
190  'mine_current',
191  array('uid' => 3, 'pid' => 2, 'backend_layout' => 'mine_current', 'backend_layout_next_level' => 'mine_next'),
192  array(
193  array('uid' => 3, 'pid' => 2, 'backend_layout' => 'mine_current', 'backend_layout_next_level' => 'mine_next'),
194  array('uid' => 2, 'pid' => 1, 'backend_layout' => '0', 'backend_layout_next_level' => '0'),
195  array('uid' => 1, 'pid' => 0, 'backend_layout' => '-1', 'backend_layout_next_level' => '-1'),
196  array('uid' => 0, 'pid' => NULL,),
197  )
198  ),
199  );
200  }
201 
202 }
selectedCombinedIdentifierIsDetermined($expected, array $page, array $rootLine)
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)