‪TYPO3CMS  10.4
FormEngineUtilityTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
20 
24 class ‪FormEngineUtilityTest extends UnitTestCase
25 {
30  {
31  $input = [
32  'uid' => 42,
33  'title' => 'aTitle',
34  ];
35  $expected = $input;
36  self::assertEquals($expected, ‪FormEngineUtility::databaseRowCompatibility($input));
37  }
38 
43  {
44  $input = [
45  'uid' => 42,
46  'simpleArray' => [
47  0 => 1,
48  1 => 2,
49  ],
50  ];
51  $expected = $input;
52  $expected['simpleArray'] = '1,2';
53  self::assertEquals($expected, ‪FormEngineUtility::databaseRowCompatibility($input));
54  }
55 
60  {
61  $input = [
62  'uid' => 42,
63  'simpleArray' => [
64  0 => [
65  0 => 'aLabel',
66  1 => 'aValue',
67  ],
68  1 => [
69  0 => 'anotherLabel',
70  1 => 'anotherValue',
71  ],
72  ],
73  ];
74  $expected = $input;
75  $expected['simpleArray'] = 'aValue,anotherValue';
76  self::assertEquals($expected, ‪FormEngineUtility::databaseRowCompatibility($input));
77  }
78 }
‪TYPO3\CMS\Backend\Form\Utility\FormEngineUtility\databaseRowCompatibility
‪static array databaseRowCompatibility(array $row)
Definition: FormEngineUtility.php:195
‪TYPO3\CMS\Backend\Tests\Unit\Form\Utility\FormEngineUtilityTest\databaseRowCompatibilityKeepsSimpleValue
‪databaseRowCompatibilityKeepsSimpleValue()
Definition: FormEngineUtilityTest.php:29
‪TYPO3\CMS\Backend\Form\Utility\FormEngineUtility
Definition: FormEngineUtility.php:39
‪TYPO3\CMS\Backend\Tests\Unit\Form\Utility\FormEngineUtilityTest\databaseRowCompatibilityImplodesSimpleArray
‪databaseRowCompatibilityImplodesSimpleArray()
Definition: FormEngineUtilityTest.php:42
‪TYPO3\CMS\Backend\Tests\Unit\Form\Utility
Definition: FormEngineUtilityTest.php:16
‪TYPO3\CMS\Backend\Tests\Unit\Form\Utility\FormEngineUtilityTest\databaseRowCompatibilityImplodesSelectArrayWithValuesAtSecondPosition
‪databaseRowCompatibilityImplodesSelectArrayWithValuesAtSecondPosition()
Definition: FormEngineUtilityTest.php:59
‪TYPO3\CMS\Backend\Tests\Unit\Form\Utility\FormEngineUtilityTest
Definition: FormEngineUtilityTest.php:25