‪TYPO3CMS  11.5
ElementBrowserTest.php
Go to the documentation of this file.
1 <?php
2 
3 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 
19 
20 use Prophecy\PhpUnit\ProphecyTrait;
23 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
24 
25 class ‪ElementBrowserTest extends UnitTestCase
26 {
27  use ProphecyTrait;
28 
32  public function ‪renderTrimsAllowedValuesFromConfigSection(): void
33  {
34  $nodeFactory = $this->prophesize(NodeFactory::class);
35  $elementBrowser = new ‪ElementBrowser($nodeFactory->reveal(), [
36  'fieldName' => 'somefield',
37  'isInlineChild' => false,
38  'tableName' => 'tt_content',
39  'inlineStructure' => [],
40  'parameterArray' => [
41  'itemFormElName' => '',
42  'fieldConf' => [
43  'config' => [
44  'allowed' => 'be_users, be_groups',
45  ],
46  ],
47  ],
48  ]);
49 
50  $result = $elementBrowser->render();
51  self::assertSame($result['linkAttributes']['data-params'], '|||be_users,be_groups|');
52  }
53 
58  {
59  $nodeFactory = $this->prophesize(NodeFactory::class);
60  $elementBrowser = new ‪ElementBrowser($nodeFactory->reveal(), [
61  'fieldName' => 'somefield',
62  'isInlineChild' => false,
63  'tableName' => 'tt_content',
64  'inlineStructure' => [],
65  'parameterArray' => [
66  'itemFormElName' => '',
67  'fieldConf' => [
68  'config' => [
69  'appearance' => [
70  'elementBrowserAllowed' => 'be_users, be_groups',
71  ],
72  ],
73  ],
74  ],
75  ]);
76  $result = $elementBrowser->render();
77  self::assertSame($result['linkAttributes']['data-params'], '|||be_users,be_groups|');
78  }
79 }
‪TYPO3\CMS\Backend\Form\FieldControl\ElementBrowser
Definition: ElementBrowser.php:29
‪TYPO3\CMS\Backend\Tests\Unit\Form\FieldControl\ElementBrowserTest
Definition: ElementBrowserTest.php:26
‪TYPO3\CMS\Backend\Tests\Unit\Form\FieldControl
Definition: ElementBrowserTest.php:18
‪TYPO3\CMS\Backend\Tests\Unit\Form\FieldControl\ElementBrowserTest\renderTrimsAllowedValuesFromConfigSection
‪renderTrimsAllowedValuesFromConfigSection()
Definition: ElementBrowserTest.php:31
‪TYPO3\CMS\Backend\Form\NodeFactory
Definition: NodeFactory.php:37
‪TYPO3\CMS\Backend\Tests\Unit\Form\FieldControl\ElementBrowserTest\renderTrimsAllowedValuesFromAppearanceSection
‪renderTrimsAllowedValuesFromAppearanceSection()
Definition: ElementBrowserTest.php:56