TYPO3  7.6
FormInlineAjaxControllerTest.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Tests\Unit\Controller;
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
17 use TYPO3\CMS\Core\Tests\UnitTestCase;
19 
23 class FormInlineAjaxControllerTest extends UnitTestCase
24 {
31  {
32  $selectorData = array();
33  $fileData['extension'] = 'png';
34  $mockObject = $this->getAccessibleMock(FormInlineAjaxController::class, array('dummy'), array(), '', false);
35  $mayUploadFile = $mockObject->_call('checkInlineFileTypeAccessForField', $selectorData, $fileData);
36  $this->assertTrue($mayUploadFile);
37  }
38 
45  {
46  $selectorData['PA']['fieldConf']['config']['appearance']['elementBrowserAllowed'] = 'doc, png, jpg, tiff';
47  $fileData['extension'] = 'php';
48  $mockObject = $this->getAccessibleMock(FormInlineAjaxController::class, array('dummy'), array(), '', false);
49  $mayUploadFile = $mockObject->_call('checkInlineFileTypeAccessForField', $selectorData, $fileData);
50  $this->assertFalse($mayUploadFile);
51  }
52 
58  {
59  $selectorData['PA']['fieldConf']['config']['appearance']['elementBrowserAllowed'] = 'doc, png, jpg, tiff';
60  $fileData['extension'] = 'png';
61  $mockObject = $this->getAccessibleMock(FormInlineAjaxController::class, array('dummy'), array(), '', false);
62  $mayUploadFile = $mockObject->_call('checkInlineFileTypeAccessForField', $selectorData, $fileData);
63  $this->assertTrue($mayUploadFile);
64  }
65 }