‪TYPO3CMS  10.4
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 
22 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
23 
24 class ‪ElementBrowserTest extends UnitTestCase
25 {
26 
31  {
32  $nodeFactory = $this->prophesize(NodeFactory::class);
33  $elementBrowser = new ‪ElementBrowser($nodeFactory->reveal(), [
34  'fieldName' => 'somefield',
35  'isInlineChild' => false,
36  'tableName' => 'tt_content',
37  'inlineStructure' => [],
38  'parameterArray' => [
39  'itemFormElName' => '',
40  'fieldConf' => [
41  'config' => [
42  'internal_type' => 'file_reference',
43  'allowed' => 'jpg, png, bmp',
44  'appearance' => []
45  ]
46  ]
47  ]
48  ]);
49 
50  $result = $elementBrowser->render();
51  self::assertSame($result['linkAttributes']['data-params'], '|||jpg,png,bmp|');
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  'internal_type' => 'file_reference',
70  'allowed' => '',
71  'appearance' => [
72  'elementBrowserAllowed' => 'jpg, png, bmp'
73  ]
74  ]
75  ]
76  ]
77  ]);
78  $result = $elementBrowser->render();
79  self::assertSame($result['linkAttributes']['data-params'], '|||jpg,png,bmp|');
80  }
81 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\FieldControl\ElementBrowserTest\renderTrimsAllowedExtensionsFromConfigSection
‪renderTrimsAllowedExtensionsFromConfigSection()
Definition: ElementBrowserTest.php:30
‪TYPO3\CMS\Backend\Form\FieldControl\ElementBrowser
Definition: ElementBrowser.php:29
‪TYPO3\CMS\Backend\Tests\Unit\Form\FieldControl\ElementBrowserTest\renderTrimsAllowedExtensionsFromAppearanceSection
‪renderTrimsAllowedExtensionsFromAppearanceSection()
Definition: ElementBrowserTest.php:57
‪TYPO3\CMS\Backend\Tests\Unit\Form\FieldControl\ElementBrowserTest
Definition: ElementBrowserTest.php:25
‪TYPO3\CMS\Backend\Tests\Unit\Form\FieldControl
Definition: ElementBrowserTest.php:18
‪TYPO3\CMS\Backend\Form\NodeFactory
Definition: NodeFactory.php:37