[TASK] FormEngine inline refactoring
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Tests / Unit / Form / FormDataProvider / TcaInlineExpandCollapseStateTest.php
1 <?php
2 namespace TYPO3\CMS\Backend\Tests\Unit\Form\FormDataProvider;
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\Backend\Form\FormDataProvider\TcaInlineExpandCollapseState;
19
20 /**
21 * Test case
22 */
23 class TcaInlineExpandCollapseStateTest extends UnitTestCase {
24
25 /**
26 * @var TcaInlineExpandCollapseState
27 */
28 protected $subject;
29
30 protected function setUp() {
31 $this->subject = new TcaInlineExpandCollapseState();
32 }
33
34 /**
35 * @test
36 */
37 public function addDataAddsInlineStatusForTableUid() {
38 $input = [
39 'command' => 'edit',
40 'tableName' => 'aParentTable',
41 'databaseRow' => [
42 'uid' => 5,
43 ],
44 ];
45 $inlineState = [
46 'aParentTable' => [
47 5 => [
48 'aChildTable' => [
49 // Records 23 and 42 are expanded
50 23,
51 42,
52 ],
53 ],
54 ],
55 ];
56 $GLOBALS['BE_USER'] = new \stdClass();
57 $GLOBALS['BE_USER']->uc = [
58 'inlineView' => serialize($inlineState),
59 ];
60 $expected = $input;
61 $expected['inlineExpandCollapseStateArray'] = $inlineState['aParentTable'][5];
62 $this->assertSame($expected, $this->subject->addData($input));
63 }
64
65 }