‪TYPO3CMS  9.5
AbstractDatabaseRecordListTest.php
Go to the documentation of this file.
1 <?php
2 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 
21 use TYPO3\TestingFramework\Core\AccessibleObjectInterface;
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
27 class ‪AbstractDatabaseRecordListTest extends UnitTestCase
28 {
35  public function ‪setTableDisplayOrderConvertsStringInput(array $input, array $expected): void
36  {
38  $subject = $this->getAccessibleMock(AbstractDatabaseRecordList::class, ['dummy'], [], '', false);
39  $subject->setTableDisplayOrder($input);
40  $this->assertSame($expected, $subject->_get('tableDisplayOrder'));
41  }
42 
47  {
48  return [
49  'no information at all' => [
50  [],
51  []
52  ],
53  'string in before' => [
54  [
55  'tableA' => [
56  'before' => 'tableB, tableC'
57  ]
58  ],
59  [
60  'tableA' => [
61  'before' => ['tableB', 'tableC']
62  ]
63  ]
64  ],
65  'array is preserved in before' => [
66  [
67  'tableA' => [
68  'before' => ['tableB', 'tableC']
69  ]
70  ],
71  [
72  'tableA' => [
73  'before' => ['tableB', 'tableC']
74  ]
75  ]
76  ],
77  'array is preserved in before, after is modified' => [
78  [
79  'tableA' => [
80  'before' => ['tableB', 'tableC'],
81  'after' => 'tableD'
82  ]
83  ],
84  [
85  'tableA' => [
86  'before' => ['tableB', 'tableC'],
87  'after' => ['tableD']
88  ]
89  ]
90  ],
91  ];
92  }
93 
98  {
99  $iconFactoryProphecy = $this->prophesize(IconFactory::class);
100  GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
101 
102  $this->expectException(\UnexpectedValueException::class);
103  $this->expectExceptionCode(1436195934);
104  $test = [
105  'table' => [ 'after' => new \stdClass ]
106  ];
107  $subject = new ‪AbstractDatabaseRecordList();
108  $subject->setTableDisplayOrder($test);
109  }
110 
115  {
116  $iconFactoryProphecy = $this->prophesize(IconFactory::class);
117  GeneralUtility::addInstance(IconFactory::class, $iconFactoryProphecy->reveal());
118 
119  $this->expectException(\UnexpectedValueException::class);
120  $this->expectExceptionCode(1436195933);
121  $test = [
122  'table' => [ 'before' => new \stdClass ]
123  ];
124  $subject = new ‪AbstractDatabaseRecordList();
125  $subject->setTableDisplayOrder($test);
126  }
127 }
‪TYPO3\CMS\Recordlist\Tests\UnitDeprecated\RecordList
Definition: AbstractDatabaseRecordListTest.php:3
‪TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRecordList
Definition: AbstractDatabaseRecordList.php:46
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:31
‪TYPO3\CMS\Recordlist\Tests\UnitDeprecated\RecordList\AbstractDatabaseRecordListTest\setTableDisplayOrderThrowsExceptionOnInvalidAfter
‪setTableDisplayOrderThrowsExceptionOnInvalidAfter()
Definition: AbstractDatabaseRecordListTest.php:97
‪TYPO3\CMS\Recordlist\Tests\UnitDeprecated\RecordList\AbstractDatabaseRecordListTest
Definition: AbstractDatabaseRecordListTest.php:28
‪TYPO3\CMS\Recordlist\Tests\UnitDeprecated\RecordList\AbstractDatabaseRecordListTest\setTableDisplayOrderThrowsExceptionOnInvalidBefore
‪setTableDisplayOrderThrowsExceptionOnInvalidBefore()
Definition: AbstractDatabaseRecordListTest.php:114
‪TYPO3\CMS\Recordlist\Tests\UnitDeprecated\RecordList\AbstractDatabaseRecordListTest\setTableDisplayOrderConvertsStringsDataProvider
‪array setTableDisplayOrderConvertsStringsDataProvider()
Definition: AbstractDatabaseRecordListTest.php:46
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Recordlist\Tests\UnitDeprecated\RecordList\AbstractDatabaseRecordListTest\setTableDisplayOrderConvertsStringInput
‪setTableDisplayOrderConvertsStringInput(array $input, array $expected)
Definition: AbstractDatabaseRecordListTest.php:35