@@ -222,4 +222,172 @@ public function copyContainerKeepsSortingOfChildren(): void
222222 $ container = $ this ->fetchOneRecord ('uid ' , 1 );
223223 self ::assertTrue ($ child ['sorting ' ] > $ container ['sorting ' ], 'moved child is sorted before container ' );
224224 }
225+
226+ /**
227+ * @test
228+ */
229+ public function moveContainerOtherPageOnTop (): void
230+ {
231+ $ this ->importCSVDataSet (ORIGINAL_ROOT . 'typo3conf/ext/container/Tests/Functional/Datahandler/DefaultLanguage/Fixtures/Container/move_or_copy_container_other_page.csv ' );
232+ $ cmdmap = [
233+ 'tt_content ' => [
234+ 1 => [
235+ 'move ' => 3 ,
236+ ],
237+ ],
238+ ];
239+ $ this ->dataHandler ->start ([], $ cmdmap , $ this ->backendUser );
240+ $ this ->dataHandler ->process_cmdmap ();
241+ $ container = $ this ->fetchOneRecord ('uid ' , 1 );
242+ $ col1First = $ this ->fetchOneRecord ('uid ' , 2 );
243+ $ col1Second = $ this ->fetchOneRecord ('uid ' , 3 );
244+ $ col12First = $ this ->fetchOneRecord ('uid ' , 4 );
245+ $ outside = $ this ->fetchOneRecord ('uid ' , 10 );
246+ // pid 3 for container and all children
247+ self ::assertSame (3 , $ container ['pid ' ]);
248+ self ::assertSame (3 , $ col1First ['pid ' ]);
249+ self ::assertSame (3 , $ col1Second ['pid ' ]);
250+ self ::assertSame (3 , $ col12First ['pid ' ]);
251+ // all children are still in container
252+ self ::assertSame ($ container ['uid ' ], $ col1First ['tx_container_parent ' ]);
253+ self ::assertSame ($ container ['uid ' ], $ col1Second ['tx_container_parent ' ]);
254+ self ::assertSame ($ container ['uid ' ], $ col12First ['tx_container_parent ' ]);
255+ // all children keeps colPos
256+ self ::assertSame (200 , $ col1First ['colPos ' ]);
257+ self ::assertSame (200 , $ col1Second ['colPos ' ]);
258+ self ::assertSame (201 , $ col12First ['colPos ' ]);
259+ // sorting 1,2,3,4,10
260+ self ::assertTrue ($ container ['sorting ' ] < $ col1First ['sorting ' ]);
261+ self ::assertTrue ($ col1First ['sorting ' ] < $ col1Second ['sorting ' ]);
262+ self ::assertTrue ($ col1Second ['sorting ' ] < $ col12First ['sorting ' ]);
263+ self ::assertTrue ($ col12First ['sorting ' ] < $ outside ['sorting ' ]);
264+ }
265+
266+ /**
267+ * @test
268+ */
269+ public function moveContainerOtherPageAfterElement (): void
270+ {
271+ $ this ->importCSVDataSet (ORIGINAL_ROOT . 'typo3conf/ext/container/Tests/Functional/Datahandler/DefaultLanguage/Fixtures/Container/move_or_copy_container_other_page.csv ' );
272+ $ cmdmap = [
273+ 'tt_content ' => [
274+ 1 => [
275+ 'move ' => -10 ,
276+ ],
277+ ],
278+ ];
279+ $ this ->dataHandler ->start ([], $ cmdmap , $ this ->backendUser );
280+ $ this ->dataHandler ->process_cmdmap ();
281+ $ container = $ this ->fetchOneRecord ('uid ' , 1 );
282+ $ col1First = $ this ->fetchOneRecord ('uid ' , 2 );
283+ $ col1Second = $ this ->fetchOneRecord ('uid ' , 3 );
284+ $ col12First = $ this ->fetchOneRecord ('uid ' , 4 );
285+ $ outside = $ this ->fetchOneRecord ('uid ' , 10 );
286+ // pid 3 for container and all children
287+ self ::assertSame (3 , $ container ['pid ' ]);
288+ self ::assertSame (3 , $ col1First ['pid ' ]);
289+ self ::assertSame (3 , $ col1Second ['pid ' ]);
290+ self ::assertSame (3 , $ col12First ['pid ' ]);
291+ // all children are still in container
292+ self ::assertSame ($ container ['uid ' ], $ col1First ['tx_container_parent ' ]);
293+ self ::assertSame ($ container ['uid ' ], $ col1Second ['tx_container_parent ' ]);
294+ self ::assertSame ($ container ['uid ' ], $ col12First ['tx_container_parent ' ]);
295+ // all children keeps colPos
296+ self ::assertSame (200 , $ col1First ['colPos ' ]);
297+ self ::assertSame (200 , $ col1Second ['colPos ' ]);
298+ self ::assertSame (201 , $ col12First ['colPos ' ]);
299+ // sorting 10,1,2,3,4
300+ self ::assertTrue ($ outside ['sorting ' ] < $ container ['sorting ' ]);
301+ self ::assertTrue ($ container ['sorting ' ] < $ col1First ['sorting ' ]);
302+ self ::assertTrue ($ col1First ['sorting ' ] < $ col1Second ['sorting ' ]);
303+ self ::assertTrue ($ col1Second ['sorting ' ] < $ col12First ['sorting ' ]);
304+ }
305+
306+ /**
307+ * @test
308+ */
309+ public function copyContainerOtherPageOnTop (): void
310+ {
311+ $ this ->importCSVDataSet (ORIGINAL_ROOT . 'typo3conf/ext/container/Tests/Functional/Datahandler/DefaultLanguage/Fixtures/Container/move_or_copy_container_other_page.csv ' );
312+ $ cmdmap = [
313+ 'tt_content ' => [
314+ 1 => [
315+ 'copy ' => [
316+ 'action ' => 'paste ' ,
317+ 'target ' => 3 ,
318+ 'update ' => [],
319+ ],
320+ ],
321+ ],
322+ ];
323+ $ this ->dataHandler ->start ([], $ cmdmap , $ this ->backendUser );
324+ $ this ->dataHandler ->process_cmdmap ();
325+ $ container = $ this ->fetchOneRecord ('t3_origuid ' , 1 );
326+ $ col1First = $ this ->fetchOneRecord ('t3_origuid ' , 2 );
327+ $ col1Second = $ this ->fetchOneRecord ('t3_origuid ' , 3 );
328+ $ col12First = $ this ->fetchOneRecord ('t3_origuid ' , 4 );
329+ $ outside = $ this ->fetchOneRecord ('uid ' , 10 );
330+ // pid 3 for container and all children
331+ self ::assertSame (3 , $ container ['pid ' ]);
332+ self ::assertSame (3 , $ col1First ['pid ' ]);
333+ self ::assertSame (3 , $ col1Second ['pid ' ]);
334+ self ::assertSame (3 , $ col12First ['pid ' ]);
335+ // container parent $container['uid'] for all children
336+ self ::assertSame ($ container ['uid ' ], $ col1First ['tx_container_parent ' ]);
337+ self ::assertSame ($ container ['uid ' ], $ col1Second ['tx_container_parent ' ]);
338+ self ::assertSame ($ container ['uid ' ], $ col12First ['tx_container_parent ' ]);
339+ // all children keeps colPos
340+ self ::assertSame (200 , $ col1First ['colPos ' ]);
341+ self ::assertSame (200 , $ col1Second ['colPos ' ]);
342+ self ::assertSame (201 , $ col12First ['colPos ' ]);
343+ // sorting 1,2,3,4,10
344+ self ::assertTrue ($ container ['sorting ' ] < $ col1First ['sorting ' ]);
345+ self ::assertTrue ($ col1First ['sorting ' ] < $ col1Second ['sorting ' ]);
346+ self ::assertTrue ($ col1Second ['sorting ' ] < $ col12First ['sorting ' ]);
347+ self ::assertTrue ($ col12First ['sorting ' ] < $ outside ['sorting ' ]);
348+ }
349+
350+ /**
351+ * @test
352+ */
353+ public function copyContainerOtherPageAfterElement (): void
354+ {
355+ $ this ->importCSVDataSet (ORIGINAL_ROOT . 'typo3conf/ext/container/Tests/Functional/Datahandler/DefaultLanguage/Fixtures/Container/move_or_copy_container_other_page.csv ' );
356+ $ cmdmap = [
357+ 'tt_content ' => [
358+ 1 => [
359+ 'copy ' => [
360+ 'action ' => 'paste ' ,
361+ 'target ' => -10 ,
362+ 'update ' => [],
363+ ],
364+ ],
365+ ],
366+ ];
367+ $ this ->dataHandler ->start ([], $ cmdmap , $ this ->backendUser );
368+ $ this ->dataHandler ->process_cmdmap ();
369+ $ container = $ this ->fetchOneRecord ('t3_origuid ' , 1 );
370+ $ col1First = $ this ->fetchOneRecord ('t3_origuid ' , 2 );
371+ $ col1Second = $ this ->fetchOneRecord ('t3_origuid ' , 3 );
372+ $ col12First = $ this ->fetchOneRecord ('t3_origuid ' , 4 );
373+ $ outside = $ this ->fetchOneRecord ('uid ' , 10 );
374+ // pid 3 for container and all children
375+ self ::assertSame (3 , $ container ['pid ' ]);
376+ self ::assertSame (3 , $ col1First ['pid ' ]);
377+ self ::assertSame (3 , $ col1Second ['pid ' ]);
378+ self ::assertSame (3 , $ col12First ['pid ' ]);
379+ // container parent $container['uid'] for all children
380+ self ::assertSame ($ container ['uid ' ], $ col1First ['tx_container_parent ' ]);
381+ self ::assertSame ($ container ['uid ' ], $ col1Second ['tx_container_parent ' ]);
382+ self ::assertSame ($ container ['uid ' ], $ col12First ['tx_container_parent ' ]);
383+ // all children keeps colPos
384+ self ::assertSame (200 , $ col1First ['colPos ' ]);
385+ self ::assertSame (200 , $ col1Second ['colPos ' ]);
386+ self ::assertSame (201 , $ col12First ['colPos ' ]);
387+ // sorting 10,1,2,3,4
388+ self ::assertTrue ($ outside ['sorting ' ] < $ container ['sorting ' ]);
389+ self ::assertTrue ($ container ['sorting ' ] < $ col1First ['sorting ' ]);
390+ self ::assertTrue ($ col1First ['sorting ' ] < $ col1Second ['sorting ' ]);
391+ self ::assertTrue ($ col1Second ['sorting ' ] < $ col12First ['sorting ' ]);
392+ }
225393}
0 commit comments