TYPO3 CMS  TYPO3_7-6
CommandUtilityTest.php
Go to the documentation of this file.
1 <?php
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  */
17 
22 {
29  {
30  $defaultExpected = [
31  'perl' => [
32  'app' => 'perl',
33  'path' => '/usr/bin/',
34  'valid' => true
35  ],
36  'unzip' => [
37  'app' => 'unzip',
38  'path' => '/usr/local/bin/',
39  'valid' => true
40  ],
41  ];
42  return [
43  'returns empty array for empty string' => [
44  '',
45  []
46  ],
47  'separated by comma' => [
48  'perl=/usr/bin/perl,unzip=/usr/local/bin/unzip',
49  $defaultExpected
50  ],
51  'separated by new line' => [
52  'perl=/usr/bin/perl ' . LF . ' unzip=/usr/local/bin/unzip',
53  $defaultExpected
54  ],
55  'separated by new line with spaces' => [
56  'perl = /usr/bin/perl ' . LF . ' unzip = /usr/local/bin/unzip',
57  $defaultExpected
58  ],
59  'separated by new line with spaces and empty rows' => [
60  LF . 'perl = /usr/bin/perl ' . LF . LF . ' unzip = /usr/local/bin/unzip' . LF,
61  $defaultExpected
62  ],
63  'separated by char(10)' => [
64  'perl=/usr/bin/perl' . '\'.chr(10).\'' . 'unzip=/usr/local/bin/unzip',
65  $defaultExpected
66  ],
67  'separated by LF as string' => [
68  'perl=/usr/bin/perl' . '\' . LF . \'' . 'unzip=/usr/local/bin/unzip',
69  $defaultExpected
70  ]
71  ];
72  }
73 
80  public function getConfiguredApps($globalsBinSetup, $expected)
81  {
82  $GLOBALS['TYPO3_CONF_VARS']['SYS']['binSetup'] = $globalsBinSetup;
83  $commandUtilityMock = $this->getAccessibleMock(CommandUtility::class, ['dummy']);
84  $result = $commandUtilityMock->_call('getConfiguredApps');
85  $this->assertSame($expected, $result);
86  }
87 }
getAccessibleMock( $originalClassName, $methods=[], array $arguments=[], $mockClassName='', $callOriginalConstructor=true, $callOriginalClone=true, $callAutoload=true)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']