TYPO3  7.6
AbstractDatabaseRecordListTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Recordlist\Tests\Unit\RecordList;
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\CMS\Core\Tests\UnitTestCase;
18 use TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList;
19 
23 class AbstractDatabaseRecordListTest extends UnitTestCase
24 {
31  public function setTableDisplayOrderConvertsStringInput(array $input, array $expected)
32  {
34  $subject = $this->getAccessibleMock(AbstractDatabaseRecordList::class, ['dummy']);
35  $subject->setTableDisplayOrder($input);
36  $this->assertSame($expected, $subject->_get('tableDisplayOrder'));
37  }
38 
43  {
44  return [
45  'no information at all' => [
46  [],
47  []
48  ],
49  'string in before' => [
50  [
51  'tableA' => [
52  'before' => 'tableB, tableC'
53  ]
54  ],
55  [
56  'tableA' => [
57  'before' => ['tableB', 'tableC']
58  ]
59  ]
60  ],
61  'array is preserved in before' => [
62  [
63  'tableA' => [
64  'before' => ['tableB', 'tableC']
65  ]
66  ],
67  [
68  'tableA' => [
69  'before' => ['tableB', 'tableC']
70  ]
71  ]
72  ],
73  'array is preserved in before, after is modified' => [
74  [
75  'tableA' => [
76  'before' => ['tableB', 'tableC'],
77  'after' => 'tableD'
78  ]
79  ],
80  [
81  'tableA' => [
82  'before' => ['tableB', 'tableC'],
83  'after' => ['tableD']
84  ]
85  ]
86  ],
87  ];
88  }
89 
96  {
97  $test = [
98  'table' => [ 'after' => new \stdClass ]
99  ];
100  $subject = new AbstractDatabaseRecordList();
101  $subject->setTableDisplayOrder($test);
102  }
103 
104 
111  {
112  $test = [
113  'table' => [ 'before' => new \stdClass ]
114  ];
115  $subject = new AbstractDatabaseRecordList();
116  $subject->setTableDisplayOrder($test);
117  }
118 }