[TASK] FormEngine: Test FlexForm sheet displayCond with logical operator 66/45366/2
authorMorton Jonuschat <m.jonuschat@mojocode.de>
Fri, 18 Dec 2015 20:38:35 +0000 (21:38 +0100)
committerWouter Wolters <typo3@wouterwolters.nl>
Thu, 24 Dec 2015 13:34:03 +0000 (14:34 +0100)
Add unit test to test that logical operator work in displayCond at the
level of FlexForm sheets.

Resolves: #68989
Releases: master
Change-Id: I2f6d7359ee742a8738c2aaacf41193c506bdad82
Reviewed-on: https://review.typo3.org/45366
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Tests/Unit/Form/FormDataProvider/EvaluateDisplayConditionsTest.php

index 609d4cf..70e6b31 100644 (file)
@@ -855,4 +855,71 @@ class EvaluateDisplayConditionsTest extends UnitTestCase
         unset($expected['processedTca']['columns']['testField']['config']['ds']['sheets']['sTest']);
         $this->assertSame($expected, $this->subject->addData($input));
     }
+
+    /**
+     * @test
+     */
+    public function matchFlexformSheetConditionStringsWithLogicalOperatorForFieldsWithDotInName()
+    {
+        $input = [
+            'databaseRow' => [
+                'foo' => 'bar',
+                'testField' => [
+                    'data' => [
+                        'sDEF' => [
+                            'lDEF' => [
+                                'testField' => [
+                                    'vDEF' => [
+                                        0 => '',
+                                    ],
+                                ],
+                            ],
+                        ],
+                    ],
+                ],
+            ],
+            'processedTca' => [
+                'columns' => [
+                    'testField' => [
+                        'config' => [
+                            'type' => 'flex',
+                            'ds' => [
+                                'meta' => [],
+                                'sheets' => [
+                                    'sDEF' => [
+                                        'ROOT' => [
+                                            'type' => 'array',
+                                            'el' => [
+                                                'testField' => [
+                                                    'config' => [
+                                                        'type' => 'input',
+                                                    ],
+                                                ],
+                                            ],
+                                        ],
+                                    ],
+                                    'sTest' => [
+                                        'ROOT' => [
+                                            'type' => 'array',
+                                            'el' => [],
+                                            'sheetTitle' => 'sVideo',
+                                            'displayCond' => [
+                                                'OR' => [
+                                                    'FIELD:sDEF.testField:=:LIST',
+                                                    'FIELD:sDEF.testField:REQ:false',
+                                                ],
+                                            ] ,
+                                        ],
+                                    ],
+                                ]
+                            ],
+                        ],
+                    ],
+                ],
+            ],
+        ];
+
+        $expected = $input;
+        $this->assertSame($expected, $this->subject->addData($input));
+    }
 }