‪TYPO3CMS  9.5
ElementBrowserTest.php
Go to the documentation of this file.
1 <?php
2 declare(strict_types = 1);
3 
5 
6 /*
7  * This file is part of the TYPO3 CMS project.
8  *
9  * It is free software; you can redistribute it and/or modify it under
10  * the terms of the GNU General Public License, either version 2
11  * of the License, or any later version.
12  *
13  * For the full copyright and license information, please read the
14  * LICENSE.txt file that was distributed with this source code.
15  *
16  * The TYPO3 project - inspiring people to share!
17  */
18 
21 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
22 
23 class ‪ElementBrowserTest extends UnitTestCase
24 {
25 
30  {
31  $nodeFactory = $this->prophesize(NodeFactory::class);
32  $elementBrowser = new ‪ElementBrowser($nodeFactory->reveal(), [
33  'fieldName' => 'somefield',
34  'isInlineChild' => false,
35  'tableName' => 'tt_content',
36  'inlineStructure' => [],
37  'parameterArray' => [
38  'itemFormElName' => '',
39  'fieldConf' => [
40  'config' => [
41  'internal_type' => 'file_reference',
42  'allowed' => 'jpg, png, bmp',
43  'appearance' => []
44  ]
45  ]
46  ]
47  ]);
48 
49  $result = $elementBrowser->render();
50  self::assertSame($result['linkAttributes']['onClick'], 'setFormValueOpenBrowser(\'file_reference\',\'|||jpg,png,bmp|\'); return false;');
51  }
52 
57  {
58  $nodeFactory = $this->prophesize(NodeFactory::class);
59  $elementBrowser = new ‪ElementBrowser($nodeFactory->reveal(), [
60  'fieldName' => 'somefield',
61  'isInlineChild' => false,
62  'tableName' => 'tt_content',
63  'inlineStructure' => [],
64  'parameterArray' => [
65  'itemFormElName' => '',
66  'fieldConf' => [
67  'config' => [
68  'internal_type' => 'file_reference',
69  'allowed' => '',
70  'appearance' => [
71  'elementBrowserAllowed' => 'jpg, png, bmp'
72  ]
73  ]
74  ]
75  ]
76  ]);
77  $result = $elementBrowser->render();
78  self::assertSame($result['linkAttributes']['onClick'], 'setFormValueOpenBrowser(\'file_reference\',\'|||jpg,png,bmp|\'); return false;');
79  }
80 }
‪TYPO3\CMS\Backend\Tests\Unit\Form\FieldControl\ElementBrowserTest\renderTrimsAllowedExtensionsFromConfigSection
‪renderTrimsAllowedExtensionsFromConfigSection()
Definition: ElementBrowserTest.php:29
‪TYPO3\CMS\Backend\Form\FieldControl\ElementBrowser
Definition: ElementBrowser.php:27
‪TYPO3\CMS\Backend\Tests\Unit\Form\FieldControl\ElementBrowserTest\renderTrimsAllowedExtensionsFromAppearanceSection
‪renderTrimsAllowedExtensionsFromAppearanceSection()
Definition: ElementBrowserTest.php:56
‪TYPO3\CMS\Backend\Tests\Unit\Form\FieldControl\ElementBrowserTest
Definition: ElementBrowserTest.php:24
‪TYPO3\CMS\Backend\Tests\Unit\Form\FieldControl
Definition: ElementBrowserTest.php:4
‪TYPO3\CMS\Backend\Form\NodeFactory
Definition: NodeFactory.php:36