TYPO3 CMS  TYPO3_8-7
FormEngineUtilityTest.php
Go to the documentation of this file.
1 <?php
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 
18 
22 class FormEngineUtilityTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase
23 {
28  {
29  $input = [
30  'uid' => 42,
31  'title' => 'aTitle',
32  ];
33  $expected = $input;
34  $this->assertEquals($expected, FormEngineUtility::databaseRowCompatibility($input));
35  }
36 
41  {
42  $input = [
43  'uid' => 42,
44  'simpleArray' => [
45  0 => 1,
46  1 => 2,
47  ],
48  ];
49  $expected = $input;
50  $expected['simpleArray'] = '1,2';
51  $this->assertEquals($expected, FormEngineUtility::databaseRowCompatibility($input));
52  }
53 
58  {
59  $input = [
60  'uid' => 42,
61  'simpleArray' => [
62  0 => [
63  0 => 'aLabel',
64  1 => 'aValue',
65  ],
66  1 => [
67  0 => 'anotherLabel',
68  1 => 'anotherValue',
69  ],
70  ],
71  ];
72  $expected = $input;
73  $expected['simpleArray'] = 'aValue,anotherValue';
74  $this->assertEquals($expected, FormEngineUtility::databaseRowCompatibility($input));
75  }
76 }