‪TYPO3CMS  10.4
GeneralUtilityTest.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
18 use org\bovigo\vfs\vfsStream;
19 use org\bovigo\vfs\vfsStreamDirectory;
20 use org\bovigo\vfs\vfsStreamWrapper;
21 use Prophecy\Argument;
22 use Psr\Log\LoggerInterface;
27 use TYPO3\CMS\Core\Package\PackageManager;
42 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
43 
47 class ‪GeneralUtilityTest extends UnitTestCase
48 {
49  const ‪NO_FIX_PERMISSIONS_ON_WINDOWS = 'fixPermissions() not available on Windows (method does nothing)';
50 
54  protected ‪$resetSingletonInstances = true;
55 
59  protected ‪$backupEnvironment = true;
60 
64  protected ‪$backupPackageManager;
65 
69  protected function ‪setUp(): void
70  {
71  parent::setUp();
74  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = ‪GeneralUtility::ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL;
76  }
77 
81  protected function ‪tearDown(): void
82  {
83  GeneralUtility::flushInternalRuntimeCaches();
84  if ($this->backupPackageManager) {
86  }
87  parent::tearDown();
88  }
89 
96  public function ‪isConnected()
97  {
98  $isConnected = false;
99  $connected = @fsockopen('typo3.org', 80);
100  if ($connected) {
101  $isConnected = true;
102  fclose($connected);
103  }
104  return $isConnected;
105  }
106 
114  protected function ‪getVirtualTestDir($prefix = 'root_')
115  {
116  $root = vfsStream::setup();
117  $path = $root->url() . '/typo3temp/var/tests/' . ‪StringUtility::getUniqueId($prefix);
119  return $path;
120  }
121 
123  // Tests concerning _GP
125 
129  public function ‪canRetrieveValueWithGP($key, $get, $post, $expected)
130  {
131  $_GET = $get;
132  $_POST = $post;
133  self::assertSame($expected, GeneralUtility::_GP($key));
134  }
135 
142  public function ‪gpDataProvider()
143  {
144  return [
145  'No key parameter' => [null, [], [], null],
146  'Key not found' => ['cake', [], [], null],
147  'Value only in GET' => ['cake', ['cake' => 'li\\e'], [], 'li\\e'],
148  'Value only in POST' => ['cake', [], ['cake' => 'l\\ie'], 'l\\ie'],
149  'Value from POST preferred over GET' => ['cake', ['cake' => 'is a'], ['cake' => '\\lie'], '\\lie'],
150  'Value can be an array' => [
151  'cake',
152  ['cake' => ['is a' => 'l\\ie']],
153  [],
154  ['is a' => 'l\\ie']
155  ]
156  ];
157  }
158 
160  // Tests concerning _GPmerged
162 
166  public function ‪gpMergedWillMergeArraysFromGetAndPost($get, $post, $expected)
167  {
168  $_POST = $post;
169  $_GET = $get;
170  self::assertEquals($expected, GeneralUtility::_GPmerged('cake'));
171  }
172 
178  public function ‪gpMergedDataProvider()
179  {
180  $fullDataArray = ['cake' => ['a' => 'is a', 'b' => 'lie']];
181  $postPartData = ['cake' => ['b' => 'lie']];
182  $getPartData = ['cake' => ['a' => 'is a']];
183  $getPartDataModified = ['cake' => ['a' => 'is not a']];
184  return [
185  'Key doesn\' exist' => [['foo'], ['bar'], []],
186  'No POST data' => [$fullDataArray, [], $fullDataArray['cake']],
187  'No GET data' => [[], $fullDataArray, $fullDataArray['cake']],
188  'POST and GET are merged' => [$getPartData, $postPartData, $fullDataArray['cake']],
189  'POST is preferred over GET' => [$getPartDataModified, $fullDataArray, $fullDataArray['cake']]
190  ];
191  }
192 
194  // Tests concerning _GET / _POST
196 
202  public function ‪getAndPostDataProvider()
203  {
204  return [
205  'Requested input data doesn\'t exist' => ['cake', [], null],
206  'No key will return entire input data' => [null, ['cake' => 'l\\ie'], ['cake' => 'l\\ie']],
207  'Can retrieve specific input' => ['cake', ['cake' => 'l\\ie', 'foo'], 'l\\ie'],
208  'Can retrieve nested input data' => ['cake', ['cake' => ['is a' => 'l\\ie']], ['is a' => 'l\\ie']]
209  ];
210  }
211 
216  public function ‪canRetrieveGlobalInputsThroughGet($key, $get, $expected)
217  {
218  $_GET = $get;
219  self::assertSame($expected, GeneralUtility::_GET($key));
220  }
221 
226  public function ‪canRetrieveGlobalInputsThroughPost($key, $post, $expected)
227  {
228  $_POST = $post;
229  self::assertSame($expected, GeneralUtility::_POST($key));
230  }
231 
233  // Tests concerning cmpIPv4
235 
240  public static function ‪cmpIPv4DataProviderMatching()
241  {
242  return [
243  'host with full IP address' => ['127.0.0.1', '127.0.0.1'],
244  'host with two wildcards at the end' => ['127.0.0.1', '127.0.*.*'],
245  'host with wildcard at third octet' => ['127.0.0.1', '127.0.*.1'],
246  'host with wildcard at second octet' => ['127.0.0.1', '127.*.0.1'],
247  '/8 subnet' => ['127.0.0.1', '127.1.1.1/8'],
248  '/32 subnet (match only name)' => ['127.0.0.1', '127.0.0.1/32'],
249  '/30 subnet' => ['10.10.3.1', '10.10.3.3/30'],
250  'host with wildcard in list with IPv4/IPv6 addresses' => ['192.168.1.1', '127.0.0.1, 1234:5678::/126, 192.168.*'],
251  'host in list with IPv4/IPv6 addresses' => ['192.168.1.1', '::1, 1234:5678::/126, 192.168.1.1'],
252  ];
253  }
254 
259  public function ‪cmpIPv4ReturnsTrueForMatchingAddress($ip, $list)
260  {
261  self::assertTrue(GeneralUtility::cmpIPv4($ip, $list));
262  }
263 
269  public static function ‪cmpIPv4DataProviderNotMatching()
270  {
271  return [
272  'single host' => ['127.0.0.1', '127.0.0.2'],
273  'single host with wildcard' => ['127.0.0.1', '127.*.1.1'],
274  'single host with /32 subnet mask' => ['127.0.0.1', '127.0.0.2/32'],
275  '/31 subnet' => ['127.0.0.1', '127.0.0.2/31'],
276  'list with IPv4/IPv6 addresses' => ['127.0.0.1', '10.0.2.3, 192.168.1.1, ::1'],
277  'list with only IPv6 addresses' => ['10.20.30.40', '::1, 1234:5678::/127']
278  ];
279  }
280 
285  public function ‪cmpIPv4ReturnsFalseForNotMatchingAddress($ip, $list)
286  {
287  self::assertFalse(GeneralUtility::cmpIPv4($ip, $list));
288  }
289 
291  // Tests concerning cmpIPv6
293 
298  public static function ‪cmpIPv6DataProviderMatching()
299  {
300  return [
301  'empty address' => ['::', '::'],
302  'empty with netmask in list' => ['::', '::/0'],
303  'empty with netmask 0 and host-bits set in list' => ['::', '::123/0'],
304  'localhost' => ['::1', '::1'],
305  'localhost with leading zero blocks' => ['::1', '0:0::1'],
306  'host with submask /128' => ['::1', '0:0::1/128'],
307  '/16 subnet' => ['1234::1', '1234:5678::/16'],
308  '/126 subnet' => ['1234:5678::3', '1234:5678::/126'],
309  '/126 subnet with host-bits in list set' => ['1234:5678::3', '1234:5678::2/126'],
310  'list with IPv4/IPv6 addresses' => ['1234:5678::3', '::1, 127.0.0.1, 1234:5678::/126, 192.168.1.1']
311  ];
312  }
313 
318  public function ‪cmpIPv6ReturnsTrueForMatchingAddress($ip, $list)
319  {
320  self::assertTrue(GeneralUtility::cmpIPv6($ip, $list));
321  }
322 
328  public static function ‪cmpIPv6DataProviderNotMatching()
329  {
330  return [
331  'empty against localhost' => ['::', '::1'],
332  'empty against localhost with /128 netmask' => ['::', '::1/128'],
333  'localhost against different host' => ['::1', '::2'],
334  'localhost against host with prior bits set' => ['::1', '::1:1'],
335  'host against different /17 subnet' => ['1234::1', '1234:f678::/17'],
336  'host against different /127 subnet' => ['1234:5678::3', '1234:5678::/127'],
337  'host against IPv4 address list' => ['1234:5678::3', '127.0.0.1, 192.168.1.1'],
338  'host against mixed list with IPv6 host in different subnet' => ['1234:5678::3', '::1, 1234:5678::/127']
339  ];
340  }
341 
346  public function ‪cmpIPv6ReturnsFalseForNotMatchingAddress($ip, $list)
347  {
348  self::assertFalse(GeneralUtility::cmpIPv6($ip, $list));
349  }
350 
352  // Tests concerning normalizeIPv6 / compressIPv6
354 
359  public static function ‪normalizeCompressIPv6DataProviderCorrect()
360  {
361  return [
362  'empty' => ['::', '0000:0000:0000:0000:0000:0000:0000:0000'],
363  'localhost' => ['::1', '0000:0000:0000:0000:0000:0000:0000:0001'],
364  'expansion in middle 1' => ['1::2', '0001:0000:0000:0000:0000:0000:0000:0002'],
365  'expansion in middle 2' => ['1:2::3', '0001:0002:0000:0000:0000:0000:0000:0003'],
366  'expansion in middle 3' => ['1::2:3', '0001:0000:0000:0000:0000:0000:0002:0003'],
367  'expansion in middle 4' => ['1:2::3:4:5', '0001:0002:0000:0000:0000:0003:0004:0005']
368  ];
369  }
370 
375  public function ‪normalizeIPv6CorrectlyNormalizesAddresses($compressed, $normalized)
376  {
377  self::assertEquals($normalized, GeneralUtility::normalizeIPv6($compressed));
378  }
379 
381  // Tests concerning validIP
383 
388  public static function ‪validIpDataProvider()
389  {
390  return [
391  '0.0.0.0' => ['0.0.0.0'],
392  'private IPv4 class C' => ['192.168.0.1'],
393  'private IPv4 class A' => ['10.0.13.1'],
394  'private IPv6' => ['fe80::daa2:5eff:fe8b:7dfb']
395  ];
396  }
397 
402  public function ‪validIpReturnsTrueForValidIp($ip)
403  {
404  self::assertTrue(GeneralUtility::validIP($ip));
405  }
406 
412  public static function ‪invalidIpDataProvider()
413  {
414  return [
415  'null' => [null],
416  'zero' => [0],
417  'string' => ['test'],
418  'string empty' => [''],
419  'string NULL' => ['NULL'],
420  'out of bounds IPv4' => ['300.300.300.300'],
421  'dotted decimal notation with only two dots' => ['127.0.1']
422  ];
423  }
424 
429  public function ‪validIpReturnsFalseForInvalidIp($ip)
430  {
431  self::assertFalse(GeneralUtility::validIP($ip));
432  }
433 
435  // Tests concerning cmpFQDN
437 
442  public static function ‪cmpFqdnValidDataProvider()
443  {
444  return [
445  'localhost should usually resolve, IPv4' => ['127.0.0.1', '*'],
446  'localhost should usually resolve, IPv6' => ['::1', '*'],
447  // other testcases with resolving not possible since it would
448  // require a working IPv4/IPv6-connectivity
449  'aaa.bbb.ccc.ddd.eee, full' => ['aaa.bbb.ccc.ddd.eee', 'aaa.bbb.ccc.ddd.eee'],
450  'aaa.bbb.ccc.ddd.eee, wildcard first' => ['aaa.bbb.ccc.ddd.eee', '*.ccc.ddd.eee'],
451  'aaa.bbb.ccc.ddd.eee, wildcard last' => ['aaa.bbb.ccc.ddd.eee', 'aaa.bbb.ccc.*'],
452  'aaa.bbb.ccc.ddd.eee, wildcard middle' => ['aaa.bbb.ccc.ddd.eee', 'aaa.*.eee'],
453  'list-matches, 1' => ['aaa.bbb.ccc.ddd.eee', 'xxx, yyy, zzz, aaa.*.eee'],
454  'list-matches, 2' => ['aaa.bbb.ccc.ddd.eee', '127:0:0:1,,aaa.*.eee,::1']
455  ];
456  }
457 
462  public function ‪cmpFqdnReturnsTrue($baseHost, $list)
463  {
464  self::assertTrue(GeneralUtility::cmpFQDN($baseHost, $list));
465  }
466 
472  public static function ‪cmpFqdnInvalidDataProvider()
473  {
474  return [
475  'num-parts of hostname to check can only be less or equal than hostname, 1' => ['aaa.bbb.ccc.ddd.eee', 'aaa.bbb.ccc.ddd.eee.fff'],
476  'num-parts of hostname to check can only be less or equal than hostname, 2' => ['aaa.bbb.ccc.ddd.eee', 'aaa.*.bbb.ccc.ddd.eee']
477  ];
478  }
479 
484  public function ‪cmpFqdnReturnsFalse($baseHost, $list)
485  {
486  self::assertFalse(GeneralUtility::cmpFQDN($baseHost, $list));
487  }
488 
490  // Tests concerning inList
492 
497  public function ‪inListForItemContainedReturnsTrue($haystack)
498  {
499  self::assertTrue(GeneralUtility::inList($haystack, 'findme'));
500  }
501 
508  {
509  return [
510  'Element as second element of four items' => ['one,findme,three,four'],
511  'Element at beginning of list' => ['findme,one,two'],
512  'Element at end of list' => ['one,two,findme'],
513  'One item list' => ['findme']
514  ];
515  }
516 
522  public function ‪inListForItemNotContainedReturnsFalse($haystack)
523  {
524  self::assertFalse(GeneralUtility::inList($haystack, 'findme'));
525  }
526 
533  {
534  return [
535  'Four item list' => ['one,two,three,four'],
536  'One item list' => ['one'],
537  'Empty list' => ['']
538  ];
539  }
540 
542  // Tests concerning rmFromList
544 
550  public function ‪rmFromListRemovesElementsFromCommaSeparatedList($initialList, $listWithElementRemoved)
551  {
552  self::assertSame($listWithElementRemoved, GeneralUtility::rmFromList('removeme', $initialList));
553  }
554 
561  {
562  return [
563  'Element as second element of three' => ['one,removeme,two', 'one,two'],
564  'Element at beginning of list' => ['removeme,one,two', 'one,two'],
565  'Element at end of list' => ['one,two,removeme', 'one,two'],
566  'One item list' => ['removeme', ''],
567  'Element not contained in list' => ['one,two,three', 'one,two,three'],
568  'Empty element survives' => ['one,,three,,removeme', 'one,,three,'],
569  'Empty element survives at start' => [',removeme,three,removeme', ',three'],
570  'Empty element survives at end' => ['removeme,three,removeme,', 'three,'],
571  'Empty list' => ['', ''],
572  'List contains removeme multiple times' => ['removeme,notme,removeme,removeme', 'notme'],
573  'List contains removeme multiple times nothing else' => ['removeme,removeme,removeme', ''],
574  'List contains removeme multiple times nothing else 2x' => ['removeme,removeme', ''],
575  'List contains removeme multiple times nothing else 3x' => ['removeme,removeme,removeme', ''],
576  'List contains removeme multiple times nothing else 4x' => ['removeme,removeme,removeme,removeme', ''],
577  'List contains removeme multiple times nothing else 5x' => ['removeme,removeme,removeme,removeme,removeme', ''],
578  ];
579  }
580 
582  // Tests concerning expandList
584 
590  public function ‪expandListExpandsIntegerRanges($list, $expectation)
591  {
592  self::assertSame($expectation, GeneralUtility::expandList($list));
593  }
594 
601  {
602  return [
603  'Expand for the same number' => ['1,2-2,7', '1,2,7'],
604  'Small range expand with parameters reversed ignores reversed items' => ['1,5-3,7', '1,7'],
605  'Small range expand' => ['1,3-5,7', '1,3,4,5,7'],
606  'Expand at beginning' => ['3-5,1,7', '3,4,5,1,7'],
607  'Expand at end' => ['1,7,3-5', '1,7,3,4,5'],
608  'Multiple small range expands' => ['1,3-5,7-10,12', '1,3,4,5,7,8,9,10,12'],
609  'One item list' => ['1-5', '1,2,3,4,5'],
610  'Nothing to expand' => ['1,2,3,4', '1,2,3,4'],
611  'Empty list' => ['', '']
612  ];
613  }
614 
619  {
620  $list = GeneralUtility::expandList('1-2000');
621  self::assertSame(1000, count(explode(',', $list)));
622  }
623 
625  // Tests concerning uniqueList
627 
633  public function ‪uniqueListUnifiesCommaSeparatedList($initialList, $unifiedList)
634  {
635  self::assertSame($unifiedList, GeneralUtility::uniqueList($initialList));
636  }
637 
644  {
645  return [
646  'List without duplicates' => ['one,two,three', 'one,two,three'],
647  'List with two consecutive duplicates' => ['one,two,two,three,three', 'one,two,three'],
648  'List with non-consecutive duplicates' => ['one,two,three,two,three', 'one,two,three'],
649  'One item list' => ['one', 'one'],
650  'Empty list' => ['', '']
651  ];
652  }
653 
655  // Tests concerning isFirstPartOfStr
657 
663  {
664  return [
665  'match first part of string' => ['hello world', 'hello'],
666  'match whole string' => ['hello', 'hello'],
667  'integer is part of string with same number' => ['24', 24],
668  'string is part of integer with same number' => [24, '24'],
669  'integer is part of string starting with same number' => ['24 beer please', 24]
670  ];
671  }
672 
677  public function ‪isFirstPartOfStrReturnsTrueForMatchingFirstPart($string, $part)
678  {
679  self::assertTrue(GeneralUtility::isFirstPartOfStr($string, $part));
680  }
681 
688  {
689  return [
690  'no string match' => ['hello', 'bye'],
691  'no case sensitive string match' => ['hello world', 'Hello'],
692  'array is not part of string' => ['string', []],
693  'string is not part of array' => [[], 'string'],
694  'NULL is not part of string' => ['string', null],
695  'string is not part of NULL' => [null, 'string'],
696  'NULL is not part of array' => [[], null],
697  'array is not part of NULL' => [null, []],
698  'empty string is not part of empty string' => ['', ''],
699  'NULL is not part of empty string' => ['', null],
700  'false is not part of empty string' => ['', false],
701  'empty string is not part of NULL' => [null, ''],
702  'empty string is not part of false' => [false, ''],
703  'empty string is not part of zero integer' => [0, ''],
704  'zero integer is not part of NULL' => [null, 0],
705  'zero integer is not part of empty string' => ['', 0]
706  ];
707  }
708 
713  public function ‪isFirstPartOfStrReturnsFalseForNotMatchingFirstPart($string, $part)
714  {
715  self::assertFalse(GeneralUtility::isFirstPartOfStr($string, $part));
716  }
717 
719  // Tests concerning formatSize
721 
725  public function ‪formatSizeTranslatesBytesToHigherOrderRepresentation($size, $labels, $base, $expected)
726  {
727  self::assertEquals($expected, GeneralUtility::formatSize($size, $labels, $base));
728  }
729 
735  public function ‪formatSizeDataProvider()
736  {
737  return [
738  'IEC Bytes stay bytes (min)' => [1, '', 0, '1 '],
739  'IEC Bytes stay bytes (max)' => [921, '', 0, '921 '],
740  'IEC Kilobytes are used (min)' => [922, '', 0, '0.90 Ki'],
741  'IEC Kilobytes are used (max)' => [943718, '', 0, '922 Ki'],
742  'IEC Megabytes are used (min)' => [943719, '', 0, '0.90 Mi'],
743  'IEC Megabytes are used (max)' => [966367641, '', 0, '922 Mi'],
744  'IEC Gigabytes are used (min)' => [966367642, '', 0, '0.90 Gi'],
745  'IEC Gigabytes are used (max)' => [989560464998, '', 0, '922 Gi'],
746  'IEC Decimal is omitted for large kilobytes' => [31080, '', 0, '30 Ki'],
747  'IEC Decimal is omitted for large megabytes' => [31458000, '', 0, '30 Mi'],
748  'IEC Decimal is omitted for large gigabytes' => [32212254720, '', 0, '30 Gi'],
749  'SI Bytes stay bytes (min)' => [1, 'si', 0, '1 '],
750  'SI Bytes stay bytes (max)' => [899, 'si', 0, '899 '],
751  'SI Kilobytes are used (min)' => [901, 'si', 0, '0.90 k'],
752  'SI Kilobytes are used (max)' => [900000, 'si', 0, '900 k'],
753  'SI Megabytes are used (min)' => [900001, 'si', 0, '0.90 M'],
754  'SI Megabytes are used (max)' => [900000000, 'si', 0, '900 M'],
755  'SI Gigabytes are used (min)' => [900000001, 'si', 0, '0.90 G'],
756  'SI Gigabytes are used (max)' => [900000000000, 'si', 0, '900 G'],
757  'SI Decimal is omitted for large kilobytes' => [30000, 'si', 0, '30 k'],
758  'SI Decimal is omitted for large megabytes' => [30000000, 'si', 0, '30 M'],
759  'SI Decimal is omitted for large gigabytes' => [30000000000, 'si', 0, '30 G'],
760  'Label for bytes can be exchanged (binary unit)' => [1, ' Foo|||', 0, '1 Foo'],
761  'Label for kilobytes can be exchanged (binary unit)' => [1024, '| Foo||', 0, '1.00 Foo'],
762  'Label for megabytes can be exchanged (binary unit)' => [1048576, '|| Foo|', 0, '1.00 Foo'],
763  'Label for gigabytes can be exchanged (binary unit)' => [1073741824, '||| Foo', 0, '1.00 Foo'],
764  'Label for bytes can be exchanged (decimal unit)' => [1, ' Foo|||', 1000, '1 Foo'],
765  'Label for kilobytes can be exchanged (decimal unit)' => [1000, '| Foo||', 1000, '1.00 Foo'],
766  'Label for megabytes can be exchanged (decimal unit)' => [1000000, '|| Foo|', 1000, '1.00 Foo'],
767  'Label for gigabytes can be exchanged (decimal unit)' => [1000000000, '||| Foo', 1000, '1.00 Foo'],
768  'IEC Base is ignored' => [1024, 'iec', 1000, '1.00 Ki'],
769  'SI Base is ignored' => [1000, 'si', 1024, '1.00 k'],
770  'Use binary base for unexpected base' => [2048, '| Bar||', 512, '2.00 Bar']
771  ];
772  }
773 
775  // Tests concerning splitCalc
777 
782  public function ‪splitCalcDataProvider()
783  {
784  return [
785  'empty string returns empty array' => [
786  [],
787  ''
788  ],
789  'number without operator returns array with plus and number' => [
790  [['+', '42']],
791  '42'
792  ],
793  'two numbers with asterisk return first number with plus and second number with asterisk' => [
794  [['+', '42'], ['*', '31']],
795  '42 * 31'
796  ]
797  ];
798  }
799 
804  public function ‪splitCalcCorrectlySplitsExpression(array $expected, string $expression): void
805  {
806  self::assertSame($expected, GeneralUtility::splitCalc($expression, '+-*/'));
807  }
808 
810  // Tests concerning htmlspecialchars_decode
812 
816  {
817  $string = '<typo3 version="6.0">&nbsp;</typo3>';
818  $encoded = htmlspecialchars($string);
819  $decoded = htmlspecialchars_decode($encoded);
820  self::assertEquals($string, $decoded);
821  }
822 
824  // Tests concerning validEmail
826 
831  public function ‪validEmailValidDataProvider()
832  {
833  return [
834  'short mail address' => ['a@b.c'],
835  'simple mail address' => ['test@example.com'],
836  'uppercase characters' => ['QWERTYUIOPASDFGHJKLZXCVBNM@QWERTYUIOPASDFGHJKLZXCVBNM.NET'],
837  'equal sign in local part' => ['test=mail@example.com'],
838  'dash in local part' => ['test-mail@example.com'],
839  'plus in local part' => ['test+mail@example.com'],
840  'question mark in local part' => ['test?mail@example.com'],
841  'slash in local part' => ['foo/bar@example.com'],
842  'hash in local part' => ['foo#bar@example.com'],
843  'dot in local part' => ['firstname.lastname@employee.2something.com'],
844  'dash as local part' => ['-@foo.com'],
845  'umlauts in domain part' => ['foo@äöüfoo.com'],
846  'number as top level domain' => ['foo@bar.123'],
847  'top level domain only' => ['test@localhost'],
848  'umlauts in local part' => ['äöüfoo@bar.com'],
849  'quoted @ char' => ['"Abc@def"@example.com'],
850  ];
851  }
852 
857  public function ‪validEmailReturnsTrueForValidMailAddress($address)
858  {
859  self::assertTrue(GeneralUtility::validEmail($address));
860  }
861 
867  public function ‪validEmailInvalidDataProvider()
868  {
869  return [
870  'empty string' => [''],
871  'empty array' => [[]],
872  'integer' => [42],
873  'float' => [42.23],
874  'array' => [['foo']],
875  'object' => [new \stdClass()],
876  '@ sign only' => ['@'],
877  'string longer than 320 characters' => [str_repeat('0123456789', 33)],
878  'duplicate @' => ['test@@example.com'],
879  'duplicate @ combined with further special characters in local part' => ['test!.!@#$%^&*@example.com'],
880  'opening parenthesis in local part' => ['foo(bar@example.com'],
881  'closing parenthesis in local part' => ['foo)bar@example.com'],
882  'opening square bracket in local part' => ['foo[bar@example.com'],
883  'closing square bracket as local part' => [']@example.com'],
884  'dash as second level domain' => ['foo@-.com'],
885  'domain part starting with dash' => ['foo@-foo.com'],
886  'domain part ending with dash' => ['foo@foo-.com'],
887  'dot at beginning of domain part' => ['test@.com'],
888  'local part ends with dot' => ['e.x.a.m.p.l.e.@example.com'],
889  'trailing whitespace' => ['test@example.com '],
890  'trailing carriage return' => ['test@example.com' . CR],
891  'trailing linefeed' => ['test@example.com' . LF],
892  'trailing carriage return linefeed' => ['test@example.com' . CRLF],
893  'trailing tab' => ['test@example.com' . "\t"],
894  'prohibited input characters' => ['“mailto:test@example.com”'],
895  'escaped @ char' => ['abc\@def@example.com'], // known bug, see https://github.com/egulias/EmailValidator/issues/181
896  ];
897  }
898 
903  public function ‪validEmailReturnsFalseForInvalidMailAddress($address)
904  {
905  self::assertFalse(GeneralUtility::validEmail($address));
906  }
907 
909  // Tests concerning intExplode
911 
914  public function ‪intExplodeConvertsStringsToInteger()
915  {
916  $testString = '1,foo,2';
917  $expectedArray = [1, 0, 2];
918  $actualArray = ‪GeneralUtility::intExplode(',', $testString);
919  self::assertEquals($expectedArray, $actualArray);
920  }
921 
923  // Tests concerning implodeArrayForUrl / explodeUrl2Array
925 
930  public function ‪implodeArrayForUrlDataProvider()
931  {
932  $valueArray = ['one' => '√', 'two' => 2];
933  return [
934  'Empty input' => ['foo', [], ''],
935  'String parameters' => ['foo', $valueArray, '&foo[one]=%E2%88%9A&foo[two]=2'],
936  'Nested array parameters' => ['foo', [$valueArray], '&foo[0][one]=%E2%88%9A&foo[0][two]=2'],
937  'Keep blank parameters' => ['foo', ['one' => '√', ''], '&foo[one]=%E2%88%9A&foo[0]=']
938  ];
939  }
940 
945  public function ‪implodeArrayForUrlBuildsValidParameterString($name, $input, $expected)
946  {
947  self::assertSame($expected, ‪GeneralUtility::implodeArrayForUrl($name, $input));
948  }
949 
954  {
955  $input = ['one' => '√', ''];
956  $expected = '&foo[one]=%E2%88%9A';
957  self::assertSame($expected, ‪GeneralUtility::implodeArrayForUrl('foo', $input, '', true));
958  }
959 
964  {
965  $input = ['one' => '√', ''];
966  $expected = '&foo%5Bone%5D=%E2%88%9A&foo%5B0%5D=';
967  self::assertSame($expected, ‪GeneralUtility::implodeArrayForUrl('foo', $input, '', false, true));
968  }
969 
974  public function ‪explodeUrl2ArrayTransformsParameterStringToFlatArray($input, $expected)
975  {
976  self::assertEquals($expected, GeneralUtility::explodeUrl2Array($input));
977  }
978 
984  public function ‪explodeUrl2ArrayDataProvider()
985  {
986  return [
987  'Empty string' => ['', []],
988  'Simple parameter string' => ['&one=%E2%88%9A&two=2', ['one' => '√', 'two' => 2]],
989  'Nested parameter string' => ['&foo[one]=%E2%88%9A&two=2', ['foo[one]' => '√', 'two' => 2]]
990  ];
991  }
992 
994  // Tests concerning compileSelectedGetVarsFromArray
996 
1000  {
1001  $filter = 'foo,bar';
1002  $getArray = ['foo' => 1, 'cake' => 'lie'];
1003  $expected = ['foo' => 1];
1004  $result = GeneralUtility::compileSelectedGetVarsFromArray($filter, $getArray, false);
1005  self::assertSame($expected, $result);
1006  }
1007 
1012  {
1013  $_GET['bar'] = '2';
1014  $filter = 'foo,bar';
1015  $getArray = ['foo' => 1, 'cake' => 'lie'];
1016  $expected = ['foo' => 1, 'bar' => '2'];
1017  $result = GeneralUtility::compileSelectedGetVarsFromArray($filter, $getArray, true);
1018  self::assertSame($expected, $result);
1019  }
1020 
1022  // Tests concerning revExplode
1024 
1028  public function ‪revExplodeDataProvider()
1029  {
1030  return [
1031  'limit 0 should return unexploded string' => [
1032  ':',
1033  'my:words:here',
1034  0,
1035  ['my:words:here']
1036  ],
1037  'limit 1 should return unexploded string' => [
1038  ':',
1039  'my:words:here',
1040  1,
1041  ['my:words:here']
1042  ],
1043  'limit 2 should return two pieces' => [
1044  ':',
1045  'my:words:here',
1046  2,
1047  ['my:words', 'here']
1048  ],
1049  'limit 3 should return unexploded string' => [
1050  ':',
1051  'my:words:here',
1052  3,
1053  ['my', 'words', 'here']
1054  ],
1055  'limit 0 should return unexploded string if no delimiter is contained' => [
1056  ':',
1057  'mywordshere',
1058  0,
1059  ['mywordshere']
1060  ],
1061  'limit 1 should return unexploded string if no delimiter is contained' => [
1062  ':',
1063  'mywordshere',
1064  1,
1065  ['mywordshere']
1066  ],
1067  'limit 2 should return unexploded string if no delimiter is contained' => [
1068  ':',
1069  'mywordshere',
1070  2,
1071  ['mywordshere']
1072  ],
1073  'limit 3 should return unexploded string if no delimiter is contained' => [
1074  ':',
1075  'mywordshere',
1076  3,
1077  ['mywordshere']
1078  ],
1079  'multi character delimiter is handled properly with limit 2' => [
1080  '[]',
1081  'a[b][c][d]',
1082  2,
1083  ['a[b][c', 'd]']
1084  ],
1085  'multi character delimiter is handled properly with limit 3' => [
1086  '[]',
1087  'a[b][c][d]',
1088  3,
1089  ['a[b', 'c', 'd]']
1090  ],
1091  ];
1092  }
1093 
1098  public function ‪revExplodeCorrectlyExplodesStringForGivenPartsCount($delimiter, $testString, $count, $expectedArray)
1099  {
1100  $actualArray = ‪GeneralUtility::revExplode($delimiter, $testString, $count);
1101  self::assertEquals($expectedArray, $actualArray);
1102  }
1103 
1108  {
1109  $testString = 'even:more:of:my:words:here';
1110  $expectedArray = ['even:more:of:my', 'words', 'here'];
1111  $actualArray = ‪GeneralUtility::revExplode(':', $testString, 3);
1112  self::assertEquals($expectedArray, $actualArray);
1113  }
1114 
1116  // Tests concerning trimExplode
1118 
1128  public function ‪trimExplodeReturnsCorrectResult($delimiter, $testString, $removeEmpty, $limit, $expectedResult)
1129  {
1130  self::assertSame($expectedResult, ‪GeneralUtility::trimExplode($delimiter, $testString, $removeEmpty, $limit));
1131  }
1132 
1137  {
1138  return [
1139  'spaces at element start and end' => [
1140  ',',
1141  ' a , b , c ,d ,, e,f,',
1142  false,
1143  0,
1144  ['a', 'b', 'c', 'd', '', 'e', 'f', '']
1145  ],
1146  'removes newline' => [
1147  ',',
1148  ' a , b , ' . LF . ' ,d ,, e,f,',
1149  true,
1150  0,
1151  ['a', 'b', 'd', 'e', 'f']
1152  ],
1153  'removes empty elements' => [
1154  ',',
1155  'a , b , c , ,d ,, ,e,f,',
1156  true,
1157  0,
1158  ['a', 'b', 'c', 'd', 'e', 'f']
1159  ],
1160  'keeps remaining results with empty items after reaching limit with positive parameter' => [
1161  ',',
1162  ' a , b , c , , d,, ,e ',
1163  false,
1164  3,
1165  ['a', 'b', 'c , , d,, ,e']
1166  ],
1167  'keeps remaining results without empty items after reaching limit with positive parameter' => [
1168  ',',
1169  ' a , b , c , , d,, ,e ',
1170  true,
1171  3,
1172  ['a', 'b', 'c , d,e']
1173  ],
1174  'keeps remaining results with empty items after reaching limit with negative parameter' => [
1175  ',',
1176  ' a , b , c , d, ,e, f , , ',
1177  false,
1178  -3,
1179  ['a', 'b', 'c', 'd', '', 'e']
1180  ],
1181  'keeps remaining results without empty items after reaching limit with negative parameter' => [
1182  ',',
1183  ' a , b , c , d, ,e, f , , ',
1184  true,
1185  -3,
1186  ['a', 'b', 'c']
1187  ],
1188  'returns exact results without reaching limit with positive parameter' => [
1189  ',',
1190  ' a , b , , c , , , ',
1191  true,
1192  4,
1193  ['a', 'b', 'c']
1194  ],
1195  'keeps zero as string' => [
1196  ',',
1197  'a , b , c , ,d ,, ,e,f, 0 ,',
1198  true,
1199  0,
1200  ['a', 'b', 'c', 'd', 'e', 'f', '0']
1201  ],
1202  'keeps whitespace inside elements' => [
1203  ',',
1204  'a , b , c , ,d ,, ,e,f, g h ,',
1205  true,
1206  0,
1207  ['a', 'b', 'c', 'd', 'e', 'f', 'g h']
1208  ],
1209  'can use internal regex delimiter as explode delimiter' => [
1210  '/',
1211  'a / b / c / /d // /e/f/ g h /',
1212  true,
1213  0,
1214  ['a', 'b', 'c', 'd', 'e', 'f', 'g h']
1215  ],
1216  'can use whitespaces as delimiter' => [
1217  ' ',
1218  '* * * * *',
1219  true,
1220  0,
1221  ['*', '*', '*', '*', '*']
1222  ],
1223  'can use words as delimiter' => [
1224  'All',
1225  'HelloAllTogether',
1226  true,
1227  0,
1228  ['Hello', 'Together']
1229  ],
1230  'can use word with appended and prepended spaces as delimiter' => [
1231  ' all ',
1232  'Hello all together',
1233  true,
1234  0,
1235  ['Hello', 'together']
1236  ],
1237  'can use word with appended and prepended spaces as delimiter and do not remove empty' => [
1238  ' all ',
1239  'Hello all together all there all all are all none',
1240  false,
1241  0,
1242  ['Hello', 'together', 'there', '', 'are', 'none']
1243  ],
1244  'can use word with appended and prepended spaces as delimiter, do not remove empty and limit' => [
1245  ' all ',
1246  'Hello all together all there all all are all none',
1247  false,
1248  5,
1249  ['Hello', 'together', 'there', '', 'are all none']
1250  ],
1251  'can use word with appended and prepended spaces as delimiter, do not remove empty, limit and multiple delimiter in last' => [
1252  ' all ',
1253  'Hello all together all there all all are all none',
1254  false,
1255  4,
1256  ['Hello', 'together', 'there', 'all are all none']
1257  ],
1258  'can use word with appended and prepended spaces as delimiter, remove empty and limit' => [
1259  ' all ',
1260  'Hello all together all there all all are all none',
1261  true,
1262  4,
1263  ['Hello', 'together', 'there', 'are all none']
1264  ],
1265  'can use word with appended and prepended spaces as delimiter, remove empty and limit and multiple delimiter in last' => [
1266  ' all ',
1267  'Hello all together all there all all are all none',
1268  true,
1269  5,
1270  ['Hello', 'together', 'there', 'are' , 'none']
1271  ],
1272  'can use words as delimiter and do not remove empty' => [
1273  'all there',
1274  'Helloall theretogether all there all there are all there none',
1275  false,
1276  0,
1277  ['Hello', 'together', '', 'are', 'none']
1278  ],
1279  'can use words as delimiter, do not remove empty and limit' => [
1280  'all there',
1281  'Helloall theretogether all there all there are all there none',
1282  false,
1283  4,
1284  ['Hello', 'together', '', 'are all there none']
1285  ],
1286  'can use words as delimiter, do not remove empty, limit and multiple delimiter in last' => [
1287  'all there',
1288  'Helloall theretogether all there all there are all there none',
1289  false,
1290  3,
1291  ['Hello', 'together', 'all there are all there none']
1292  ],
1293  'can use words as delimiter, remove empty' => [
1294  'all there',
1295  'Helloall theretogether all there all there are all there none',
1296  true,
1297  0,
1298  ['Hello', 'together', 'are', 'none']
1299  ],
1300  'can use words as delimiter, remove empty and limit' => [
1301  'all there',
1302  'Helloall theretogether all there all there are all there none',
1303  true,
1304  3,
1305  ['Hello', 'together', 'are all there none']
1306  ],
1307  'can use words as delimiter, remove empty and limit and multiple delimiter in last' => [
1308  'all there',
1309  'Helloall theretogether all there all there are all there none',
1310  true,
1311  4,
1312  ['Hello', 'together', 'are' , 'none']
1313  ],
1314  'can use new line as delimiter' => [
1315  LF,
1316  "Hello\nall\ntogether",
1317  true,
1318  0,
1319  ['Hello', 'all', 'together']
1320  ],
1321  'works with whitespace separator' => [
1322  "\t",
1323  " a b \t c \t \t d \t e \t u j \t s",
1324  false,
1325  0,
1326  ['a b', 'c', '', 'd', 'e', 'u j', 's']
1327  ],
1328  'works with whitespace separator and limit' => [
1329  "\t",
1330  " a b \t c \t \t d \t e \t u j \t s",
1331  false,
1332  4,
1333  ['a b', 'c', '', "d \t e \t u j \t s"]
1334  ],
1335  'works with whitespace separator and remove empty' => [
1336  "\t",
1337  " a b \t c \t \t d \t e \t u j \t s",
1338  true,
1339  0,
1340  ['a b', 'c', 'd', 'e', 'u j', 's']
1341  ],
1342  'works with whitespace separator remove empty and limit' => [
1343  "\t",
1344  " a b \t c \t \t d \t e \t u j \t s",
1345  true,
1346  3,
1347  ['a b', 'c', "d \t e \t u j \t s"]
1348  ],
1349  ];
1350  }
1351 
1353  // Tests concerning getBytesFromSizeMeasurement
1355 
1361  {
1362  return [
1363  '100 kilo Bytes' => ['102400', '100k'],
1364  '100 mega Bytes' => ['104857600', '100m'],
1365  '100 giga Bytes' => ['107374182400', '100g']
1366  ];
1367  }
1368 
1373  public function ‪getBytesFromSizeMeasurementCalculatesCorrectByteValue($expected, $byteString)
1374  {
1375  self::assertEquals($expected, GeneralUtility::getBytesFromSizeMeasurement($byteString));
1376  }
1377 
1379  // Tests concerning getIndpEnv
1385  {
1386  self::assertTrue(strlen(GeneralUtility::getIndpEnv('TYPO3_SITE_PATH')) >= 1);
1387  }
1388 
1394  {
1397  true,
1398  false,
1403  ‪Environment::getBackendPath() . '/index.php',
1404  ‪Environment::isWindows() ? 'WINDOWS' : 'UNIX'
1405  );
1406  $result = GeneralUtility::getIndpEnv('TYPO3_SITE_PATH');
1407  self::assertEquals('/', $result[0]);
1408  }
1409 
1415  {
1416  $result = GeneralUtility::getIndpEnv('TYPO3_SITE_PATH');
1417  self::assertRegExp('/^[a-z]:\//i', $result);
1418  }
1419 
1424  {
1425  $result = GeneralUtility::getIndpEnv('TYPO3_SITE_PATH');
1426  self::assertEquals('/', $result[strlen($result) - 1]);
1427  }
1428 
1432  public static function ‪hostnameAndPortDataProvider()
1433  {
1434  return [
1435  'localhost ipv4 without port' => ['127.0.0.1', '127.0.0.1', ''],
1436  'localhost ipv4 with port' => ['127.0.0.1:81', '127.0.0.1', '81'],
1437  'localhost ipv6 without port' => ['[::1]', '[::1]', ''],
1438  'localhost ipv6 with port' => ['[::1]:81', '[::1]', '81'],
1439  'ipv6 without port' => ['[2001:DB8::1]', '[2001:DB8::1]', ''],
1440  'ipv6 with port' => ['[2001:DB8::1]:81', '[2001:DB8::1]', '81'],
1441  'hostname without port' => ['lolli.did.this', 'lolli.did.this', ''],
1442  'hostname with port' => ['lolli.did.this:42', 'lolli.did.this', '42']
1443  ];
1444  }
1445 
1450  public function ‪getIndpEnvTypo3HostOnlyParsesHostnamesAndIpAddresses($httpHost, $expectedIp)
1451  {
1452  $_SERVER['HTTP_HOST'] = $httpHost;
1453  self::assertEquals($expectedIp, GeneralUtility::getIndpEnv('TYPO3_HOST_ONLY'));
1454  }
1455 
1460  {
1461  unset(‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern']);
1462  self::assertFalse(‪GeneralUtilityFixture::isAllowedHostHeaderValue('evil.foo.bar'));
1463  }
1464 
1469  {
1470  return [
1471  'hostname without port matching' => ['lolli.did.this', '.*\.did\.this'],
1472  'other hostname without port matching' => ['helmut.did.this', '.*\.did\.this'],
1473  'two different hostnames without port matching 1st host' => ['helmut.is.secure', '(helmut\.is\.secure|lolli\.is\.secure)'],
1474  'two different hostnames without port matching 2nd host' => ['lolli.is.secure', '(helmut\.is\.secure|lolli\.is\.secure)'],
1475  'hostname with port matching' => ['lolli.did.this:42', '.*\.did\.this:42'],
1476  'hostnames are case insensitive 1' => ['lolli.DID.this:42', '.*\.did.this:42'],
1477  'hostnames are case insensitive 2' => ['lolli.did.this:42', '.*\.DID.this:42'],
1478  ];
1479  }
1480 
1485  {
1486  return [
1487  'hostname without port' => ['lolli.did.this', 'helmut\.did\.this'],
1488  'hostname with port, but port not allowed' => ['lolli.did.this:42', 'helmut\.did\.this'],
1489  'two different hostnames in pattern but host header starts with different value #1' => ['sub.helmut.is.secure', '(helmut\.is\.secure|lolli\.is\.secure)'],
1490  'two different hostnames in pattern but host header starts with different value #2' => ['sub.lolli.is.secure', '(helmut\.is\.secure|lolli\.is\.secure)'],
1491  'two different hostnames in pattern but host header ends with different value #1' => ['helmut.is.secure.tld', '(helmut\.is\.secure|lolli\.is\.secure)'],
1492  'two different hostnames in pattern but host header ends with different value #2' => ['lolli.is.secure.tld', '(helmut\.is\.secure|lolli\.is\.secure)'],
1493  ];
1494  }
1495 
1502  public function ‪isAllowedHostHeaderValueReturnsTrueIfHostValueMatches($httpHost, $hostNamePattern)
1503  {
1504  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = $hostNamePattern;
1505  self::assertTrue(‪GeneralUtilityFixture::isAllowedHostHeaderValue($httpHost));
1506  }
1507 
1514  public function ‪isAllowedHostHeaderValueReturnsFalseIfHostValueMatches($httpHost, $hostNamePattern)
1515  {
1516  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = $hostNamePattern;
1518  }
1519 
1520  public function ‪serverNamePatternDataProvider()
1521  {
1522  return [
1523  'host value matches server name and server port is default http' => [
1524  'httpHost' => 'secure.web.server',
1525  'serverName' => 'secure.web.server',
1526  'isAllowed' => true,
1527  'serverPort' => '80',
1528  'ssl' => 'Off',
1529  ],
1530  'host value matches server name if compared case insensitive 1' => [
1531  'httpHost' => 'secure.web.server',
1532  'serverName' => 'secure.WEB.server',
1533  'isAllowed' => true,
1534  ],
1535  'host value matches server name if compared case insensitive 2' => [
1536  'httpHost' => 'secure.WEB.server',
1537  'serverName' => 'secure.web.server',
1538  'isAllowed' => true,
1539  ],
1540  'host value matches server name and server port is default https' => [
1541  'httpHost' => 'secure.web.server',
1542  'serverName' => 'secure.web.server',
1543  'isAllowed' => true,
1544  'serverPort' => '443',
1545  'ssl' => 'On',
1546  ],
1547  'host value matches server name and server port' => [
1548  'httpHost' => 'secure.web.server:88',
1549  'serverName' => 'secure.web.server',
1550  'isAllowed' => true,
1551  'serverPort' => '88',
1552  ],
1553  'host value matches server name case insensitive 1 and server port' => [
1554  'httpHost' => 'secure.WEB.server:88',
1555  'serverName' => 'secure.web.server',
1556  'isAllowed' => true,
1557  'serverPort' => '88',
1558  ],
1559  'host value matches server name case insensitive 2 and server port' => [
1560  'httpHost' => 'secure.web.server:88',
1561  'serverName' => 'secure.WEB.server',
1562  'isAllowed' => true,
1563  'serverPort' => '88',
1564  ],
1565  'host value is ipv6 but matches server name and server port' => [
1566  'httpHost' => '[::1]:81',
1567  'serverName' => '[::1]',
1568  'isAllowed' => true,
1569  'serverPort' => '81',
1570  ],
1571  'host value does not match server name' => [
1572  'httpHost' => 'insecure.web.server',
1573  'serverName' => 'secure.web.server',
1574  'isAllowed' => false,
1575  ],
1576  'host value does not match server port' => [
1577  'httpHost' => 'secure.web.server:88',
1578  'serverName' => 'secure.web.server',
1579  'isAllowed' => false,
1580  'serverPort' => '89',
1581  ],
1582  'host value has default port that does not match server port' => [
1583  'httpHost' => 'secure.web.server',
1584  'serverName' => 'secure.web.server',
1585  'isAllowed' => false,
1586  'serverPort' => '81',
1587  'ssl' => 'Off',
1588  ],
1589  'host value has default port that does not match server ssl port' => [
1590  'httpHost' => 'secure.web.server',
1591  'serverName' => 'secure.web.server',
1592  'isAllowed' => false,
1593  'serverPort' => '444',
1594  'ssl' => 'On',
1595  ],
1596  ];
1597  }
1598 
1609  public function ‪isAllowedHostHeaderValueWorksCorrectlyWithWithServerNamePattern($httpHost, $serverName, $isAllowed, $serverPort = '80', $ssl = 'Off')
1610  {
1611  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = ‪GeneralUtility::ENV_TRUSTED_HOSTS_PATTERN_SERVER_NAME;
1612  $_SERVER['SERVER_NAME'] = $serverName;
1613  $_SERVER['SERVER_PORT'] = $serverPort;
1614  $_SERVER['HTTPS'] = $ssl;
1615  self::assertSame($isAllowed, ‪GeneralUtilityFixture::isAllowedHostHeaderValue($httpHost));
1616  }
1617 
1628  public function ‪isAllowedHostHeaderValueWorksCorrectlyWithWithServerNamePatternAndSslProxy($httpHost, $serverName, $isAllowed, $serverPort = '80', $ssl = 'Off')
1629  {
1630  $backup = ['sys' => ‪$GLOBALS['TYPO3_CONF_VARS']['SYS'], 'server' => $_SERVER];
1631 
1632  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = ‪GeneralUtility::ENV_TRUSTED_HOSTS_PATTERN_SERVER_NAME;
1633  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxySSL'] = '*';
1634  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['reverseProxyIP'] = '10.0.0.1';
1635 
1636  $_SERVER['REMOTE_ADDR'] = '10.0.0.1';
1637  $_SERVER['SERVER_NAME'] = $serverName;
1638  $_SERVER['SERVER_PORT'] = $serverPort;
1639  $_SERVER['HTTPS'] = $ssl;
1640 
1641  self::assertSame($isAllowed, ‪GeneralUtilityFixture::isAllowedHostHeaderValue($httpHost));
1642 
1643  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS'] = $backup['sys'];
1644  $_SERVER = $backup['server'];
1645  }
1646 
1651  {
1652  GeneralUtilityFixture::getIndpEnv('HTTP_HOST');
1653  GeneralUtility::flushInternalRuntimeCaches();
1654  GeneralUtilityFixture::getIndpEnv('TYPO3_HOST_ONLY');
1655  GeneralUtility::flushInternalRuntimeCaches();
1656  GeneralUtilityFixture::getIndpEnv('TYPO3_REQUEST_HOST');
1657  GeneralUtility::flushInternalRuntimeCaches();
1658  GeneralUtilityFixture::getIndpEnv('TYPO3_REQUEST_URL');
1660  }
1661 
1668  public function ‪getIndpEnvForHostThrowsExceptionForNotAllowedHostnameValues($httpHost, $hostNamePattern)
1669  {
1670  $this->expectException(\UnexpectedValueException::class);
1671  $this->expectExceptionCode(1396795884);
1672  $_SERVER['HTTP_HOST'] = $httpHost;
1673  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = $hostNamePattern;
1674  GeneralUtilityFixture::getIndpEnv('HTTP_HOST');
1675  }
1676 
1683  public function ‪getIndpEnvForHostAllowsAllHostnameValuesIfHostPatternIsSetToAllowAll($httpHost, $hostNamePattern)
1684  {
1685  $_SERVER['HTTP_HOST'] = $httpHost;
1686  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = ‪GeneralUtility::ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL;
1687  self::assertSame($httpHost, GeneralUtility::getIndpEnv('HTTP_HOST'));
1688  }
1689 
1694  public function ‪getIndpEnvTypo3PortParsesHostnamesAndIpAddresses($httpHost, $dummy, $expectedPort)
1695  {
1696  $_SERVER['HTTP_HOST'] = $httpHost;
1697  self::assertEquals($expectedPort, GeneralUtility::getIndpEnv('TYPO3_PORT'));
1698  }
1699 
1701  // Tests concerning underscoredToUpperCamelCase
1703 
1709  {
1710  return [
1711  'single word' => ['Blogexample', 'blogexample'],
1712  'multiple words' => ['BlogExample', 'blog_example']
1713  ];
1714  }
1715 
1720  public function ‪underscoredToUpperCamelCase($expected, $inputString)
1721  {
1722  self::assertEquals($expected, ‪GeneralUtility::underscoredToUpperCamelCase($inputString));
1723  }
1724 
1726  // Tests concerning underscoredToLowerCamelCase
1728 
1734  {
1735  return [
1736  'single word' => ['minimalvalue', 'minimalvalue'],
1737  'multiple words' => ['minimalValue', 'minimal_value']
1738  ];
1739  }
1740 
1745  public function ‪underscoredToLowerCamelCase($expected, $inputString)
1746  {
1747  self::assertEquals($expected, ‪GeneralUtility::underscoredToLowerCamelCase($inputString));
1748  }
1749 
1751  // Tests concerning camelCaseToLowerCaseUnderscored
1753 
1759  {
1760  return [
1761  'single word' => ['blogexample', 'blogexample'],
1762  'single word starting upper case' => ['blogexample', 'Blogexample'],
1763  'two words starting lower case' => ['minimal_value', 'minimalValue'],
1764  'two words starting upper case' => ['blog_example', 'BlogExample']
1765  ];
1766  }
1767 
1772  public function ‪camelCaseToLowerCaseUnderscored($expected, $inputString)
1773  {
1774  self::assertEquals($expected, ‪GeneralUtility::camelCaseToLowerCaseUnderscored($inputString));
1775  }
1776 
1778  // Tests concerning isValidUrl
1780 
1785  public function ‪validUrlValidResourceDataProvider()
1786  {
1787  return [
1788  'http' => ['http://www.example.org/'],
1789  'http without trailing slash' => ['http://qwe'],
1790  'http directory with trailing slash' => ['http://www.example/img/dir/'],
1791  'http directory without trailing slash' => ['http://www.example/img/dir'],
1792  'http index.html' => ['http://example.com/index.html'],
1793  'http index.php' => ['http://www.example.com/index.php'],
1794  'http test.png' => ['http://www.example/img/test.png'],
1795  'http username password querystring and anchor' => ['https://user:pw@www.example.org:80/path?arg=value#fragment'],
1796  'file' => ['file:///tmp/test.c'],
1797  'file directory' => ['file://foo/bar'],
1798  'ftp directory' => ['ftp://ftp.example.com/tmp/'],
1799  'mailto' => ['mailto:foo@bar.com'],
1800  'news' => ['news:news.php.net'],
1801  'telnet' => ['telnet://192.0.2.16:80/'],
1802  'ldap' => ['ldap://[2001:db8::7]/c=GB?objectClass?one'],
1803  'http punycode domain name' => ['http://www.xn--bb-eka.at'],
1804  'http punicode subdomain' => ['http://xn--h-zfa.oebb.at'],
1805  'http domain-name umlauts' => ['http://www.öbb.at'],
1806  'http subdomain umlauts' => ['http://äh.oebb.at'],
1807  ];
1808  }
1809 
1814  public function ‪validURLReturnsTrueForValidResource($url)
1815  {
1816  self::assertTrue(‪GeneralUtility::isValidUrl($url));
1817  }
1818 
1825  {
1826  return [
1827  'http missing colon' => ['http//www.example/wrong/url/'],
1828  'http missing slash' => ['http:/www.example'],
1829  'hostname only' => ['www.example.org/'],
1830  'file missing protocol specification' => ['/tmp/test.c'],
1831  'slash only' => ['/'],
1832  'string http://' => ['http://'],
1833  'string http:/' => ['http:/'],
1834  'string http:' => ['http:'],
1835  'string http' => ['http'],
1836  'empty string' => [''],
1837  'string -1' => ['-1'],
1838  'string array()' => ['array()'],
1839  'random string' => ['qwe'],
1840  'http directory umlauts' => ['http://www.oebb.at/äöü/'],
1841  'prohibited input characters' => ['https://{$unresolved_constant}'],
1842  ];
1843  }
1844 
1849  public function ‪validURLReturnsFalseForInvalidResource($url)
1850  {
1851  self::assertFalse(‪GeneralUtility::isValidUrl($url));
1852  }
1853 
1855  // Tests concerning isOnCurrentHost
1861  {
1862  $testUrl = GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL');
1863  self::assertTrue(GeneralUtility::isOnCurrentHost($testUrl));
1864  }
1865 
1871  public function ‪checkisOnCurrentHostInvalidHosts()
1872  {
1873  return [
1874  'empty string' => [''],
1875  'arbitrary string' => ['arbitrary string'],
1876  'localhost IP' => ['127.0.0.1'],
1877  'relative path' => ['./relpath/file.txt'],
1878  'absolute path' => ['/abspath/file.txt?arg=value'],
1879  'different host' => [GeneralUtility::getIndpEnv('TYPO3_REQUEST_HOST') . '.example.org']
1880  ];
1881  }
1882 
1884  // Tests concerning sanitizeLocalUrl
1886 
1892  {
1893  return [
1894  'alt_intro.php' => ['alt_intro.php'],
1895  'alt_intro.php?foo=1&bar=2' => ['alt_intro.php?foo=1&bar=2'],
1896  '../index.php' => ['../index.php'],
1897  '../typo3/alt_intro.php' => ['../typo3/alt_intro.php'],
1898  '../~userDirectory/index.php' => ['../~userDirectory/index.php'],
1899  '../typo3/index.php?var1=test-case&var2=~user' => ['../typo3/index.php?var1=test-case&var2=~user'],
1900  ‪Environment::getPublicPath() . '/typo3/alt_intro.php' => [‪Environment::getPublicPath() . '/typo3/alt_intro.php'],
1901  ];
1902  }
1903 
1909  public function ‪sanitizeLocalUrlAcceptsNotEncodedValidPaths($path)
1910  {
1913  true,
1914  false,
1919  ‪Environment::getBackendPath() . '/index.php',
1920  ‪Environment::isWindows() ? 'WINDOWS' : 'UNIX'
1921  );
1922  self::assertEquals($path, GeneralUtility::sanitizeLocalUrl($path));
1923  }
1924 
1930  public function ‪sanitizeLocalUrlAcceptsEncodedValidPaths($path)
1931  {
1934  true,
1935  false,
1940  ‪Environment::getBackendPath() . '/index.php',
1941  ‪Environment::isWindows() ? 'WINDOWS' : 'UNIX'
1942  );
1943  self::assertEquals(rawurlencode($path), GeneralUtility::sanitizeLocalUrl(rawurlencode($path)));
1944  }
1945 
1952  {
1953  return [
1954  '/cms/typo3/alt_intro.php' => [
1955  '/cms/typo3/alt_intro.php',
1956  'localhost',
1957  '/cms/',
1958  ],
1959  '/cms/index.php' => [
1960  '/cms/index.php',
1961  'localhost',
1962  '/cms/',
1963  ],
1964  'http://localhost/typo3/alt_intro.php' => [
1965  'http://localhost/typo3/alt_intro.php',
1966  'localhost',
1967  '',
1968  ],
1969  'http://localhost/cms/typo3/alt_intro.php' => [
1970  'http://localhost/cms/typo3/alt_intro.php',
1971  'localhost',
1972  '/cms/',
1973  ],
1974  ];
1975  }
1976 
1984  public function ‪sanitizeLocalUrlAcceptsNotEncodedValidUrls($url, $host, $subDirectory)
1985  {
1988  true,
1989  false,
1994  ‪Environment::getBackendPath() . '/index.php',
1995  ‪Environment::isWindows() ? 'WINDOWS' : 'UNIX'
1996  );
1997  $_SERVER['HTTP_HOST'] = $host;
1998  $_SERVER['SCRIPT_NAME'] = $subDirectory . 'typo3/index.php';
1999  self::assertEquals($url, GeneralUtility::sanitizeLocalUrl($url));
2000  }
2001 
2009  public function ‪sanitizeLocalUrlAcceptsEncodedValidUrls($url, $host, $subDirectory)
2010  {
2013  true,
2014  false,
2019  ‪Environment::getBackendPath() . '/index.php',
2020  ‪Environment::isWindows() ? 'WINDOWS' : 'UNIX'
2021  );
2022  $_SERVER['HTTP_HOST'] = $host;
2023  $_SERVER['SCRIPT_NAME'] = $subDirectory . 'typo3/index.php';
2024  self::assertEquals(rawurlencode($url), GeneralUtility::sanitizeLocalUrl(rawurlencode($url)));
2025  }
2026 
2032  public function ‪sanitizeLocalUrlInvalidDataProvider()
2033  {
2034  return [
2035  'empty string' => [''],
2036  'http domain' => ['http://www.google.de/'],
2037  'https domain' => ['https://www.google.de/'],
2038  'domain without schema' => ['//www.google.de/'],
2039  'XSS attempt' => ['" onmouseover="alert(123)"'],
2040  'invalid URL, UNC path' => ['\\\\foo\\bar\\'],
2041  'invalid URL, HTML break out attempt' => ['" >blabuubb'],
2042  'base64 encoded string' => ['data:%20text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4='],
2043  ];
2044  }
2045 
2051  public function ‪sanitizeLocalUrlDeniesPlainInvalidUrlsInBackendContext(string $url): void
2052  {
2055  true,
2056  false,
2061  ‪Environment::getBackendPath() . '/index.php',
2062  ‪Environment::isWindows() ? 'WINDOWS' : 'UNIX'
2063  );
2064  $_SERVER['HTTP_HOST'] = 'localhost';
2065  $_SERVER['SCRIPT_NAME'] = 'typo3/index.php';
2066  self::assertEquals('', GeneralUtility::sanitizeLocalUrl($url));
2067  }
2068 
2074  public function ‪sanitizeLocalUrlDeniesPlainInvalidUrlsInFrontendContext(string $url): void
2075  {
2078  true,
2079  false,
2084  ‪Environment::getPublicPath() . '/index.php',
2085  ‪Environment::isWindows() ? 'WINDOWS' : 'UNIX'
2086  );
2087  $_SERVER['HTTP_HOST'] = 'localhost';
2088  $_SERVER['SCRIPT_NAME'] = 'index.php';
2089  self::assertEquals('', GeneralUtility::sanitizeLocalUrl($url));
2090  }
2091 
2096  public function ‪sanitizeLocalUrlDeniesEncodedInvalidUrls($url)
2097  {
2098  self::assertEquals('', GeneralUtility::sanitizeLocalUrl(rawurlencode($url)));
2099  }
2100 
2102  // Tests concerning unlink_tempfile
2104 
2109  {
2110  $fixtureFile = __DIR__ . '/Fixtures/clear.gif';
2111  $testFilename = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('test_') . '.gif';
2112  @copy($fixtureFile, $testFilename);
2113  GeneralUtility::unlink_tempfile($testFilename);
2114  $fileExists = file_exists($testFilename);
2115  self::assertFalse($fileExists);
2116  }
2117 
2121  public function ‪unlink_tempfileRemovesHiddenFile()
2122  {
2123  $fixtureFile = __DIR__ . '/Fixtures/clear.gif';
2124  $testFilename = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('.test_') . '.gif';
2125  @copy($fixtureFile, $testFilename);
2126  GeneralUtility::unlink_tempfile($testFilename);
2127  $fileExists = file_exists($testFilename);
2128  self::assertFalse($fileExists);
2129  }
2130 
2135  {
2136  $fixtureFile = __DIR__ . '/Fixtures/clear.gif';
2137  $testFilename = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('test_') . '.gif';
2138  @copy($fixtureFile, $testFilename);
2139  $returnValue = GeneralUtility::unlink_tempfile($testFilename);
2140  self::assertTrue($returnValue);
2141  }
2142 
2147  {
2148  $returnValue = GeneralUtility::unlink_tempfile(‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('i_do_not_exist'));
2149  self::assertNull($returnValue);
2150  }
2151 
2156  {
2157  $returnValue = GeneralUtility::unlink_tempfile('/tmp/typo3-unit-test-unlink_tempfile');
2158  self::assertNull($returnValue);
2159  }
2160 
2162  // Tests concerning tempnam
2164 
2169  {
2170  $filePath = GeneralUtility::tempnam('foo');
2171  $this->testFilesToDelete[] = $filePath;
2172  $fileName = basename($filePath);
2173  self::assertStringStartsWith('foo', $fileName);
2174  }
2175 
2179  public function ‪tempnamReturnsPathWithoutBackslashes()
2180  {
2181  $filePath = GeneralUtility::tempnam('foo');
2182  $this->testFilesToDelete[] = $filePath;
2183  self::assertStringNotContainsString('\\', $filePath);
2184  }
2185 
2189  public function ‪tempnamReturnsAbsolutePathInVarPath()
2190  {
2191  $filePath = GeneralUtility::tempnam('foo');
2192  $this->testFilesToDelete[] = $filePath;
2193  self::assertStringStartsWith(‪Environment::getVarPath() . '/transient/', $filePath);
2194  }
2195 
2197  // Tests concerning removeDotsFromTS
2203  {
2204  $typoScript = [
2205  'propertyA.' => [
2206  'keyA.' => [
2207  'valueA' => 1
2208  ],
2209  'keyB' => 2
2210  ],
2211  'propertyB' => 3
2212  ];
2213  $expectedResult = [
2214  'propertyA' => [
2215  'keyA' => [
2216  'valueA' => 1
2217  ],
2218  'keyB' => 2
2219  ],
2220  'propertyB' => 3
2221  ];
2222  self::assertEquals($expectedResult, GeneralUtility::removeDotsFromTS($typoScript));
2223  }
2224 
2229  {
2230  $typoScript = [
2231  'propertyA.' => [
2232  'keyA' => 'getsOverridden',
2233  'keyA.' => [
2234  'valueA' => 1
2235  ],
2236  'keyB' => 2
2237  ],
2238  'propertyB' => 3
2239  ];
2240  $expectedResult = [
2241  'propertyA' => [
2242  'keyA' => [
2243  'valueA' => 1
2244  ],
2245  'keyB' => 2
2246  ],
2247  'propertyB' => 3
2248  ];
2249  self::assertEquals($expectedResult, GeneralUtility::removeDotsFromTS($typoScript));
2250  }
2251 
2256  {
2257  $typoScript = [
2258  'propertyA.' => [
2259  'keyA.' => [
2260  'valueA' => 1
2261  ],
2262  'keyA' => 'willOverride',
2263  'keyB' => 2
2264  ],
2265  'propertyB' => 3
2266  ];
2267  $expectedResult = [
2268  'propertyA' => [
2269  'keyA' => 'willOverride',
2270  'keyB' => 2
2271  ],
2272  'propertyB' => 3
2273  ];
2274  self::assertEquals($expectedResult, GeneralUtility::removeDotsFromTS($typoScript));
2275  }
2276 
2278  // Tests concerning get_dirs
2284  {
2286  self::assertIsArray($directories);
2287  }
2288 
2293  {
2294  $path = 'foo';
2295  $result = ‪GeneralUtility::get_dirs($path);
2296  $expectedResult = 'error';
2297  self::assertEquals($expectedResult, $result);
2298  }
2299 
2301  // Tests concerning hmac
2306  public function ‪hmacReturnsHashOfProperLength()
2307  {
2308  $hmac = GeneralUtility::hmac('message');
2309  self::assertTrue(!empty($hmac) && is_string($hmac));
2310  self::assertTrue(strlen($hmac) == 40);
2311  }
2312 
2316  public function ‪hmacReturnsEqualHashesForEqualInput()
2317  {
2318  $msg0 = 'message';
2319  $msg1 = 'message';
2320  self::assertEquals(GeneralUtility::hmac($msg0), GeneralUtility::hmac($msg1));
2321  }
2322 
2327  {
2328  $msg0 = 'message0';
2329  $msg1 = 'message1';
2330  self::assertNotEquals(GeneralUtility::hmac($msg0), GeneralUtility::hmac($msg1));
2331  }
2332 
2334  // Tests concerning quoteJSvalue
2336 
2341  public function ‪quoteJsValueDataProvider()
2342  {
2343  return [
2344  'Immune characters are returned as is' => [
2345  '._,',
2346  '._,'
2347  ],
2348  'Alphanumerical characters are returned as is' => [
2349  'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
2350  'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
2351  ],
2352  'Angle brackets and ampersand are encoded' => [
2353  '<>&',
2354  '\\u003C\\u003E\\u0026'
2355  ],
2356  'Quotes and backslashes are encoded' => [
2357  '"\'\\',
2358  '\\u0022\\u0027\\u005C'
2359  ],
2360  'Forward slashes are escaped' => [
2361  '</script>',
2362  '\\u003C\\/script\\u003E'
2363  ],
2364  'Empty string stays empty' => [
2365  '',
2366  ''
2367  ],
2368  'Exclamation mark and space are properly encoded' => [
2369  'Hello World!',
2370  'Hello\\u0020World\\u0021'
2371  ],
2372  'Whitespaces are properly encoded' => [
2373  "\t" . LF . CR . ' ',
2374  '\\u0009\\u000A\\u000D\\u0020'
2375  ],
2376  'Null byte is properly encoded' => [
2377  "\0",
2378  '\\u0000'
2379  ],
2380  'Umlauts are properly encoded' => [
2381  'ÜüÖöÄä',
2382  '\\u00dc\\u00fc\\u00d6\\u00f6\\u00c4\\u00e4'
2383  ]
2384  ];
2385  }
2386 
2393  public function ‪quoteJsValueTest($input, $expected)
2394  {
2395  self::assertSame('\'' . $expected . '\'', GeneralUtility::quoteJSvalue($input));
2396  }
2397 
2399  // Tests concerning minifyJavaScript
2405  {
2406  unset(‪$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_div.php']['minifyJavaScript']);
2407  $testString = ‪StringUtility::getUniqueId('string');
2408  self::assertSame($testString, ‪GeneralUtility::minifyJavaScript($testString));
2409  }
2410 
2412  // Tests concerning fixPermissions
2414 
2418  public function ‪fixPermissionsSetsGroup()
2419  {
2420  if (‪Environment::isWindows()) {
2421  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2422  }
2423  // Create and prepare test file
2424  $filename = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_');
2426  $currentGroupId = posix_getegid();
2427  // Set target group and run method
2428  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['createGroup'] = $currentGroupId;
2430  clearstatcache();
2431  self::assertEquals($currentGroupId, filegroup($filename));
2432  }
2433 
2437  public function ‪fixPermissionsSetsPermissionsToFile()
2438  {
2439  if (‪Environment::isWindows()) {
2440  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2441  }
2442  // Create and prepare test file
2443  $filename = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_');
2445  chmod($filename, 482);
2446  // Set target permissions and run method
2447  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = '0660';
2448  $fixPermissionsResult = ‪GeneralUtilityFilesystemFixture::fixPermissions($filename);
2449  clearstatcache();
2450  self::assertTrue($fixPermissionsResult);
2451  self::assertEquals('0660', substr(decoct(fileperms($filename)), 2));
2452  }
2453 
2458  {
2459  if (‪Environment::isWindows()) {
2460  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2461  }
2462  // Create and prepare test file
2463  $filename = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_');
2465  chmod($filename, 482);
2466  // Set target permissions and run method
2467  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = '0660';
2468  $fixPermissionsResult = ‪GeneralUtilityFilesystemFixture::fixPermissions($filename);
2469  clearstatcache();
2470  self::assertTrue($fixPermissionsResult);
2471  self::assertEquals('0660', substr(decoct(fileperms($filename)), 2));
2472  }
2473 
2478  {
2479  if (‪Environment::isWindows()) {
2480  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2481  }
2482  // Create and prepare test directory
2483  $directory = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_');
2485  chmod($directory, 1551);
2486  // Set target permissions and run method
2487  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0770';
2488  $fixPermissionsResult = ‪GeneralUtilityFilesystemFixture::fixPermissions($directory);
2489  clearstatcache();
2490  self::assertTrue($fixPermissionsResult);
2491  self::assertEquals('0770', substr(decoct(fileperms($directory)), 1));
2492  }
2493 
2498  {
2499  if (‪Environment::isWindows()) {
2500  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2501  }
2502  // Create and prepare test directory
2503  $directory = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_');
2505  chmod($directory, 1551);
2506  // Set target permissions and run method
2507  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0770';
2508  $fixPermissionsResult = ‪GeneralUtilityFilesystemFixture::fixPermissions($directory . '/');
2509  // Get actual permissions and clean up
2510  clearstatcache();
2511  self::assertTrue($fixPermissionsResult);
2512  self::assertEquals('0770', substr(decoct(fileperms($directory)), 1));
2513  }
2514 
2519  {
2520  if (‪Environment::isWindows()) {
2521  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2522  }
2523  // Create and prepare test directory
2524  $directory = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_');
2526  chmod($directory, 1551);
2527  // Set target permissions and run method
2528  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0770';
2529  $fixPermissionsResult = ‪GeneralUtilityFilesystemFixture::fixPermissions($directory);
2530  // Get actual permissions and clean up
2531  clearstatcache();
2532  self::assertTrue($fixPermissionsResult);
2533  self::assertEquals('0770', substr(decoct(fileperms($directory)), 1));
2534  }
2535 
2540  {
2541  if (‪Environment::isWindows()) {
2542  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2543  }
2544  // Create and prepare test directory and file structure
2545  $baseDirectory = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_');
2547  chmod($baseDirectory, 1751);
2548  ‪GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($baseDirectory . '/file', '42');
2549  chmod($baseDirectory . '/file', 482);
2550  ‪GeneralUtilityFilesystemFixture::mkdir($baseDirectory . '/foo');
2551  chmod($baseDirectory . '/foo', 1751);
2552  ‪GeneralUtilityFilesystemFixture::writeFileToTypo3tempDir($baseDirectory . '/foo/file', '42');
2553  chmod($baseDirectory . '/foo/file', 482);
2554  ‪GeneralUtilityFilesystemFixture::mkdir($baseDirectory . '/.bar');
2555  chmod($baseDirectory . '/.bar', 1751);
2556  // Use this if writeFileToTypo3tempDir is fixed to create hidden files in subdirectories
2557  // \TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($baseDirectory . '/.bar/.file', '42');
2558  // \TYPO3\CMS\Core\Utility\GeneralUtility::writeFileToTypo3tempDir($baseDirectory . '/.bar/..file2', '42');
2559  touch($baseDirectory . '/.bar/.file', '42');
2560  chmod($baseDirectory . '/.bar/.file', 482);
2561  touch($baseDirectory . '/.bar/..file2', '42');
2562  chmod($baseDirectory . '/.bar/..file2', 482);
2563  // Set target permissions and run method
2564  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = '0660';
2565  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0770';
2566  $fixPermissionsResult = ‪GeneralUtilityFilesystemFixture::fixPermissions($baseDirectory, true);
2567  // Get actual permissions
2568  clearstatcache();
2569  $resultBaseDirectoryPermissions = substr(decoct(fileperms($baseDirectory)), 1);
2570  $resultBaseFilePermissions = substr(decoct(fileperms($baseDirectory . '/file')), 2);
2571  $resultFooDirectoryPermissions = substr(decoct(fileperms($baseDirectory . '/foo')), 1);
2572  $resultFooFilePermissions = substr(decoct(fileperms($baseDirectory . '/foo/file')), 2);
2573  $resultBarDirectoryPermissions = substr(decoct(fileperms($baseDirectory . '/.bar')), 1);
2574  $resultBarFilePermissions = substr(decoct(fileperms($baseDirectory . '/.bar/.file')), 2);
2575  $resultBarFile2Permissions = substr(decoct(fileperms($baseDirectory . '/.bar/..file2')), 2);
2576  // Test if everything was ok
2577  self::assertTrue($fixPermissionsResult);
2578  self::assertEquals('0770', $resultBaseDirectoryPermissions);
2579  self::assertEquals('0660', $resultBaseFilePermissions);
2580  self::assertEquals('0770', $resultFooDirectoryPermissions);
2581  self::assertEquals('0660', $resultFooFilePermissions);
2582  self::assertEquals('0770', $resultBarDirectoryPermissions);
2583  self::assertEquals('0660', $resultBarFilePermissions);
2584  self::assertEquals('0660', $resultBarFile2Permissions);
2585  }
2586 
2591  {
2592  if (‪Environment::isWindows()) {
2593  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2594  }
2595  // Create and prepare test file
2596  $filename = ‪Environment::getVarPath() . '/tests/../../../typo3temp/var/tests/' . ‪StringUtility::getUniqueId('test_');
2597  // Set target permissions and run method
2598  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = '0660';
2599  $fixPermissionsResult = ‪GeneralUtility::fixPermissions($filename);
2600  self::assertFalse($fixPermissionsResult);
2601  }
2602 
2607  {
2608  if (‪Environment::isWindows()) {
2609  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2610  }
2611  $filename = 'typo3temp/var/tests/' . ‪StringUtility::getUniqueId('test_');
2613  $this->testFilesToDelete[] = ‪Environment::getPublicPath() . '/' . $filename;
2614  chmod(‪Environment::getPublicPath() . '/' . $filename, 482);
2615  // Set target permissions and run method
2616  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask'] = '0660';
2617  $fixPermissionsResult = ‪GeneralUtility::fixPermissions($filename);
2618  clearstatcache();
2619  self::assertTrue($fixPermissionsResult);
2620  self::assertEquals('0660', substr(decoct(fileperms(‪Environment::getPublicPath() . '/' . $filename)), 2));
2621  }
2622 
2627  {
2628  if (‪Environment::isWindows()) {
2629  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2630  }
2631  $filename = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_');
2633  chmod($filename, 482);
2634  unset(‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['fileCreateMask']);
2635  $fixPermissionsResult = ‪GeneralUtilityFilesystemFixture::fixPermissions($filename);
2636  clearstatcache();
2637  self::assertTrue($fixPermissionsResult);
2638  self::assertEquals('0644', substr(decoct(fileperms($filename)), 2));
2639  }
2640 
2645  {
2646  if (‪Environment::isWindows()) {
2647  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2648  }
2649  $directory = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_');
2651  chmod($directory, 1551);
2652  unset(‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask']);
2653  $fixPermissionsResult = ‪GeneralUtilityFilesystemFixture::fixPermissions($directory);
2654  clearstatcache();
2655  self::assertTrue($fixPermissionsResult);
2656  self::assertEquals('0755', substr(decoct(fileperms($directory)), 1));
2657  }
2658 
2660  // Tests concerning mkdir
2665  public function ‪mkdirCreatesDirectory()
2666  {
2667  $directory = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_');
2668  $mkdirResult = ‪GeneralUtilityFilesystemFixture::mkdir($directory);
2669  clearstatcache();
2670  self::assertTrue($mkdirResult);
2671  self::assertTrue(is_dir($directory));
2672  }
2673 
2677  public function ‪mkdirCreatesHiddenDirectory()
2678  {
2679  $directory = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('.test_');
2680  $mkdirResult = ‪GeneralUtilityFilesystemFixture::mkdir($directory);
2681  clearstatcache();
2682  self::assertTrue($mkdirResult);
2683  self::assertTrue(is_dir($directory));
2684  }
2685 
2690  {
2691  $directory = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_') . '/';
2692  $mkdirResult = ‪GeneralUtilityFilesystemFixture::mkdir($directory);
2693  clearstatcache();
2694  self::assertTrue($mkdirResult);
2695  self::assertTrue(is_dir($directory));
2696  }
2697 
2702  {
2703  if (‪Environment::isWindows()) {
2704  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2705  }
2706  $directory = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_');
2707  $oldUmask = umask(19);
2708  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0772';
2710  clearstatcache();
2711  $resultDirectoryPermissions = substr(decoct(fileperms($directory)), 1);
2712  umask($oldUmask);
2713  self::assertEquals($resultDirectoryPermissions, '0772');
2714  }
2715 
2720  {
2721  $swapGroup = $this->‪checkGroups(__FUNCTION__);
2722  if ($swapGroup !== false) {
2723  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['createGroup'] = $swapGroup;
2724  $directory = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('mkdirtest_');
2726  clearstatcache();
2727  $resultDirectoryGroup = filegroup($directory);
2728  self::assertEquals($resultDirectoryGroup, $swapGroup);
2729  }
2730  }
2731 
2733  // Helper function for filesystem ownership tests
2735 
2744  private function ‪checkGroups($methodName)
2745  {
2746  if (‪Environment::isWindows()) {
2747  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2748  return false;
2749  }
2750  $groups = posix_getgroups();
2751  if (count($groups) <= 1) {
2752  self::markTestSkipped($methodName . '() test cannot be done when the web server user is only member of 1 group.');
2753  return false;
2754  }
2755  $secondaryGroups = array_diff($groups, [posix_getegid()]);
2756  return array_shift($secondaryGroups);
2757  }
2758 
2760  // Tests concerning writeFileToTypo3tempDir()
2762 
2767  {
2768  return [
2769  [
2770  ‪Environment::getPublicPath() . '/../path/this-path-has-more-than-60-characters-in-one-base-path-you-can-even-count-more',
2771  'Input filepath "' . ‪Environment::getPublicPath() . '/../path/this-path-has-more-than-60-characters-in-one-base-path-you-can-even-count-more" was generally invalid!'
2772  ],
2773  [
2774  ‪Environment::getPublicPath() . '/dummy/path/this-path-has-more-than-60-characters-in-one-base-path-you-can-even-count-more',
2775  'Input filepath "' . ‪Environment::getPublicPath() . '/dummy/path/this-path-has-more-than-60-characters-in-one-base-path-you-can-even-count-more" was generally invalid!'
2776  ],
2777  [
2778  ‪Environment::getPublicPath() . '/dummy/path/this-path-has-more-than-60-characters-in-one-base-path-you-can-even-count-more',
2779  'Input filepath "' . ‪Environment::getPublicPath() . '/dummy/path/this-path-has-more-than-60-characters-in-one-base-path-you-can-even-count-more" was generally invalid!'
2780  ],
2781  [
2782  '/dummy/path/awesome',
2783  '"/dummy/path/" was not within directory Environment::getPublicPath() + "/typo3temp/"'
2784  ],
2785  [
2787  '"' . ‪Environment::getLegacyConfigPath() . '/" was not within directory Environment::getPublicPath() + "/typo3temp/"',
2788  ],
2789  [
2790  ‪Environment::getPublicPath() . '/typo3temp/táylor/swíft',
2791  'Subdir, "táylor/", was NOT on the form "[[:alnum:]_]/+"',
2792  ],
2793  'Path instead of file given' => [
2794  ‪Environment::getPublicPath() . '/typo3temp/dummy/path/',
2795  'Calculated file location didn\'t match input "' . ‪Environment::getPublicPath() . '/typo3temp/dummy/path/".'
2796  ],
2797  ];
2798  }
2799 
2806  public function ‪writeFileToTypo3tempDirFailsWithInvalidPath($invalidFilePath, string $expectedResult)
2807  {
2808  $result = ‪GeneralUtility::writeFileToTypo3tempDir($invalidFilePath, 'dummy content to be written');
2809  self::assertSame($result, $expectedResult);
2810  }
2811 
2816  {
2817  return [
2818  'Default text file' => [
2819  ‪Environment::getVarPath() . '/paranoid/android.txt',
2820  ],
2821  'Html file extension' => [
2822  ‪Environment::getVarPath() . '/karma.html',
2823  ],
2824  'No file extension' => [
2825  ‪Environment::getVarPath() . '/no-surprises',
2826  ],
2827  'Deep directory' => [
2828  ‪Environment::getVarPath() . '/climbing/up/the/walls',
2829  ],
2830  'File in typo3temp/var directory' => [
2831  ‪Environment::getPublicPath() . '/typo3temp/var/path/foo.txt'
2832  ]
2833  ];
2834  }
2835 
2841  public function ‪writeFileToTypo3tempDirWorksWithValidPath($filePath)
2842  {
2843  $dummyContent = 'Please could you stop the noise, I\'m trying to get some rest from all the unborn chicken voices in my head.';
2844 
2845  $this->testFilesToDelete[] = $filePath;
2846 
2847  $result = ‪GeneralUtility::writeFileToTypo3tempDir($filePath, $dummyContent);
2848 
2849  self::assertNull($result);
2850  self::assertFileExists($filePath);
2851  self::assertStringEqualsFile($filePath, $dummyContent);
2852  }
2853 
2855  // Tests concerning mkdir_deep
2860  public function ‪mkdirDeepCreatesDirectory()
2861  {
2862  $directory = $this->‪getVirtualTestDir() . '/' . ‪StringUtility::getUniqueId('test_');
2863  ‪GeneralUtility::mkdir_deep($directory);
2864  self::assertTrue(is_dir($directory));
2865  }
2866 
2871  {
2872  $directory = $this->‪getVirtualTestDir() . 'typo3temp/var/tests/' . ‪StringUtility::getUniqueId('test_');
2873  $subDirectory = $directory . '/foo';
2874  ‪GeneralUtility::mkdir_deep($subDirectory);
2875  self::assertTrue(is_dir($subDirectory));
2876  }
2877 
2883  {
2884  return [
2885  'no double slash if concatenated with Environment::getPublicPath()' => ['fileadmin/testDir1'],
2886  'double slash if concatenated with Environment::getPublicPath()' => ['/fileadmin/testDir2'],
2887  ];
2888  }
2889 
2894  public function ‪mkdirDeepCreatesDirectoryWithDoubleSlashes($directoryToCreate)
2895  {
2896  vfsStream::setup('root', null, ['public' => []]);
2897  ‪GeneralUtility::mkdir_deep('vfs://root/public/' . $directoryToCreate);
2898  self::assertTrue(is_dir('vfs://root/public/' . $directoryToCreate));
2899  }
2900 
2905  {
2906  if (‪Environment::isWindows()) {
2907  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2908  }
2909  $directory = ‪StringUtility::getUniqueId('mkdirdeeptest_');
2910  $oldUmask = umask(19);
2911  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0777';
2912  ‪GeneralUtility::mkdir_deep(‪Environment::getVarPath() . '/tests/' . $directory);
2913  $this->testFilesToDelete[] = ‪Environment::getVarPath() . '/tests/' . $directory;
2914  clearstatcache();
2915  umask($oldUmask);
2916  self::assertEquals('777', substr(decoct(fileperms(‪Environment::getVarPath() . '/tests/' . $directory)), -3, 3));
2917  }
2918 
2923  {
2924  if (‪Environment::isWindows()) {
2925  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2926  }
2927  $directory = ‪StringUtility::getUniqueId('mkdirdeeptest_');
2928  $subDirectory = $directory . '/bar';
2929  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask'] = '0777';
2930  $oldUmask = umask(19);
2931  ‪GeneralUtility::mkdir_deep(‪Environment::getVarPath() . '/tests/' . $subDirectory);
2932  $this->testFilesToDelete[] = ‪Environment::getVarPath() . '/tests/' . $directory;
2933  clearstatcache();
2934  umask($oldUmask);
2935  self::assertEquals('777', substr(decoct(fileperms(‪Environment::getVarPath() . '/tests/' . $directory)), -3, 3));
2936  }
2937 
2942  {
2943  if (‪Environment::isWindows()) {
2944  self::markTestSkipped(self::NO_FIX_PERMISSIONS_ON_WINDOWS);
2945  }
2946  $baseDirectory = ‪Environment::getVarPath() . '/tests/';
2947  $existingDirectory = ‪StringUtility::getUniqueId('test_existing_') . '/';
2948  $newSubDirectory = ‪StringUtility::getUniqueId('test_new_');
2949  @mkdir($baseDirectory . $existingDirectory);
2950  $this->testFilesToDelete[] = $baseDirectory . $existingDirectory;
2951  chmod($baseDirectory . $existingDirectory, 482);
2952  ‪GeneralUtility::mkdir_deep($baseDirectory . $existingDirectory . $newSubDirectory);
2953  self::assertEquals(742, (int)substr(decoct(fileperms($baseDirectory . $existingDirectory)), 2));
2954  }
2955 
2960  {
2961  $swapGroup = $this->‪checkGroups(__FUNCTION__);
2962  if ($swapGroup !== false) {
2963  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['createGroup'] = $swapGroup;
2964  $directory = ‪StringUtility::getUniqueId('mkdirdeeptest_');
2965  ‪GeneralUtility::mkdir_deep(‪Environment::getVarPath() . '/tests/' . $directory);
2966  $this->testFilesToDelete[] = ‪Environment::getVarPath() . '/tests/' . $directory;
2967  clearstatcache();
2968  $resultDirectoryGroup = filegroup(‪Environment::getVarPath() . '/tests/' . $directory);
2969  self::assertEquals($resultDirectoryGroup, $swapGroup);
2970  }
2971  }
2972 
2977  {
2978  $swapGroup = $this->‪checkGroups(__FUNCTION__);
2979  if ($swapGroup !== false) {
2980  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['createGroup'] = $swapGroup;
2981  $directory = ‪StringUtility::getUniqueId('mkdirdeeptest_');
2982  $subDirectory = $directory . '/bar';
2983  ‪GeneralUtility::mkdir_deep(‪Environment::getVarPath() . '/tests/' . $subDirectory);
2984  $this->testFilesToDelete[] = ‪Environment::getVarPath() . '/tests/' . $directory;
2985  clearstatcache();
2986  $resultDirectoryGroup = filegroup(‪Environment::getVarPath() . '/tests/' . $directory);
2987  self::assertEquals($resultDirectoryGroup, $swapGroup);
2988  }
2989  }
2990 
2995  {
2996  $swapGroup = $this->‪checkGroups(__FUNCTION__);
2997  if ($swapGroup !== false) {
2998  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['createGroup'] = $swapGroup;
2999  $directory = ‪StringUtility::getUniqueId('mkdirdeeptest_');
3000  $subDirectory = $directory . '/bar';
3001  ‪GeneralUtility::mkdir_deep(‪Environment::getVarPath() . '/tests/' . $subDirectory);
3002  $this->testFilesToDelete[] = ‪Environment::getVarPath() . '/tests/' . $directory;
3003  clearstatcache();
3004  $resultDirectoryGroup = filegroup(‪Environment::getVarPath() . '/tests/' . $directory);
3005  self::assertEquals($resultDirectoryGroup, $swapGroup);
3006  }
3007  }
3008 
3012  public function ‪mkdirDeepCreatesDirectoryInVfsStream()
3013  {
3014  vfsStreamWrapper::register();
3015  $baseDirectory = ‪StringUtility::getUniqueId('test_');
3016  vfsStreamWrapper::setRoot(new vfsStreamDirectory($baseDirectory));
3017  ‪GeneralUtility::mkdir_deep('vfs://' . $baseDirectory . '/sub');
3018  self::assertTrue(is_dir('vfs://' . $baseDirectory . '/sub'));
3019  }
3020 
3025  {
3026  $this->expectException(\RuntimeException::class);
3027  $this->expectExceptionCode(1170251401);
3028 
3029  ‪GeneralUtility::mkdir_deep('http://localhost');
3030  }
3031 
3036  {
3037  $this->expectException(\InvalidArgumentException::class);
3038  $this->expectExceptionCode(1303662955);
3039 
3041  }
3042 
3044  // Tests concerning rmdir
3046 
3050  public function ‪rmdirRemovesFile()
3051  {
3052  $file = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('file_');
3053  touch($file);
3054  ‪GeneralUtility::rmdir($file);
3055  self::assertFalse(file_exists($file));
3056  }
3057 
3061  public function ‪rmdirReturnTrueIfFileWasRemoved()
3062  {
3063  $file = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('file_');
3064  touch($file);
3065  self::assertTrue(‪GeneralUtility::rmdir($file));
3066  }
3067 
3071  public function ‪rmdirReturnFalseIfNoFileWasRemoved()
3072  {
3073  $file = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('file_');
3074  self::assertFalse(‪GeneralUtility::rmdir($file));
3075  }
3076 
3080  public function ‪rmdirRemovesDirectory()
3081  {
3082  $directory = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('directory_');
3083  mkdir($directory);
3084  ‪GeneralUtility::rmdir($directory);
3085  self::assertFalse(file_exists($directory));
3086  }
3087 
3092  {
3093  $directory = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('directory_') . '/';
3094  mkdir($directory);
3095  ‪GeneralUtility::rmdir($directory);
3096  self::assertFalse(file_exists($directory));
3097  }
3098 
3103  {
3104  $directory = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('directory_') . '/';
3105  mkdir($directory);
3106  $file = ‪StringUtility::getUniqueId('file_');
3107  touch($directory . $file);
3108  $this->testFilesToDelete[] = $directory;
3109  $return = ‪GeneralUtility::rmdir($directory);
3110  self::assertTrue(file_exists($directory));
3111  self::assertTrue(file_exists($directory . $file));
3112  self::assertFalse($return);
3113  }
3114 
3119  {
3120  $directory = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('directory_') . '/';
3121  mkdir($directory);
3122  mkdir($directory . 'sub/');
3123  touch($directory . 'sub/file');
3124  $return = ‪GeneralUtility::rmdir($directory, true);
3125  self::assertFalse(file_exists($directory));
3126  self::assertTrue($return);
3127  }
3128 
3132  public function ‪rmdirRemovesLinkToDirectory()
3133  {
3134  $existingDirectory = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('notExists_') . '/';
3135  mkdir($existingDirectory);
3136  $this->testFilesToDelete[] = $existingDirectory;
3137  $symlinkName = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('link_');
3138  symlink($existingDirectory, $symlinkName);
3139  ‪GeneralUtility::rmdir($symlinkName, true);
3140  self::assertFalse(is_link($symlinkName));
3141  }
3142 
3146  public function ‪rmdirRemovesDeadLinkToDirectory()
3147  {
3148  $notExistingDirectory = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('notExists_') . '/';
3149  $symlinkName = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('link_');
3150  mkdir($notExistingDirectory);
3151  symlink($notExistingDirectory, $symlinkName);
3152  rmdir($notExistingDirectory);
3153 
3154  ‪GeneralUtility::rmdir($symlinkName, true);
3155  self::assertFalse(is_link($symlinkName));
3156  }
3157 
3161  public function ‪rmdirRemovesDeadLinkToFile()
3162  {
3163  $notExistingFile = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('notExists_');
3164  $symlinkName = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('link_');
3165  touch($notExistingFile);
3166  symlink($notExistingFile, $symlinkName);
3167  unlink($notExistingFile);
3168  ‪GeneralUtility::rmdir($symlinkName, true);
3169  self::assertFalse(is_link($symlinkName));
3170  }
3171 
3173  // Tests concerning getFilesInDir
3175 
3181  protected function ‪getFilesInDirCreateTestDirectory()
3182  {
3183  $structure = [
3184  'subDirectory' => [
3185  'test.php' => 'butter',
3186  'other.php' => 'milk',
3187  'stuff.csv' => 'honey',
3188  ],
3189  'excludeMe.txt' => 'cocoa nibs',
3190  'double.setup.typoscript' => 'cool TS',
3191  'testB.txt' => 'olive oil',
3192  'testA.txt' => 'eggs',
3193  'testC.txt' => 'carrots',
3194  'test.js' => 'oranges',
3195  'test.css' => 'apples',
3196  '.secret.txt' => 'sammon',
3197  ];
3198  vfsStream::setup('test', null, $structure);
3199  $vfsUrl = vfsStream::url('test');
3200 
3201  // set random values for mtime
3202  foreach ($structure as $structureLevel1Key => $structureLevel1Content) {
3203  $newMtime = random_int(0, mt_getrandmax());
3204  if (is_array($structureLevel1Content)) {
3205  foreach ($structureLevel1Content as $structureLevel2Key => $structureLevel2Content) {
3206  touch($vfsUrl . '/' . $structureLevel1Key . '/' . $structureLevel2Key, $newMtime);
3207  }
3208  } else {
3209  touch($vfsUrl . '/' . $structureLevel1Key, $newMtime);
3210  }
3211  }
3212 
3213  return $vfsUrl;
3214  }
3215 
3219  public function ‪getFilesInDirFindsRegularFile()
3220  {
3221  $vfsStreamUrl = $this->‪getFilesInDirCreateTestDirectory();
3222  $files = GeneralUtility::getFilesInDir($vfsStreamUrl);
3223  self::assertTrue(in_array('testA.txt', $files));
3224  }
3225 
3229  public function ‪getFilesInDirFindsHiddenFile()
3230  {
3231  $vfsStreamUrl = $this->‪getFilesInDirCreateTestDirectory();
3232  $files = GeneralUtility::getFilesInDir($vfsStreamUrl);
3233  self::assertTrue(in_array('.secret.txt', $files));
3234  }
3235 
3241  public function ‪fileExtensionDataProvider()
3242  {
3243  return [
3244  'no space' => [
3245  'setup.typoscript,txt,js,css'
3246  ],
3247  'spaces' => [
3248  'setup.typoscript, txt, js, css'
3249  ],
3250  'mixed' => [
3251  'setup.typoscript , txt,js, css'
3252  ],
3253  'wild' => [
3254  'setup.typoscript, txt, js , css'
3255  ]
3256  ];
3257  }
3258 
3263  public function ‪getFilesInDirByExtensionFindsFiles($fileExtensions)
3264  {
3265  $vfsStreamUrl = $this->‪getFilesInDirCreateTestDirectory();
3266  $files = GeneralUtility::getFilesInDir($vfsStreamUrl, $fileExtensions);
3267  self::assertTrue(in_array('double.setup.typoscript', $files));
3268  self::assertTrue(in_array('testA.txt', $files));
3269  self::assertTrue(in_array('test.js', $files));
3270  self::assertTrue(in_array('test.css', $files));
3271  }
3272 
3277  {
3278  $vfsStreamUrl = $this->‪getFilesInDirCreateTestDirectory();
3279  $files = GeneralUtility::getFilesInDir($vfsStreamUrl, 'txt,js');
3280  self::assertTrue(in_array('testA.txt', $files));
3281  self::assertTrue(in_array('test.js', $files));
3282  self::assertFalse(in_array('test.css', $files));
3283  }
3284 
3289  {
3290  $vfsStreamUrl = $this->‪getFilesInDirCreateTestDirectory();
3291  $files = GeneralUtility::getFilesInDir($vfsStreamUrl, '', false, '', 'excludeMe.*');
3292  self::assertTrue(in_array('test.js', $files));
3293  self::assertFalse(in_array('excludeMe.txt', $files));
3294  }
3295 
3299  public function ‪getFilesInDirCanPrependPath()
3300  {
3301  $vfsStreamUrl = $this->‪getFilesInDirCreateTestDirectory();
3302  self::assertTrue(
3303  in_array(
3304  $vfsStreamUrl . '/testA.txt',
3305  GeneralUtility::getFilesInDir($vfsStreamUrl, '', true)
3306  )
3307  );
3308  }
3309 
3314  {
3315  $vfsStreamUrl = $this->‪getFilesInDirCreateTestDirectory();
3316  self::assertSame(
3317  array_values(GeneralUtility::getFilesInDir($vfsStreamUrl, '', false)),
3318  ['.secret.txt', 'double.setup.typoscript', 'excludeMe.txt', 'test.css', 'test.js', 'testA.txt', 'testB.txt', 'testC.txt']
3319  );
3320  }
3321 
3325  public function ‪getFilesInDirCanOrderByMtime()
3326  {
3327  $vfsStreamUrl = $this->‪getFilesInDirCreateTestDirectory();
3328  $files = [];
3329  $iterator = new \DirectoryIterator($vfsStreamUrl);
3330  foreach ($iterator as $fileinfo) {
3331  if ($fileinfo->isFile()) {
3332  $files[$fileinfo->getFilename()] = $fileinfo->getMTime();
3333  }
3334  }
3335  asort($files);
3336  self::assertSame(
3337  array_values(GeneralUtility::getFilesInDir($vfsStreamUrl, '', false, 'mtime')),
3338  array_keys($files)
3339  );
3340  }
3341 
3346  {
3347  $vfsStreamUrl = $this->‪getFilesInDirCreateTestDirectory();
3348  self::assertArrayHasKey(
3349  md5($vfsStreamUrl . '/testA.txt'),
3350  GeneralUtility::getFilesInDir($vfsStreamUrl)
3351  );
3352  }
3353 
3357  public function ‪getFilesInDirDoesNotFindDirectories()
3358  {
3359  $vfsStreamUrl = $this->‪getFilesInDirCreateTestDirectory();
3360  self::assertFalse(
3361  in_array(
3362  'subDirectory',
3363  GeneralUtility::getFilesInDir($vfsStreamUrl)
3364  )
3365  );
3366  }
3367 
3374  public function ‪getFilesInDirDoesNotFindDotfiles()
3375  {
3376  $vfsStreamUrl = $this->‪getFilesInDirCreateTestDirectory();
3377  $files = GeneralUtility::getFilesInDir($vfsStreamUrl);
3378  self::assertFalse(in_array('..', $files));
3379  self::assertFalse(in_array('.', $files));
3380  }
3381 
3383  // Tests concerning split_fileref
3389  {
3390  $directoryName = ‪StringUtility::getUniqueId('test_') . '.com';
3391  $directoryPath = ‪Environment::getVarPath() . '/tests/';
3392  $directory = $directoryPath . $directoryName;
3393  mkdir($directory, octdec(‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['folderCreateMask']));
3394  $fileInfo = GeneralUtility::split_fileref($directory);
3395  $directoryCreated = is_dir($directory);
3396  rmdir($directory);
3397  self::assertTrue($directoryCreated);
3398  self::assertIsArray($fileInfo);
3399  self::assertEquals($directoryPath, $fileInfo['path']);
3400  self::assertEquals($directoryName, $fileInfo['file']);
3401  self::assertEquals($directoryName, $fileInfo['filebody']);
3402  self::assertEquals('', $fileInfo['fileext']);
3403  self::assertArrayNotHasKey('realFileext', $fileInfo);
3404  }
3405 
3410  {
3411  $testFile = 'fileadmin/media/someFile.png';
3412  $fileInfo = GeneralUtility::split_fileref($testFile);
3413  self::assertIsArray($fileInfo);
3414  self::assertEquals('fileadmin/media/', $fileInfo['path']);
3415  self::assertEquals('someFile.png', $fileInfo['file']);
3416  self::assertEquals('someFile', $fileInfo['filebody']);
3417  self::assertEquals('png', $fileInfo['fileext']);
3418  }
3419 
3421  // Tests concerning dirname
3423 
3427  public function ‪dirnameDataProvider()
3428  {
3429  return [
3430  'absolute path with multiple part and file' => ['/dir1/dir2/script.php', '/dir1/dir2'],
3431  'absolute path with one part' => ['/dir1/', '/dir1'],
3432  'absolute path to file without extension' => ['/dir1/something', '/dir1'],
3433  'relative path with one part and file' => ['dir1/script.php', 'dir1'],
3434  'relative one-character path with one part and file' => ['d/script.php', 'd'],
3435  'absolute zero-part path with file' => ['/script.php', ''],
3436  'empty string' => ['', '']
3437  ];
3438  }
3439 
3446  public function ‪dirnameWithDataProvider($input, $expectedValue)
3447  {
3448  self::assertEquals($expectedValue, GeneralUtility::dirname($input));
3449  }
3450 
3452  // Tests concerning resolveBackPath
3454 
3458  public function ‪resolveBackPathDataProvider()
3459  {
3460  return [
3461  'empty path' => ['', ''],
3462  'this directory' => ['./', './'],
3463  'relative directory without ..' => ['dir1/dir2/dir3/', 'dir1/dir2/dir3/'],
3464  'relative path without ..' => ['dir1/dir2/script.php', 'dir1/dir2/script.php'],
3465  'absolute directory without ..' => ['/dir1/dir2/dir3/', '/dir1/dir2/dir3/'],
3466  'absolute path without ..' => ['/dir1/dir2/script.php', '/dir1/dir2/script.php'],
3467  'only one directory upwards without trailing slash' => ['..', '..'],
3468  'only one directory upwards with trailing slash' => ['../', '../'],
3469  'one level with trailing ..' => ['dir1/..', ''],
3470  'one level with trailing ../' => ['dir1/../', ''],
3471  'two levels with trailing ..' => ['dir1/dir2/..', 'dir1'],
3472  'two levels with trailing ../' => ['dir1/dir2/../', 'dir1/'],
3473  'leading ../ without trailing /' => ['../dir1', '../dir1'],
3474  'leading ../ with trailing /' => ['../dir1/', '../dir1/'],
3475  'leading ../ and inside path' => ['../dir1/dir2/../dir3/', '../dir1/dir3/'],
3476  'one times ../ in relative directory' => ['dir1/../dir2/', 'dir2/'],
3477  'one times ../ in absolute directory' => ['/dir1/../dir2/', '/dir2/'],
3478  'one times ../ in relative path' => ['dir1/../dir2/script.php', 'dir2/script.php'],
3479  'one times ../ in absolute path' => ['/dir1/../dir2/script.php', '/dir2/script.php'],
3480  'consecutive ../' => ['dir1/dir2/dir3/../../../dir4', 'dir4'],
3481  'distributed ../ with trailing /' => ['dir1/../dir2/dir3/../', 'dir2/'],
3482  'distributed ../ without trailing /' => ['dir1/../dir2/dir3/..', 'dir2'],
3483  'multiple distributed and consecutive ../ together' => ['dir1/dir2/dir3/dir4/../../dir5/dir6/dir7/../dir8/', 'dir1/dir2/dir5/dir6/dir8/'],
3484  'dirname with leading ..' => ['dir1/..dir2/dir3/', 'dir1/..dir2/dir3/'],
3485  'dirname with trailing ..' => ['dir1/dir2../dir3/', 'dir1/dir2../dir3/'],
3486  'more times upwards than downwards in directory' => ['dir1/../../', '../'],
3487  'more times upwards than downwards in path' => ['dir1/../../script.php', '../script.php']
3488  ];
3489  }
3490 
3497  public function ‪resolveBackPathWithDataProvider($input, $expectedValue)
3498  {
3499  self::assertEquals($expectedValue, GeneralUtility::resolveBackPath($input));
3500  }
3501 
3503  // Tests concerning makeInstance, setSingletonInstance, addInstance, purgeInstances
3509  {
3510  $this->expectException(\InvalidArgumentException::class);
3511  $this->expectExceptionCode(1288965219);
3512 
3513  GeneralUtility::makeInstance('');
3514  }
3515 
3520  {
3521  $this->expectException(\InvalidArgumentException::class);
3522  $this->expectExceptionCode(1288965219);
3523 
3524  GeneralUtility::makeInstance(null);
3525  }
3526 
3531  {
3532  $this->expectException(\InvalidArgumentException::class);
3533  $this->expectExceptionCode(1288965219);
3534 
3535  GeneralUtility::makeInstance(0);
3536  }
3537 
3542  {
3543  $this->expectException(\InvalidArgumentException::class);
3544  $this->expectExceptionCode(1288965219);
3545 
3546  GeneralUtility::makeInstance([]);
3547  }
3548 
3553  {
3554  $this->expectException(\InvalidArgumentException::class);
3555  $this->expectExceptionCode(1288965219);
3556 
3557  GeneralUtility::makeInstance(['foo']);
3558  }
3559 
3564  {
3565  $this->expectException(\InvalidArgumentException::class);
3566  $this->expectExceptionCode(1420281366);
3567 
3568  GeneralUtility::makeInstance('\\TYPO3\\CMS\\Backend\\Controller\\BackendController');
3569  }
3570 
3574  public function ‪makeInstanceReturnsClassInstance()
3575  {
3576  $className = get_class($this->getMockBuilder('foo')->getMock());
3577  self::assertTrue(GeneralUtility::makeInstance($className) instanceof $className);
3578  }
3579 
3584  {
3585  $instance = GeneralUtility::makeInstance(TwoParametersConstructorFixture::class, 'one parameter', 'another parameter');
3586  self::assertEquals('one parameter', $instance->constructorParameter1, 'The first constructor parameter has not been set.');
3587  self::assertEquals('another parameter', $instance->constructorParameter2, 'The second constructor parameter has not been set.');
3588  }
3589 
3594  {
3596  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][OriginalClassFixture::class] = ['className' => ReplacementClassFixture::class];
3597  self::assertInstanceOf(ReplacementClassFixture::class, GeneralUtility::makeInstance(OriginalClassFixture::class));
3598  }
3599 
3604  {
3606  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][OriginalClassFixture::class] = ['className' => ReplacementClassFixture::class];
3607  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][ReplacementClassFixture::class] = ['className' => OtherReplacementClassFixture::class];
3608  self::assertInstanceOf(OtherReplacementClassFixture::class, GeneralUtility::makeInstance(OriginalClassFixture::class));
3609  }
3610 
3615  {
3616  $className = get_class($this->getMockBuilder('foo')->getMock());
3617  self::assertNotSame(GeneralUtility::makeInstance($className), GeneralUtility::makeInstance($className));
3618  }
3619 
3624  {
3625  $className = get_class($this->createMock(SingletonInterface::class));
3626  self::assertSame(GeneralUtility::makeInstance($className), GeneralUtility::makeInstance($className));
3627  }
3628 
3633  {
3634  $className = get_class($this->createMock(SingletonInterface::class));
3635  $instance = GeneralUtility::makeInstance($className);
3636  GeneralUtility::purgeInstances();
3637  self::assertNotSame($instance, GeneralUtility::makeInstance($className));
3638  }
3639 
3643  public function ‪makeInstanceInjectsLogger()
3644  {
3645  $instance = GeneralUtility::makeInstance(GeneralUtilityMakeInstanceInjectLoggerFixture::class);
3646  self::assertInstanceOf(LoggerInterface::class, $instance->getLogger());
3647  }
3648 
3653  {
3654  $this->expectException(\InvalidArgumentException::class);
3655  $this->expectExceptionCode(1288967479);
3656 
3657  $instance = $this->createMock(SingletonInterface::class);
3658  GeneralUtility::setSingletonInstance('', $instance);
3659  }
3660 
3665  {
3666  $this->expectException(\InvalidArgumentException::class);
3667  $this->expectExceptionCode(1288967686);
3668 
3669  $instance = $this->getMockBuilder(SingletonInterface::class)
3670  ->setMethods(['foo'])
3671  ->getMock();
3672  $singletonClassName = get_class($this->createMock(SingletonInterface::class));
3673  GeneralUtility::setSingletonInstance($singletonClassName, $instance);
3674  }
3675 
3680  {
3681  $instance = $this->createMock(SingletonInterface::class);
3682  $singletonClassName = get_class($instance);
3683  GeneralUtility::setSingletonInstance($singletonClassName, $instance);
3684  self::assertSame($instance, GeneralUtility::makeInstance($singletonClassName));
3685  }
3686 
3691  {
3692  $instance1 = $this->createMock(SingletonInterface::class);
3693  $singletonClassName = get_class($instance1);
3694  $instance2 = new $singletonClassName();
3695  GeneralUtility::setSingletonInstance($singletonClassName, $instance1);
3696  GeneralUtility::setSingletonInstance($singletonClassName, $instance2);
3697  self::assertSame($instance2, GeneralUtility::makeInstance($singletonClassName));
3698  }
3699 
3704  {
3705  $instance = $this->createMock(SingletonInterface::class);
3706  $instanceClassName = get_class($instance);
3707  GeneralUtility::setSingletonInstance($instanceClassName, $instance);
3708  $registeredSingletonInstances = GeneralUtility::getSingletonInstances();
3709  self::assertArrayHasKey($instanceClassName, $registeredSingletonInstances);
3710  self::assertSame($registeredSingletonInstances[$instanceClassName], $instance);
3711  }
3712 
3717  {
3718  ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['Objects'][SingletonClassFixture::class]['className'] = ExtendedSingletonClassFixture::class;
3719  $anotherInstance = new ExtendedSingletonClassFixture();
3720  GeneralUtility::makeInstance(SingletonClassFixture::class);
3721  GeneralUtility::setSingletonInstance(SingletonClassFixture::class, $anotherInstance);
3722  $result = GeneralUtility::makeInstance(SingletonClassFixture::class);
3723  self::assertSame($anotherInstance, $result);
3724  self::assertEquals(ExtendedSingletonClassFixture::class, get_class($anotherInstance));
3725  }
3726 
3731  {
3732  $instance = $this->createMock(SingletonInterface::class);
3733  $instanceClassName = get_class($instance);
3734  GeneralUtility::setSingletonInstance($instanceClassName, $instance);
3735  GeneralUtility::resetSingletonInstances([]);
3736  $registeredSingletonInstances = GeneralUtility::getSingletonInstances();
3737  self::assertArrayNotHasKey($instanceClassName, $registeredSingletonInstances);
3738  }
3739 
3744  {
3745  $instance = $this->createMock(SingletonInterface::class);
3746  $instanceClassName = get_class($instance);
3747  GeneralUtility::resetSingletonInstances(
3748  [$instanceClassName => $instance]
3749  );
3750  $registeredSingletonInstances = GeneralUtility::getSingletonInstances();
3751  self::assertArrayHasKey($instanceClassName, $registeredSingletonInstances);
3752  self::assertSame($registeredSingletonInstances[$instanceClassName], $instance);
3753  }
3754 
3759  {
3760  $this->expectException(\InvalidArgumentException::class);
3761  $this->expectExceptionCode(1288967479);
3762 
3763  $instance = $this->getMockBuilder('foo')->getMock();
3764  GeneralUtility::addInstance('', $instance);
3765  }
3766 
3771  {
3772  $this->expectException(\InvalidArgumentException::class);
3773  $this->expectExceptionCode(1288967686);
3774 
3775  $instance = $this->getMockBuilder('foo')
3776  ->setMethods(['bar'])
3777  ->getMock();
3778  $singletonClassName = get_class($this->createMock('foo'));
3779  GeneralUtility::addInstance($singletonClassName, $instance);
3780  }
3781 
3786  {
3787  $this->expectException(\InvalidArgumentException::class);
3788  $this->expectExceptionCode(1288969325);
3789 
3790  $instance = $this->createMock(SingletonInterface::class);
3791  GeneralUtility::addInstance(get_class($instance), $instance);
3792  }
3793 
3798  {
3799  $instance = $this->createMock('stdClass');
3800  $className = get_class($instance);
3801  GeneralUtility::addInstance($className, $instance);
3802  self::assertSame($instance, GeneralUtility::makeInstance($className));
3803  }
3804 
3809  {
3810  $instance = $this->createMock('stdClass');
3811  $className = get_class($instance);
3812  GeneralUtility::addInstance($className, $instance);
3813  self::assertNotSame(GeneralUtility::makeInstance($className), GeneralUtility::makeInstance($className));
3814  }
3815 
3820  {
3821  $instance1 = $this->createMock('stdClass');
3822  $className = get_class($instance1);
3823  GeneralUtility::addInstance($className, $instance1);
3824  $instance2 = new $className();
3825  GeneralUtility::addInstance($className, $instance2);
3826  self::assertSame($instance1, GeneralUtility::makeInstance($className), 'The first returned instance does not match the first added instance.');
3827  self::assertSame($instance2, GeneralUtility::makeInstance($className), 'The second returned instance does not match the second added instance.');
3828  }
3829 
3833  public function ‪purgeInstancesDropsAddedInstance()
3834  {
3835  $instance = $this->createMock('stdClass');
3836  $className = get_class($instance);
3837  GeneralUtility::addInstance($className, $instance);
3838  GeneralUtility::purgeInstances();
3839  self::assertNotSame($instance, GeneralUtility::makeInstance($className));
3840  }
3841 
3845  public function ‪getFileAbsFileNameDateprovider()
3846  {
3847  return [
3848  'typo3/sysext/core/Resources/Public/Icons/Extension.png' => [
3849  'typo3/sysext/core/Resources/Public/Icons/Extension.png',
3850  ‪Environment::getPublicPath() . '/typo3/sysext/core/Resources/Public/Icons/Extension.png'
3851  ],
3852  'sysext/core/Resources/Public/Icons/Extension.png' => [
3853  'sysext/core/Resources/Public/Icons/Extension.png',
3854  ‪Environment::getPublicPath() . '/sysext/core/Resources/Public/Icons/Extension.png'
3855  ],
3856  './typo3/sysext/core/Resources/Public/Icons/Extension.png' => [
3857  './typo3/sysext/core/Resources/Public/Icons/Extension.png',
3858  ‪Environment::getPublicPath() . '/./typo3/sysext/core/Resources/Public/Icons/Extension.png'
3859  ],
3860  'fileadmin/foo.txt' => [
3861  'fileadmin/foo.txt',
3862  ‪Environment::getPublicPath() . '/fileadmin/foo.txt'
3863  ],
3864  './fileadmin/foo.txt' => [
3865  './fileadmin/foo.txt',
3866  ‪Environment::getPublicPath() . '/./fileadmin/foo.txt'
3867  ],
3868  '../sysext/core/Resources/Public/Icons/Extension.png' => [
3869  '../sysext/core/Resources/Public/Icons/Extension.png',
3870  ''
3871  ],
3872  '../fileadmin/foo.txt' => [
3873  '../fileadmin/foo.txt',
3874  ''
3875  ],
3876  'Public web path . ../sysext/core/Resources/Public/Icons/Extension.png' => [
3877  ‪Environment::getPublicPath() . '/../sysext/core/Resources/Public/Icons/Extension.png',
3878  ''
3879  ],
3880  'Public web path . fileadmin/foo.txt' => [
3881  ‪Environment::getPublicPath() . '/fileadmin/foo.txt',
3882  ‪Environment::getPublicPath() . '/fileadmin/foo.txt'
3883  ],
3884  'Public web path . typo3/sysext/core/Resources/Public/Icons/Extension.png' => [
3885  ‪Environment::getFrameworkBasePath() . '/core/Resources/Public/Icons/Extension.png',
3886  ‪Environment::getFrameworkBasePath() . '/core/Resources/Public/Icons/Extension.png'
3887  ],
3888  'EXT:foo/Resources/Public/Icons/Extension.png' => [
3889  'EXT:foo/Resources/Public/Icons/Extension.png',
3890  ‪Environment::getFrameworkBasePath() . '/foo/Resources/Public/Icons/Extension.png'
3891  ]
3892  ];
3893  }
3894 
3901  public function ‪getFileAbsFileNameReturnsCorrectValues($path, $expected)
3902  {
3903 
3904  // build the dummy package "foo" for use in ExtensionManagementUtility::extPath('foo');
3905  $package = $this->getMockBuilder(Package::class)
3906  ->disableOriginalConstructor()
3907  ->setMethods(['getPackagePath'])
3908  ->getMock();
3910  $packageManager = $this->getMockBuilder(PackageManager::class)
3911  ->setMethods(['isPackageActive', 'getPackage'])
3912  ->disableOriginalConstructor()
3913  ->getMock();
3914  $package->expects(self::any())
3915  ->method('getPackagePath')
3916  ->willReturn(‪Environment::getPublicPath() . '/typo3/sysext/foo/');
3917  $packageManager->expects(self::any())
3918  ->method('isPackageActive')
3919  ->with(self::equalTo('foo'))
3920  ->willReturn(true);
3921  $packageManager->expects(self::any())
3922  ->method('getPackage')
3923  ->with('foo')
3924  ->willReturn($package);
3926 
3927  $result = GeneralUtility::getFileAbsFileName($path);
3928  self::assertEquals($expected, $result);
3929  }
3930 
3937  {
3938  $data = [
3939  'double slash in path' => ['path//path'],
3940  'backslash in path' => ['path\\path'],
3941  'directory up in path' => ['path/../path'],
3942  'directory up at the beginning' => ['../path'],
3943  'NUL character in path' => ['path' . "\0" . 'path'],
3944  'BS character in path' => ['path' . chr(8) . 'path'],
3945  'invalid UTF-8-sequence' => ["\xc0" . 'path/path'],
3946  'Could be overlong NUL in some UTF-8 implementations, invalid in RFC3629' => ["\xc0\x80" . 'path/path'],
3947  ];
3948 
3949  // Mixing with regular utf-8
3950  $utf8Characters = 'Ссылка/';
3951  foreach ($data as $key => $value) {
3952  $data[$key . ' with UTF-8 characters prepended'] = [$utf8Characters . $value[0]];
3953  $data[$key . ' with UTF-8 characters appended'] = [$value[0] . $utf8Characters];
3954  }
3955 
3956  // Encoding with UTF-16
3957  foreach ($data as $key => $value) {
3958  $data[$key . ' encoded with UTF-16'] = [mb_convert_encoding($value[0], 'UTF-16')];
3959  }
3960 
3961  return $data;
3962  }
3963 
3971  public function ‪validPathStrDetectsInvalidCharacters($path)
3972  {
3973  self::assertFalse(GeneralUtility::validPathStr($path));
3974  }
3975 
3979  public function ‪validPathStrDataProvider()
3980  {
3981  $data = [
3982  'normal ascii path' => ['fileadmin/templates/myfile..xml'],
3983  'special character' => ['fileadmin/templates/Ссылка (fce).xml']
3984  ];
3985 
3986  return $data;
3987  }
3988 
3995  public function ‪validPathStrWorksWithUnicodeFileNames($path)
3996  {
3997  self::assertTrue(GeneralUtility::validPathStr($path));
3998  }
3999 
4001  // Tests concerning copyDirectory
4003 
4008  {
4009  $sourceDirectory = 'typo3temp/var/tests/' . ‪StringUtility::getUniqueId('test_') . '/';
4010  $absoluteSourceDirectory = ‪Environment::getPublicPath() . '/' . $sourceDirectory;
4011  $this->testFilesToDelete[] = $absoluteSourceDirectory;
4012  ‪GeneralUtility::mkdir($absoluteSourceDirectory);
4013 
4014  $targetDirectory = 'typo3temp/var/tests/' . ‪StringUtility::getUniqueId('test_') . '/';
4015  $absoluteTargetDirectory = ‪Environment::getPublicPath() . '/' . $targetDirectory;
4016  $this->testFilesToDelete[] = $absoluteTargetDirectory;
4017 
4018  ‪GeneralUtility::writeFileToTypo3tempDir($absoluteSourceDirectory . 'file', '42');
4019  ‪GeneralUtility::mkdir($absoluteSourceDirectory . 'foo');
4020  ‪GeneralUtility::writeFileToTypo3tempDir($absoluteSourceDirectory . 'foo/file', '42');
4021 
4022  GeneralUtility::copyDirectory($sourceDirectory, $targetDirectory);
4023 
4024  self::assertFileExists($absoluteTargetDirectory . 'file');
4025  self::assertFileExists($absoluteTargetDirectory . 'foo/file');
4026  }
4027 
4032  {
4033  $sourceDirectory = 'typo3temp/var/tests/' . ‪StringUtility::getUniqueId('test_') . '/';
4034  $absoluteSourceDirectory = ‪Environment::getPublicPath() . '/' . $sourceDirectory;
4035  $this->testFilesToDelete[] = $absoluteSourceDirectory;
4036  ‪GeneralUtility::mkdir($absoluteSourceDirectory);
4037 
4038  $targetDirectory = 'typo3temp/var/tests/' . ‪StringUtility::getUniqueId('test_') . '/';
4039  $absoluteTargetDirectory = ‪Environment::getPublicPath() . '/' . $targetDirectory;
4040  $this->testFilesToDelete[] = $absoluteTargetDirectory;
4041 
4042  ‪GeneralUtility::writeFileToTypo3tempDir($absoluteSourceDirectory . 'file', '42');
4043  ‪GeneralUtility::mkdir($absoluteSourceDirectory . 'foo');
4044  ‪GeneralUtility::writeFileToTypo3tempDir($absoluteSourceDirectory . 'foo/file', '42');
4045 
4046  GeneralUtility::copyDirectory($absoluteSourceDirectory, $absoluteTargetDirectory);
4047 
4048  self::assertFileExists($absoluteTargetDirectory . 'file');
4049  self::assertFileExists($absoluteTargetDirectory . 'foo/file');
4050  }
4051 
4053  // Tests concerning deprecation log
4055 
4057  // Tests concerning callUserFunction
4059 
4066  public function ‪callUserFunctionWillThrowExceptionForInvalidParameters($functionName, $expectedException)
4067  {
4068  $this->expectException(\InvalidArgumentException::class);
4069  $this->expectExceptionCode($expectedException);
4070 
4071  $inputData = ['foo' => 'bar'];
4072  GeneralUtility::callUserFunction($functionName, $inputData, $this);
4073  }
4074 
4082  {
4083  return [
4084  'Function is not prefixed' => [self::class . '->calledUserFunction', 1294585865],
4085  'Class doesn\'t exists' => ['t3lib_divTest21345->user_calledUserFunction', 1294585866],
4086  'No method name' => [self::class, 1294585867],
4087  'No class name' => ['->user_calledUserFunction', 1294585866],
4088  'No function name' => ['', 1294585867]
4089  ];
4090  }
4091 
4099  public function ‪callUserFunctionCanCallFunction()
4100  {
4101  $inputData = ['foo' => 'bar'];
4102  $result = GeneralUtility::callUserFunction(function () {
4103  return 'Worked fine';
4104  }, $inputData, $this, '');
4105  self::assertEquals('Worked fine', $result);
4106  }
4107 
4111  public function ‪callUserFunctionCanCallMethod()
4112  {
4113  $inputData = ['foo' => 'bar'];
4114  $result = GeneralUtility::callUserFunction(self::class . '->user_calledUserFunction', $inputData, $this);
4115  self::assertEquals('Worked fine', $result);
4116  }
4117 
4121  public function ‪user_calledUserFunction()
4122  {
4123  return 'Worked fine';
4124  }
4125 
4129  public function ‪callUserFunctionAcceptsClosures()
4130  {
4131  $inputData = ['foo' => 'bar'];
4132  $closure = function ($parameters, $reference) use ($inputData) {
4133  $reference->assertEquals($inputData, $parameters, 'Passed data doesn\'t match expected output');
4134  return 'Worked fine';
4135  };
4136  self::assertEquals('Worked fine', GeneralUtility::callUserFunction($closure, $inputData, $this));
4137  }
4138 
4142  public function ‪callUserFunctionTrimsSpaces()
4143  {
4144  $inputData = ['foo' => 'bar'];
4145  $result = GeneralUtility::callUserFunction("\t" . self::class . '->user_calledUserFunction ', $inputData, $this);
4146  self::assertEquals('Worked fine', $result);
4147  }
4148 
4153  {
4154  $directory = ‪Environment::getVarPath() . '/tests/' . ‪StringUtility::getUniqueId('directory_');
4155  mkdir($directory);
4156  $filesAndDirectories = GeneralUtility::getAllFilesAndFoldersInPath([], $directory, '', true);
4157  $check = true;
4158  foreach ($filesAndDirectories as $md5 => $path) {
4159  if (!preg_match('/^[a-f0-9]{32}$/', $md5)) {
4160  $check = false;
4161  }
4162  }
4163  ‪GeneralUtility::rmdir($directory);
4164  self::assertTrue($check);
4165  }
4166 
4174  {
4175  $input = [
4176  'el' => []
4177  ];
4178 
4179  ‪$output = GeneralUtility::array2xml($input);
4180 
4181  self::assertEquals('<phparray>
4182  <el type="array"></el>
4183 </phparray>', ‪$output);
4184  }
4185 
4189  public function ‪xml2arrayUsesCache(): void
4190  {
4191  $cacheManagerProphecy = $this->prophesize(CacheManager::class);
4192  $cacheProphecy = $this->prophesize(FrontendInterface::class);
4193  $cacheManagerProphecy->getCache('runtime')->willReturn($cacheProphecy->reveal());
4194  $cacheProphecy->get('generalUtilityXml2Array')->shouldBeCalled()->willReturn(false);
4195  $cacheProphecy->set('generalUtilityXml2Array', Argument::cetera())->shouldBeCalled();
4196  GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
4197  ‪GeneralUtility::xml2array('<?xml version="1.0" encoding="utf-8" standalone="yes"?>', 'T3:');
4198  }
4199 
4203  public function ‪xml2arrayProcessHandlesWhitespacesDataProvider(): array
4204  {
4205  $headerVariants = [
4206  'utf-8' => '<?xml version="1.0" encoding="utf-8" standalone="yes"?>',
4207  'UTF-8' => '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>',
4208  'no-encoding' => '<?xml version="1.0" standalone="yes"?>',
4209  'iso-8859-1' => '<?xml version="1.0" encoding="iso-8859-1" standalone="yes"?>',
4210  'ISO-8859-1' => '<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>',
4211  ];
4212  $data = [];
4213  foreach ($headerVariants as $identifier => $headerVariant) {
4214  $data += [
4215  'inputWithoutWhitespaces-' . $identifier => [
4216  $headerVariant . '<T3FlexForms>
4217  <data>
4218  <field index="settings.persistenceIdentifier">
4219  <value index="vDEF">egon</value>
4220  </field>
4221  </data>
4222  </T3FlexForms>'
4223  ],
4224  'inputWithPrecedingWhitespaces-' . $identifier => [
4225  CR . ' ' . $headerVariant . '<T3FlexForms>
4226  <data>
4227  <field index="settings.persistenceIdentifier">
4228  <value index="vDEF">egon</value>
4229  </field>
4230  </data>
4231  </T3FlexForms>'
4232  ],
4233  'inputWithTrailingWhitespaces-' . $identifier => [
4234  $headerVariant . '<T3FlexForms>
4235  <data>
4236  <field index="settings.persistenceIdentifier">
4237  <value index="vDEF">egon</value>
4238  </field>
4239  </data>
4240  </T3FlexForms>' . CR . ' '
4241  ],
4242  'inputWithPrecedingAndTrailingWhitespaces-' . $identifier => [
4243  CR . ' ' . $headerVariant . '<T3FlexForms>
4244  <data>
4245  <field index="settings.persistenceIdentifier">
4246  <value index="vDEF">egon</value>
4247  </field>
4248  </data>
4249  </T3FlexForms>' . CR . ' '
4250  ],
4251  ];
4252  }
4253  return $data;
4254  }
4255 
4260  public function ‪xml2arrayProcessHandlesWhitespaces(string $input): void
4261  {
4262  $expected = [
4263  'data' => [
4264  'settings.persistenceIdentifier' => [
4265  'vDEF' => 'egon',
4266  ]
4267  ],
4268  ];
4269  self::assertSame($expected, ‪GeneralUtility::xml2arrayProcess($input));
4270  }
4271 
4276  {
4277  return [
4278  'inputWithNameSpaceOnRootLevel' => [
4279  '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
4280  <T3:T3FlexForms>
4281  <data>
4282  <field index="settings.persistenceIdentifier">
4283  <value index="vDEF">egon</value>
4284  </field>
4285  </data>
4286  </T3:T3FlexForms>'
4287  ],
4288  'inputWithNameSpaceOnNonRootLevel' => [
4289  '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
4290  <T3FlexForms>
4291  <data>
4292  <T3:field index="settings.persistenceIdentifier">
4293  <value index="vDEF">egon</value>
4294  </T3:field>
4295  </data>
4296  </T3FlexForms>'
4297  ],
4298  'inputWithNameSpaceOnRootAndNonRootLevel' => [
4299  '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
4300  <T3:T3FlexForms>
4301  <data>
4302  <T3:field index="settings.persistenceIdentifier">
4303  <value index="vDEF">egon</value>
4304  </T3:field>
4305  </data>
4306  </T3:T3FlexForms>'
4307  ],
4308  ];
4309  }
4310 
4315  public function ‪xml2arrayProcessHandlesTagNamespaces(string $input): void
4316  {
4317  $expected = [
4318  'data' => [
4319  'settings.persistenceIdentifier' => [
4320  'vDEF' => 'egon',
4321  ]
4322  ],
4323  ];
4324  self::assertSame($expected, ‪GeneralUtility::xml2arrayProcess($input, 'T3:'));
4325  }
4326 
4330  public function ‪xml2arrayProcessHandlesDocumentTagDataProvider(): array
4331  {
4332  return [
4333  'input' => [
4334  '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
4335  <T3FlexForms>
4336  <data>
4337  <field index="settings.persistenceIdentifier">
4338  <value index="vDEF">egon</value>
4339  </field>
4340  </data>
4341  </T3FlexForms>',
4342  'T3FlexForms'
4343  ],
4344  'input-with-root-namespace' => [
4345  '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
4346  <T3:T3FlexForms>
4347  <data>
4348  <field index="settings.persistenceIdentifier">
4349  <value index="vDEF">egon</value>
4350  </field>
4351  </data>
4352  </T3:T3FlexForms>',
4353  'T3:T3FlexForms'
4354  ],
4355  'input-with-namespace' => [
4356  '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
4357  <T3FlexForms>
4358  <data>
4359  <T3:field index="settings.persistenceIdentifier">
4360  <value index="vDEF">egon</value>
4361  </T3:field>
4362  </data>
4363  </T3FlexForms>',
4364  'T3FlexForms'
4365  ],
4366  ];
4367  }
4368 
4373  public function ‪xml2arrayProcessHandlesDocumentTag(string $input, string $docTag): void
4374  {
4375  $expected = [
4376  'data' => [
4377  'settings.persistenceIdentifier' => [
4378  'vDEF' => 'egon',
4379  ]
4380  ],
4381  '_DOCUMENT_TAG' => $docTag
4382  ];
4383  self::assertSame($expected, ‪GeneralUtility::xml2arrayProcess($input, '', true));
4384  }
4385 
4390  {
4391  return [
4392  '1mb' => [
4393  '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
4394  <T3:T3FlexForms>
4395  <data>
4396  <field index="settings.persistenceIdentifier">
4397  <value index="vDEF">' . str_repeat('1', 1024 * 1024) . '</value>
4398  </field>
4399  </data>
4400  </T3:T3FlexForms>',
4401  str_repeat('1', 1024 * 1024)
4402  ],
4403  '5mb' => [
4404  '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
4405  <T3:T3FlexForms>
4406  <data>
4407  <field index="settings.persistenceIdentifier">
4408  <value index="vDEF">' . str_repeat('1', 5 * 1024 * 1024) . '</value>
4409  </field>
4410  </data>
4411  </T3:T3FlexForms>',
4412  str_repeat('1', 5 * 1024 * 1024)
4413  ],
4414  ];
4415  }
4416 
4423  public function ‪xml2ArrayProcessHandlesBigXmlContent(string $input, string $testValue): void
4424  {
4425  $expected = [
4426  'data' => [
4427  'settings.persistenceIdentifier' => [
4428  'vDEF' => $testValue,
4429  ]
4430  ],
4431  ];
4432  self::assertSame($expected, ‪GeneralUtility::xml2arrayProcess($input));
4433  }
4434 
4446  {
4447  self::markTestSkipped('This test does not pass in all environments. It should be evaluated whether this test is really needed or should be removed.');
4448  $cacheManagerProphecy = $this->prophesize(CacheManager::class);
4449  $cacheProphecy = $this->prophesize(FrontendInterface::class);
4450  $cacheManagerProphecy->getCache('runtime')->willReturn($cacheProphecy->reveal());
4451  $cacheProphecy->get('generalUtilityXml2Array')->shouldBeCalled()->willReturn(false);
4452  $cacheProphecy->set('generalUtilityXml2Array', Argument::cetera())->shouldBeCalled();
4453  GeneralUtility::setSingletonInstance(CacheManager::class, $cacheManagerProphecy->reveal());
4454  $input = '<?xml version="1.0" encoding="utf-8" standalone="yes"?>
4455  <T3:T3FlexForms>
4456  <data>
4457  <field index="settings.persistenceIdentifier">
4458  <value index="vDEF">' . str_repeat('1', 10 * 1024 * 1024) . '</value>
4459  </field>
4460  </data>
4461  </T3:T3FlexForms>';
4462  self::assertStringContainsString('No memory', ‪GeneralUtility::xml2array($input));
4463  }
4464 
4469  {
4470  $prefix = '<?xml version="1.0" encoding="utf-8" standalone="yes"?><T3FlexForms><field index="index">';
4471  $suffix = '</field></T3FlexForms>';
4472  return [
4473  'no-type string' => [
4474  $prefix . '<value index="vDEF">foo bar</value>' . $suffix,
4475  'foo bar'
4476  ],
4477  'no-type integer' => [
4478  $prefix . '<value index="vDEF">123</value>' . $suffix,
4479  '123'
4480  ],
4481  'no-type double' => [
4482  $prefix . '<value index="vDEF">1.23</value>' . $suffix,
4483  '1.23'
4484  ],
4485  'integer integer' => [
4486  $prefix . '<value index="vDEF" type="integer">123</value>' . $suffix,
4487  123
4488  ],
4489  'integer double' => [
4490  $prefix . '<value index="vDEF" type="integer">1.23</value>' . $suffix,
4491  1
4492  ],
4493  'double integer' => [
4494  $prefix . '<value index="vDEF" type="double">123</value>' . $suffix,
4495  123.0
4496  ],
4497  'double double' => [
4498  $prefix . '<value index="vDEF" type="double">1.23</value>' . $suffix,
4499  1.23
4500  ],
4501  'boolean 0' => [
4502  $prefix . '<value index="vDEF" type="boolean">0</value>' . $suffix,
4503  false
4504  ],
4505  'boolean 1' => [
4506  $prefix . '<value index="vDEF" type="boolean">1</value>' . $suffix,
4507  true
4508  ],
4509  'boolean true' => [
4510  $prefix . '<value index="vDEF" type="boolean">true</value>' . $suffix,
4511  true
4512  ],
4513  'boolean false' => [
4514  $prefix . '<value index="vDEF" type="boolean">false</value>' . $suffix,
4515  true // sic(!)
4516  ],
4517  'NULL' => [
4518  $prefix . '<value index="vDEF" type="NULL"></value>' . $suffix,
4519  null
4520  ],
4521  'NULL string' => [
4522  $prefix . '<value index="vDEF" type="NULL">foo bar</value>' . $suffix,
4523  null
4524  ],
4525  'NULL integer' => [
4526  $prefix . '<value index="vDEF" type="NULL">123</value>' . $suffix,
4527  null
4528  ],
4529  'NULL double' => [
4530  $prefix . '<value index="vDEF" type="NULL">1.23</value>' . $suffix,
4531  null
4532  ],
4533  'array' => [
4534  $prefix . '<value index="vDEF" type="array"></value>' . $suffix,
4535  []
4536  ],
4537  ];
4538  }
4539 
4546  public function ‪xml2ArrayProcessHandlesAttributeTypes(string $input, $expected): void
4547  {
4548  $result = ‪GeneralUtility::xml2arrayProcess($input);
4549  self::assertSame($expected, $result['index']['vDEF']);
4550  }
4551 
4552  public function ‪locationHeaderUrlDataProvider(): array
4553  {
4554  return [
4555  'simple relative path' => [
4556  'foo',
4557  'foo.bar.test',
4558  'http://foo.bar.test/foo'
4559  ],
4560  'path beginning with slash' => [
4561  '/foo',
4562  'foo.bar.test',
4563  'http://foo.bar.test/foo'
4564  ],
4565  'path with full domain and https scheme' => [
4566  'https://example.com/foo',
4567  'foo.bar.test',
4568  'https://example.com/foo'
4569  ],
4570  'path with full domain and http scheme' => [
4571  'http://example.com/foo',
4572  'foo.bar.test',
4573  'http://example.com/foo'
4574  ],
4575  'path with full domain and relative scheme' => [
4576  '//example.com/foo',
4577  'foo.bar.test',
4578  '//example.com/foo'
4579  ],
4580  ];
4581  }
4582 
4591  public function ‪locationHeaderUrl($path, $host, $expected): void
4592  {
4595  true,
4596  false,
4602  ‪Environment::isWindows() ? 'WINDOWS' : 'UNIX'
4603  );
4604  $_SERVER['HTTP_HOST'] = $host;
4605  $_SERVER['SCRIPT_NAME'] = '/index.php';
4606  $result = GeneralUtility::locationHeaderUrl($path);
4607  self::assertSame($expected, $result);
4608  }
4609 
4614  {
4615  ‪$GLOBALS['TYPO3_CONF_VARS']['BE']['versionNumberInFilename'] = true;
4616 
4617  $uniqueFilename = ‪StringUtility::getUniqueId() . 'backend';
4618  $testFileDirectory = ‪Environment::getVarPath() . '/tests/';
4619  $testFilepath = $testFileDirectory . $uniqueFilename . '.css';
4620  $this->testFilesToDelete[] = $testFilepath;
4621  ‪GeneralUtility::mkdir_deep($testFileDirectory);
4622  touch($testFilepath);
4623 
4624  $versionedFilename = GeneralUtility::createVersionNumberedFilename($testFilepath);
4625 
4626  self::assertRegExp('/^.*\/tests\/' . $uniqueFilename . '\.[0-9]+\.css/', $versionedFilename);
4627  }
4628 }
‪TYPO3\CMS\Core\Utility\GeneralUtility\underscoredToLowerCamelCase
‪static string underscoredToLowerCamelCase($string)
Definition: GeneralUtility.php:902
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\sanitizeLocalUrlAcceptsEncodedValidPaths
‪sanitizeLocalUrlAcceptsEncodedValidPaths($path)
Definition: GeneralUtilityTest.php:1927
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpFqdnInvalidDataProvider
‪static array cmpFqdnInvalidDataProvider()
Definition: GeneralUtilityTest.php:469
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\gpDataProvider
‪array gpDataProvider()
Definition: GeneralUtilityTest.php:139
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2arrayProcessHandlesDocumentTag
‪xml2arrayProcessHandlesDocumentTag(string $input, string $docTag)
Definition: GeneralUtilityTest.php:4370
‪TYPO3\CMS\Core\Utility\GeneralUtility\xml2array
‪static mixed xml2array($string, $NSprefix='', $reportDocTag=false)
Definition: GeneralUtility.php:1531
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceWithZeroStringClassNameThrowsException
‪makeInstanceWithZeroStringClassNameThrowsException()
Definition: GeneralUtilityTest.php:3527
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\sanitizeLocalUrlAcceptsEncodedValidUrls
‪sanitizeLocalUrlAcceptsEncodedValidUrls($url, $host, $subDirectory)
Definition: GeneralUtilityTest.php:2006
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\createVersionNumberedFilenameDoesNotResolveBackpathForAbsolutePath
‪createVersionNumberedFilenameDoesNotResolveBackpathForAbsolutePath()
Definition: GeneralUtilityTest.php:4610
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\writeFileToTypo3tempDirWorksWithValidPath
‪writeFileToTypo3tempDirWorksWithValidPath($filePath)
Definition: GeneralUtilityTest.php:2838
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceResolvesConfiguredImplementationsRecursively
‪makeInstanceResolvesConfiguredImplementationsRecursively()
Definition: GeneralUtilityTest.php:3600
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getSingletonInstancesContainsPreviouslySetSingletonInstance
‪getSingletonInstancesContainsPreviouslySetSingletonInstance()
Definition: GeneralUtilityTest.php:3700
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirDoesNotRemoveDirectoryWithFilesAndReturnsFalseIfRecursiveDeletionIsOff
‪rmdirDoesNotRemoveDirectoryWithFilesAndReturnsFalseIfRecursiveDeletionIsOff()
Definition: GeneralUtilityTest.php:3099
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2ArrayProcessHandlesBigXmlContent
‪xml2ArrayProcessHandlesBigXmlContent(string $input, string $testValue)
Definition: GeneralUtilityTest.php:4420
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\dirnameWithDataProvider
‪dirnameWithDataProvider($input, $expectedValue)
Definition: GeneralUtilityTest.php:3443
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\underscoredToLowerCamelCase
‪underscoredToLowerCamelCase($expected, $inputString)
Definition: GeneralUtilityTest.php:1742
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validPathStrDataProvider
‪validPathStrDataProvider()
Definition: GeneralUtilityTest.php:3976
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpIPv6DataProviderNotMatching
‪static array cmpIPv6DataProviderNotMatching()
Definition: GeneralUtilityTest.php:325
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityMakeInstanceInjectLoggerFixture
Definition: GeneralUtilityMakeInstanceInjectLoggerFixture.php:28
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFilesInDirReturnsArrayWithMd5OfElementAndPathAsArrayKey
‪getFilesInDirReturnsArrayWithMd5OfElementAndPathAsArrayKey()
Definition: GeneralUtilityTest.php:3342
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\implodeArrayForUrlCanSkipEmptyParameters
‪implodeArrayForUrlCanSkipEmptyParameters()
Definition: GeneralUtilityTest.php:950
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\isFirstPartOfStrReturnsFalseForNotMatchingFirstPart
‪isFirstPartOfStrReturnsFalseForNotMatchingFirstPart($string, $part)
Definition: GeneralUtilityTest.php:710
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceWithBeginningSlashInClassNameThrowsException
‪makeInstanceWithBeginningSlashInClassNameThrowsException()
Definition: GeneralUtilityTest.php:3560
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFixture\resetFinalClassNameCache
‪static resetFinalClassNameCache()
Definition: GeneralUtilityFixture.php:62
‪TYPO3\CMS\Core\Core\Environment\getPublicPath
‪static string getPublicPath()
Definition: Environment.php:180
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validPathStrInvalidCharactersDataProvider
‪array validPathStrInvalidCharactersDataProvider()
Definition: GeneralUtilityTest.php:3933
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\isAllowedHostHeaderValueReturnsFalseIfTrustedHostsIsNotConfigured
‪isAllowedHostHeaderValueReturnsFalseIfTrustedHostsIsNotConfigured()
Definition: GeneralUtilityTest.php:1456
‪TYPO3\CMS\Core\Utility\GeneralUtility\minifyJavaScript
‪static string minifyJavaScript($script, &$error='')
Definition: GeneralUtility.php:1713
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\underscoredToLowerCamelCaseDataProvider
‪array underscoredToLowerCamelCaseDataProvider()
Definition: GeneralUtilityTest.php:1730
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\copyDirectoryCopiesFilesAndDirectoriesWithRelativePaths
‪copyDirectoryCopiesFilesAndDirectoriesWithRelativePaths()
Definition: GeneralUtilityTest.php:4004
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validIpReturnsTrueForValidIp
‪validIpReturnsTrueForValidIp($ip)
Definition: GeneralUtilityTest.php:399
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\array2xmlConvertsEmptyArraysToElementWithoutContent
‪array2xmlConvertsEmptyArraysToElementWithoutContent()
Definition: GeneralUtilityTest.php:4170
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpFqdnReturnsTrue
‪cmpFqdnReturnsTrue($baseHost, $list)
Definition: GeneralUtilityTest.php:459
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\invalidIpDataProvider
‪static array invalidIpDataProvider()
Definition: GeneralUtilityTest.php:409
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\hmacReturnsEqualHashesForEqualInput
‪hmacReturnsEqualHashesForEqualInput()
Definition: GeneralUtilityTest.php:2313
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFixture
Definition: GeneralUtilityFixture.php:24
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirCreatesHiddenDirectory
‪mkdirCreatesHiddenDirectory()
Definition: GeneralUtilityTest.php:2674
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\inListForItemNotContainedReturnsFalseDataProvider
‪array inListForItemNotContainedReturnsFalseDataProvider()
Definition: GeneralUtilityTest.php:529
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\hmacReturnsNoEqualHashesForNonEqualInput
‪hmacReturnsNoEqualHashesForNonEqualInput()
Definition: GeneralUtilityTest.php:2323
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\NO_FIX_PERMISSIONS_ON_WINDOWS
‪const NO_FIX_PERMISSIONS_ON_WINDOWS
Definition: GeneralUtilityTest.php:49
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFixture\isAllowedHostHeaderValue
‪static bool isAllowedHostHeaderValue($hostHeaderValue)
Definition: GeneralUtilityFixture.php:35
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceWithEmptyArrayThrowsException
‪makeInstanceWithEmptyArrayThrowsException()
Definition: GeneralUtilityTest.php:3538
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validEmailValidDataProvider
‪array validEmailValidDataProvider()
Definition: GeneralUtilityTest.php:828
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\htmlspecialcharsDecodeReturnsDecodedString
‪htmlspecialcharsDecodeReturnsDecodedString()
Definition: GeneralUtilityTest.php:812
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesDirectoriesRecursiveAndReturnsTrue
‪rmdirRemovesDirectoriesRecursiveAndReturnsTrue()
Definition: GeneralUtilityTest.php:3115
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\explodeUrl2ArrayDataProvider
‪array explodeUrl2ArrayDataProvider()
Definition: GeneralUtilityTest.php:981
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getAllFilesAndFoldersInPathReturnsArrayWithMd5Keys
‪getAllFilesAndFoldersInPathReturnsArrayWithMd5Keys()
Definition: GeneralUtilityTest.php:4149
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepCreatesDirectoryWithDoubleSlashes
‪mkdirDeepCreatesDirectoryWithDoubleSlashes($directoryToCreate)
Definition: GeneralUtilityTest.php:2891
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\SingletonClassFixture
Definition: SingletonClassFixture.php:24
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsGroup
‪fixPermissionsSetsGroup()
Definition: GeneralUtilityTest.php:2415
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\quoteJsValueTest
‪quoteJsValueTest($input, $expected)
Definition: GeneralUtilityTest.php:2390
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\implodeArrayForUrlBuildsValidParameterString
‪implodeArrayForUrlBuildsValidParameterString($name, $input, $expected)
Definition: GeneralUtilityTest.php:942
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFixture\setAllowHostHeaderValue
‪static setAllowHostHeaderValue($allowHostHeaderValue)
Definition: GeneralUtilityFixture.php:44
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFilesystemFixture\writeFileToTypo3tempDir
‪static string writeFileToTypo3tempDir($filepath, $content)
Definition: GeneralUtilityFilesystemFixture.php:65
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirSetsGroupOwnershipOfCreatedDirectory
‪mkdirSetsGroupOwnershipOfCreatedDirectory()
Definition: GeneralUtilityTest.php:2716
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\setSingletonInstanceMakesMakeInstanceReturnThatInstance
‪setSingletonInstanceMakesMakeInstanceReturnThatInstance()
Definition: GeneralUtilityTest.php:3676
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\sanitizeLocalUrlValidUrlsDataProvider
‪array sanitizeLocalUrlValidUrlsDataProvider()
Definition: GeneralUtilityTest.php:1948
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesFile
‪rmdirRemovesFile()
Definition: GeneralUtilityTest.php:3047
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepCreatesDirectoryWithAndWithoutDoubleSlashesDataProvider
‪array mkdirDeepCreatesDirectoryWithAndWithoutDoubleSlashesDataProvider()
Definition: GeneralUtilityTest.php:2879
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validEmailInvalidDataProvider
‪array validEmailInvalidDataProvider()
Definition: GeneralUtilityTest.php:864
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceInjectsLogger
‪makeInstanceInjectsLogger()
Definition: GeneralUtilityTest.php:3640
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\callUserFunctionWillThrowExceptionForInvalidParameters
‪callUserFunctionWillThrowExceptionForInvalidParameters($functionName, $expectedException)
Definition: GeneralUtilityTest.php:4063
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\copyDirectoryCopiesFilesAndDirectoriesWithAbsolutePaths
‪copyDirectoryCopiesFilesAndDirectoriesWithAbsolutePaths()
Definition: GeneralUtilityTest.php:4028
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\callUserFunctionCanCallMethod
‪callUserFunctionCanCallMethod()
Definition: GeneralUtilityTest.php:4108
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getDirsReturnsStringErrorOnPathFailure
‪getDirsReturnsStringErrorOnPathFailure()
Definition: GeneralUtilityTest.php:2289
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\unlink_tempfileRemovesValidFileInTypo3temp
‪unlink_tempfileRemovesValidFileInTypo3temp()
Definition: GeneralUtilityTest.php:2105
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\addInstanceMakesMakeInstanceReturnThatInstance
‪addInstanceMakesMakeInstanceReturnThatInstance()
Definition: GeneralUtilityTest.php:3794
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\compileSelectedGetVarsFromArrayUsesGetPostDataFallback
‪compileSelectedGetVarsFromArrayUsesGetPostDataFallback()
Definition: GeneralUtilityTest.php:1008
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2arrayUsesCache
‪xml2arrayUsesCache()
Definition: GeneralUtilityTest.php:4186
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFilesInDirByExtensionDoesNotFindFilesWithOtherExtensions
‪getFilesInDirByExtensionDoesNotFindFilesWithOtherExtensions()
Definition: GeneralUtilityTest.php:3273
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFilesInDirDoesSortAlphabeticallyByDefault
‪getFilesInDirDoesSortAlphabeticallyByDefault()
Definition: GeneralUtilityTest.php:3310
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFixture\$isAllowedHostHeaderValueCallCount
‪static int $isAllowedHostHeaderValueCallCount
Definition: GeneralUtilityFixture.php:27
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\trimExplodeReturnsCorrectResult
‪trimExplodeReturnsCorrectResult($delimiter, $testString, $removeEmpty, $limit, $expectedResult)
Definition: GeneralUtilityTest.php:1125
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\sanitizeLocalUrlDeniesPlainInvalidUrlsInBackendContext
‪sanitizeLocalUrlDeniesPlainInvalidUrlsInBackendContext(string $url)
Definition: GeneralUtilityTest.php:2048
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\ExtendedSingletonClassFixture
Definition: ExtendedSingletonClassFixture.php:22
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToHiddenFile
‪fixPermissionsSetsPermissionsToHiddenFile()
Definition: GeneralUtilityTest.php:2454
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFileAbsFileNameReturnsCorrectValues
‪getFileAbsFileNameReturnsCorrectValues($path, $expected)
Definition: GeneralUtilityTest.php:3898
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceCalledTwoTimesForSingletonClassReturnsSameInstance
‪makeInstanceCalledTwoTimesForSingletonClassReturnsSameInstance()
Definition: GeneralUtilityTest.php:3620
‪TYPO3\CMS\Core\Core\Environment\isWindows
‪static bool isWindows()
Definition: Environment.php:292
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\isFirstPartOfStrReturnsTrueForMatchingFirstPartDataProvider
‪array isFirstPartOfStrReturnsTrueForMatchingFirstPartDataProvider()
Definition: GeneralUtilityTest.php:659
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\hostnamesNotMatchingTrustedHostsConfigurationDataProvider
‪static array hostnamesNotMatchingTrustedHostsConfigurationDataProvider()
Definition: GeneralUtilityTest.php:1481
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFileAbsFileNameDateprovider
‪array getFileAbsFileNameDateprovider()
Definition: GeneralUtilityTest.php:3842
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\sanitizeLocalUrlInvalidDataProvider
‪array sanitizeLocalUrlInvalidDataProvider()
Definition: GeneralUtilityTest.php:2029
‪TYPO3\CMS\Core\Tests\Unit\Utility
‪TYPO3\CMS\Core\Core\Environment\getCurrentScript
‪static string getCurrentScript()
Definition: Environment.php:220
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\callUserFunctionInvalidParameterDataprovider
‪array callUserFunctionInvalidParameterDataprovider()
Definition: GeneralUtilityTest.php:4078
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepCreatesDirectoryInVfsStream
‪mkdirDeepCreatesDirectoryInVfsStream()
Definition: GeneralUtilityTest.php:3009
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\canRetrieveGlobalInputsThroughPost
‪canRetrieveGlobalInputsThroughPost($key, $post, $expected)
Definition: GeneralUtilityTest.php:223
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\isFirstPartOfStrReturnsFalseForNotMatchingFirstPartDataProvider
‪array isFirstPartOfStrReturnsFalseForNotMatchingFirstPartDataProvider()
Definition: GeneralUtilityTest.php:684
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesDirectoryWithTrailingSlash
‪rmdirRemovesDirectoryWithTrailingSlash()
Definition: GeneralUtilityTest.php:3088
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\splitFileRefReturnsFileTypeForFilesWithoutPathSite
‪splitFileRefReturnsFileTypeForFilesWithoutPathSite()
Definition: GeneralUtilityTest.php:3406
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\camelCaseToLowerCaseUnderscored
‪camelCaseToLowerCaseUnderscored($expected, $inputString)
Definition: GeneralUtilityTest.php:1769
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\GeneralUtilityFilesystemFixture
Definition: GeneralUtilityFilesystemFixture.php:24
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\hostnamesMatchingTrustedHostsConfigurationDataProvider
‪static array hostnamesMatchingTrustedHostsConfigurationDataProvider()
Definition: GeneralUtilityTest.php:1465
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getIndpEnvTypo3HostOnlyParsesHostnamesAndIpAddresses
‪getIndpEnvTypo3HostOnlyParsesHostnamesAndIpAddresses($httpHost, $expectedIp)
Definition: GeneralUtilityTest.php:1447
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceWithEmptyClassNameThrowsException
‪makeInstanceWithEmptyClassNameThrowsException()
Definition: GeneralUtilityTest.php:3505
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\allGetIndpEnvCallsRelatedToHostNamesCallIsAllowedHostHeaderValue
‪allGetIndpEnvCallsRelatedToHostNamesCallIsAllowedHostHeaderValue()
Definition: GeneralUtilityTest.php:1647
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\expandListExpandsIntegerRanges
‪expandListExpandsIntegerRanges($list, $expectation)
Definition: GeneralUtilityTest.php:587
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\callUserFunctionTrimsSpaces
‪callUserFunctionTrimsSpaces()
Definition: GeneralUtilityTest.php:4139
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsDefaultPermissionsToFile
‪fixPermissionsSetsDefaultPermissionsToFile()
Definition: GeneralUtilityTest.php:2623
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\isConnected
‪bool isConnected()
Definition: GeneralUtilityTest.php:93
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2ArrayFailsWithXmlContentBiggerThanTenMegabytes
‪xml2ArrayFailsWithXmlContentBiggerThanTenMegabytes()
Definition: GeneralUtilityTest.php:4442
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpIPv4DataProviderMatching
‪static array cmpIPv4DataProviderMatching()
Definition: GeneralUtilityTest.php:237
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\callUserFunctionAcceptsClosures
‪callUserFunctionAcceptsClosures()
Definition: GeneralUtilityTest.php:4126
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstancePassesParametersToConstructor
‪makeInstancePassesParametersToConstructor()
Definition: GeneralUtilityTest.php:3580
‪TYPO3\CMS\Core\Utility\GeneralUtility\camelCaseToLowerCaseUnderscored
‪static string camelCaseToLowerCaseUnderscored($string)
Definition: GeneralUtility.php:914
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2arrayProcessHandlesWhitespacesDataProvider
‪string[][] xml2arrayProcessHandlesWhitespacesDataProvider()
Definition: GeneralUtilityTest.php:4200
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\normalizeCompressIPv6DataProviderCorrect
‪static array normalizeCompressIPv6DataProviderCorrect()
Definition: GeneralUtilityTest.php:356
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepDoesNotChangePermissionsOfExistingSubDirectories
‪mkdirDeepDoesNotChangePermissionsOfExistingSubDirectories()
Definition: GeneralUtilityTest.php:2938
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2arrayProcessHandlesDocumentTagDataProvider
‪array[] xml2arrayProcessHandlesDocumentTagDataProvider()
Definition: GeneralUtilityTest.php:4327
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirCreatesDirectory
‪mkdirCreatesDirectory()
Definition: GeneralUtilityTest.php:2662
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmFromListRemovesElementsFromCommaSeparatedList
‪rmFromListRemovesElementsFromCommaSeparatedList($initialList, $listWithElementRemoved)
Definition: GeneralUtilityTest.php:547
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\normalizeIPv6CorrectlyNormalizesAddresses
‪normalizeIPv6CorrectlyNormalizesAddresses($compressed, $normalized)
Definition: GeneralUtilityTest.php:372
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\intExplodeConvertsStringsToInteger
‪intExplodeConvertsStringsToInteger()
Definition: GeneralUtilityTest.php:911
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\uniqueListUnifiesCommaSeparatedList
‪uniqueListUnifiesCommaSeparatedList($initialList, $unifiedList)
Definition: GeneralUtilityTest.php:630
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\uniqueListUnifiesCommaSeparatedListDataProvider
‪array uniqueListUnifiesCommaSeparatedListDataProvider()
Definition: GeneralUtilityTest.php:640
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepThrowsExceptionIfBaseDirectoryIsNotOfTypeString
‪mkdirDeepThrowsExceptionIfBaseDirectoryIsNotOfTypeString()
Definition: GeneralUtilityTest.php:3032
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\TwoParametersConstructorFixture
Definition: TwoParametersConstructorFixture.php:22
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesDirectory
‪rmdirRemovesDirectory()
Definition: GeneralUtilityTest.php:3077
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\ReplacementClassFixture
Definition: ReplacementClassFixture.php:22
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\invalidFilePathForTypo3tempDirDataProvider
‪array invalidFilePathForTypo3tempDirDataProvider()
Definition: GeneralUtilityTest.php:2763
‪TYPO3\CMS\Core\Utility\GeneralUtility\implodeArrayForUrl
‪static string implodeArrayForUrl($name, array $theArray, $str='', $skipBlank=false, $rawurlencodeParamName=false)
Definition: GeneralUtility.php:1097
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\addInstanceForClassThatIsNoSubclassOfProvidedClassThrowsException
‪addInstanceForClassThatIsNoSubclassOfProvidedClassThrowsException()
Definition: GeneralUtilityTest.php:3767
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsDoesNotSetPermissionsToNotAllowedPath
‪fixPermissionsDoesNotSetPermissionsToNotAllowedPath()
Definition: GeneralUtilityTest.php:2587
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepFixesPermissionsOfCreatedDirectory
‪mkdirDeepFixesPermissionsOfCreatedDirectory()
Definition: GeneralUtilityTest.php:2901
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validEmailReturnsTrueForValidMailAddress
‪validEmailReturnsTrueForValidMailAddress($address)
Definition: GeneralUtilityTest.php:854
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\expandListExpandsIntegerRangesDataProvider
‪array expandListExpandsIntegerRangesDataProvider()
Definition: GeneralUtilityTest.php:597
‪TYPO3\CMS\Core\Core\Environment\getFrameworkBasePath
‪static string getFrameworkBasePath()
Definition: Environment.php:261
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getIndpEnvTypo3SitePathReturnsStringStartingWithDrive
‪getIndpEnvTypo3SitePathReturnsStringStartingWithDrive()
Definition: GeneralUtilityTest.php:1411
‪TYPO3\CMS\Core\Core\Environment\getContext
‪static ApplicationContext getContext()
Definition: Environment.php:133
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFilesInDirCreateTestDirectory
‪string getFilesInDirCreateTestDirectory()
Definition: GeneralUtilityTest.php:3178
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\sanitizeLocalUrlDeniesPlainInvalidUrlsInFrontendContext
‪sanitizeLocalUrlDeniesPlainInvalidUrlsInFrontendContext(string $url)
Definition: GeneralUtilityTest.php:2071
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getIndpEnvTypo3PortParsesHostnamesAndIpAddresses
‪getIndpEnvTypo3PortParsesHostnamesAndIpAddresses($httpHost, $dummy, $expectedPort)
Definition: GeneralUtilityTest.php:1691
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\unlink_tempfileRemovesHiddenFile
‪unlink_tempfileRemovesHiddenFile()
Definition: GeneralUtilityTest.php:2118
‪TYPO3\CMS\Core\Utility\GeneralUtility\get_dirs
‪static string[] string null get_dirs($path)
Definition: GeneralUtility.php:2170
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFilesInDirDoesNotFindDirectories
‪getFilesInDirDoesNotFindDirectories()
Definition: GeneralUtilityTest.php:3354
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceCalledTwoTimesForSingletonClassWithPurgeInstancesInbetweenReturnsDifferentInstances
‪makeInstanceCalledTwoTimesForSingletonClassWithPurgeInstancesInbetweenReturnsDifferentInstances()
Definition: GeneralUtilityTest.php:3629
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility
Definition: ExtensionManagementUtility.php:43
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToHiddenDirectory
‪fixPermissionsSetsPermissionsToHiddenDirectory()
Definition: GeneralUtilityTest.php:2515
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\implodeArrayForUrlDataProvider
‪array implodeArrayForUrlDataProvider()
Definition: GeneralUtilityTest.php:927
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\setUp
‪setUp()
Definition: GeneralUtilityTest.php:66
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\isFirstPartOfStrReturnsTrueForMatchingFirstPart
‪isFirstPartOfStrReturnsTrueForMatchingFirstPart($string, $part)
Definition: GeneralUtilityTest.php:674
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceWithNullClassNameThrowsException
‪makeInstanceWithNullClassNameThrowsException()
Definition: GeneralUtilityTest.php:3516
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFilesInDirDoesNotFindDotfiles
‪getFilesInDirDoesNotFindDotfiles()
Definition: GeneralUtilityTest.php:3371
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\setSingletonInstanceForClassThatIsNoSubclassOfProvidedClassThrowsException
‪setSingletonInstanceForClassThatIsNoSubclassOfProvidedClassThrowsException()
Definition: GeneralUtilityTest.php:3661
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\implodeArrayForUrlCanUrlEncodeKeyNames
‪implodeArrayForUrlCanUrlEncodeKeyNames()
Definition: GeneralUtilityTest.php:960
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepFixesPermissionsOnNewParentDirectory
‪mkdirDeepFixesPermissionsOnNewParentDirectory()
Definition: GeneralUtilityTest.php:2919
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\inListForItemNotContainedReturnsFalse
‪inListForItemNotContainedReturnsFalse($haystack)
Definition: GeneralUtilityTest.php:519
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\$resetSingletonInstances
‪bool $resetSingletonInstances
Definition: GeneralUtilityTest.php:53
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2ArrayProcessHandlesBigXmlContentDataProvider
‪array[] xml2ArrayProcessHandlesBigXmlContentDataProvider()
Definition: GeneralUtilityTest.php:4386
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmFromListRemovesElementsFromCommaSeparatedListDataProvider
‪array rmFromListRemovesElementsFromCommaSeparatedListDataProvider()
Definition: GeneralUtilityTest.php:557
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsDefaultPermissionsToDirectory
‪fixPermissionsSetsDefaultPermissionsToDirectory()
Definition: GeneralUtilityTest.php:2641
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpFqdnValidDataProvider
‪static array cmpFqdnValidDataProvider()
Definition: GeneralUtilityTest.php:439
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFilesInDirCanOrderByMtime
‪getFilesInDirCanOrderByMtime()
Definition: GeneralUtilityTest.php:3322
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\hostnameAndPortDataProvider
‪static array hostnameAndPortDataProvider()
Definition: GeneralUtilityTest.php:1429
‪TYPO3\CMS\Core\Core\Environment\getProjectPath
‪static string getProjectPath()
Definition: Environment.php:169
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest
Definition: GeneralUtilityTest.php:48
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validURLReturnsTrueForValidResource
‪validURLReturnsTrueForValidResource($url)
Definition: GeneralUtilityTest.php:1811
‪TYPO3\CMS\Core\Utility\GeneralUtility\ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL
‪const ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL
Definition: GeneralUtility.php:47
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\tearDown
‪tearDown()
Definition: GeneralUtilityTest.php:78
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsCorrectlySetsPermissionsRecursive
‪fixPermissionsCorrectlySetsPermissionsRecursive()
Definition: GeneralUtilityTest.php:2536
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2ArrayProcessHandlesAttributeTypes
‪xml2ArrayProcessHandlesAttributeTypes(string $input, $expected)
Definition: GeneralUtilityTest.php:4543
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsWithRelativeFileReference
‪fixPermissionsSetsPermissionsWithRelativeFileReference()
Definition: GeneralUtilityTest.php:2603
‪TYPO3\CMS\Core\Utility\GeneralUtility\fixPermissions
‪static mixed fixPermissions($path, $recursive=false)
Definition: GeneralUtility.php:1863
‪TYPO3\CMS\Core\Utility\ExtensionManagementUtility\setPackageManager
‪static setPackageManager(PackageManager $packageManager)
Definition: ExtensionManagementUtility.php:66
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2arrayProcessHandlesTagNamespacesDataProvider
‪string[][] xml2arrayProcessHandlesTagNamespacesDataProvider()
Definition: GeneralUtilityTest.php:4272
‪TYPO3\CMS\Core\Utility\GeneralUtility\mkdir_deep
‪static mkdir_deep($directory)
Definition: GeneralUtility.php:2022
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\inListForItemContainedReturnsTrue
‪inListForItemContainedReturnsTrue($haystack)
Definition: GeneralUtilityTest.php:494
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validIpReturnsFalseForInvalidIp
‪validIpReturnsFalseForInvalidIp($ip)
Definition: GeneralUtilityTest.php:426
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getBytesFromSizeMeasurementCalculatesCorrectByteValue
‪getBytesFromSizeMeasurementCalculatesCorrectByteValue($expected, $byteString)
Definition: GeneralUtilityTest.php:1370
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\sanitizeLocalUrlDeniesEncodedInvalidUrls
‪sanitizeLocalUrlDeniesEncodedInvalidUrls($url)
Definition: GeneralUtilityTest.php:2093
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getIndpEnvForHostThrowsExceptionForNotAllowedHostnameValues
‪getIndpEnvForHostThrowsExceptionForNotAllowedHostnameValues($httpHost, $hostNamePattern)
Definition: GeneralUtilityTest.php:1665
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\trimExplodeReturnsCorrectResultDataProvider
‪array trimExplodeReturnsCorrectResultDataProvider()
Definition: GeneralUtilityTest.php:1133
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\tempnamReturnsPathStartingWithGivenPrefix
‪tempnamReturnsPathStartingWithGivenPrefix()
Definition: GeneralUtilityTest.php:2165
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\underscoredToUpperCamelCaseDataProvider
‪array underscoredToUpperCamelCaseDataProvider()
Definition: GeneralUtilityTest.php:1705
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceWithNonEmptyArrayThrowsException
‪makeInstanceWithNonEmptyArrayThrowsException()
Definition: GeneralUtilityTest.php:3549
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesDeadLinkToDirectory
‪rmdirRemovesDeadLinkToDirectory()
Definition: GeneralUtilityTest.php:3143
‪TYPO3\CMS\Core\Package\Package
Definition: Package.php:26
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\isAllowedHostHeaderValueWorksCorrectlyWithWithServerNamePattern
‪isAllowedHostHeaderValueWorksCorrectlyWithWithServerNamePattern($httpHost, $serverName, $isAllowed, $serverPort='80', $ssl='Off')
Definition: GeneralUtilityTest.php:1606
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\unlink_tempfileReturnsTrueIfFileWasRemoved
‪unlink_tempfileReturnsTrueIfFileWasRemoved()
Definition: GeneralUtilityTest.php:2131
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\checkGroups
‪mixed checkGroups($methodName)
Definition: GeneralUtilityTest.php:2741
‪TYPO3\CMS\Core\Utility\GeneralUtility\writeFileToTypo3tempDir
‪static string writeFileToTypo3tempDir($filepath, $content)
Definition: GeneralUtility.php:1928
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\removeDotsFromTypoScriptSucceedsWithDottedArray
‪removeDotsFromTypoScriptSucceedsWithDottedArray()
Definition: GeneralUtilityTest.php:2199
‪TYPO3\CMS\Core\Cache\CacheManager
Definition: CacheManager.php:35
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\sanitizeLocalUrlValidPathsDataProvider
‪array sanitizeLocalUrlValidPathsDataProvider()
Definition: GeneralUtilityTest.php:1888
‪TYPO3\CMS\Core\Core\Environment\initialize
‪static initialize(ApplicationContext $context, bool $cli, bool $composerMode, string $projectPath, string $publicPath, string $varPath, string $configPath, string $currentScript, string $os)
Definition: Environment.php:104
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\inListForItemContainedReturnsTrueDataProvider
‪array inListForItemContainedReturnsTrueDataProvider()
Definition: GeneralUtilityTest.php:504
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validIpDataProvider
‪static array validIpDataProvider()
Definition: GeneralUtilityTest.php:385
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirCreatesDirectoryWithTrailingSlash
‪mkdirCreatesDirectoryWithTrailingSlash()
Definition: GeneralUtilityTest.php:2686
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\tempnamReturnsAbsolutePathInVarPath
‪tempnamReturnsAbsolutePathInVarPath()
Definition: GeneralUtilityTest.php:2186
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\unlink_tempfileReturnsNullIfFileDoesNotExist
‪unlink_tempfileReturnsNullIfFileDoesNotExist()
Definition: GeneralUtilityTest.php:2143
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\quoteJsValueDataProvider
‪array quoteJsValueDataProvider()
Definition: GeneralUtilityTest.php:2338
‪TYPO3\CMS\Core\Core\Environment\getBackendPath
‪static string getBackendPath()
Definition: Environment.php:250
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validEmailReturnsFalseForInvalidMailAddress
‪validEmailReturnsFalseForInvalidMailAddress($address)
Definition: GeneralUtilityTest.php:900
‪TYPO3\CMS\Core\Utility\GeneralUtility\xml2arrayProcess
‪static mixed xml2arrayProcess($string, $NSprefix='', $reportDocTag=false)
Definition: GeneralUtility.php:1554
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\$backupPackageManager
‪TYPO3 CMS Core Package PackageManager $backupPackageManager
Definition: GeneralUtilityTest.php:61
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getIndpEnvTypo3SitePathReturnsStringStartingWithSlash
‪getIndpEnvTypo3SitePathReturnsStringStartingWithSlash()
Definition: GeneralUtilityTest.php:1390
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\callUserFunctionCanCallFunction
‪callUserFunctionCanCallFunction()
Definition: GeneralUtilityTest.php:4096
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceInstanciatesConfiguredImplementation
‪makeInstanceInstanciatesConfiguredImplementation()
Definition: GeneralUtilityTest.php:3590
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\resolveBackPathWithDataProvider
‪resolveBackPathWithDataProvider($input, $expectedValue)
Definition: GeneralUtilityTest.php:3494
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirReturnTrueIfFileWasRemoved
‪rmdirReturnTrueIfFileWasRemoved()
Definition: GeneralUtilityTest.php:3058
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\canRetrieveValueWithGP
‪canRetrieveValueWithGP($key, $get, $post, $expected)
Definition: GeneralUtilityTest.php:126
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\explodeUrl2ArrayTransformsParameterStringToFlatArray
‪explodeUrl2ArrayTransformsParameterStringToFlatArray($input, $expected)
Definition: GeneralUtilityTest.php:971
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirSetsPermissionsOfCreatedDirectory
‪mkdirSetsPermissionsOfCreatedDirectory()
Definition: GeneralUtilityTest.php:2698
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\setSingletonInstanceReturnsFinalClassNameWithOverriddenClass
‪setSingletonInstanceReturnsFinalClassNameWithOverriddenClass()
Definition: GeneralUtilityTest.php:3713
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getVirtualTestDir
‪string getVirtualTestDir($prefix='root_')
Definition: GeneralUtilityTest.php:111
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\formatSizeDataProvider
‪array formatSizeDataProvider()
Definition: GeneralUtilityTest.php:732
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepCreatesDirectory
‪mkdirDeepCreatesDirectory()
Definition: GeneralUtilityTest.php:2857
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\isAllowedHostHeaderValueWorksCorrectlyWithWithServerNamePatternAndSslProxy
‪isAllowedHostHeaderValueWorksCorrectlyWithWithServerNamePatternAndSslProxy($httpHost, $serverName, $isAllowed, $serverPort='80', $ssl='Off')
Definition: GeneralUtilityTest.php:1625
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\underscoredToUpperCamelCase
‪underscoredToUpperCamelCase($expected, $inputString)
Definition: GeneralUtilityTest.php:1717
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFilesInDirCanPrependPath
‪getFilesInDirCanPrependPath()
Definition: GeneralUtilityTest.php:3296
‪TYPO3\CMS\Core\Tests\Unit\Utility\AccessibleProxies\ExtensionManagementUtilityAccessibleProxy\getPackageManager
‪static getPackageManager()
Definition: ExtensionManagementUtilityAccessibleProxy.php:32
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\isOnCurrentHostReturnsTrueWithCurrentHost
‪isOnCurrentHostReturnsTrueWithCurrentHost()
Definition: GeneralUtilityTest.php:1857
‪TYPO3\CMS\Core\Utility\GeneralUtility\ENV_TRUSTED_HOSTS_PATTERN_SERVER_NAME
‪const ENV_TRUSTED_HOSTS_PATTERN_SERVER_NAME
Definition: GeneralUtility.php:48
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpIPv6DataProviderMatching
‪static array cmpIPv6DataProviderMatching()
Definition: GeneralUtilityTest.php:295
‪TYPO3\CMS\Core\Utility\GeneralUtility\trimExplode
‪static string[] trimExplode($delim, $string, $removeEmptyValues=false, $limit=0)
Definition: GeneralUtility.php:1059
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\OriginalClassFixture
Definition: OriginalClassFixture.php:22
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validPathStrDetectsInvalidCharacters
‪validPathStrDetectsInvalidCharacters($path)
Definition: GeneralUtilityTest.php:3968
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepCreatesSubdirectoriesRecursive
‪mkdirDeepCreatesSubdirectoriesRecursive()
Definition: GeneralUtilityTest.php:2867
‪$output
‪$output
Definition: annotationChecker.php:119
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\minifyJavaScriptReturnsInputStringIfNoHookIsRegistered
‪minifyJavaScriptReturnsInputStringIfNoHookIsRegistered()
Definition: GeneralUtilityTest.php:2401
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\purgeInstancesDropsAddedInstance
‪purgeInstancesDropsAddedInstance()
Definition: GeneralUtilityTest.php:3830
‪TYPO3\CMS\Core\Utility\GeneralUtility\isValidUrl
‪static bool isValidUrl($url)
Definition: GeneralUtility.php:944
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2arrayProcessHandlesTagNamespaces
‪xml2arrayProcessHandlesTagNamespaces(string $input)
Definition: GeneralUtilityTest.php:4312
‪TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
Definition: FrontendInterface.php:22
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepThrowsExceptionIfDirectoryCreationFails
‪mkdirDeepThrowsExceptionIfDirectoryCreationFails()
Definition: GeneralUtilityTest.php:3021
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpIPv4DataProviderNotMatching
‪static array cmpIPv4DataProviderNotMatching()
Definition: GeneralUtilityTest.php:266
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getIndpEnvForHostAllowsAllHostnameValuesIfHostPatternIsSetToAllowAll
‪getIndpEnvForHostAllowsAllHostnameValuesIfHostPatternIsSetToAllowAll($httpHost, $hostNamePattern)
Definition: GeneralUtilityTest.php:1680
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getIndpEnvTypo3SitePathReturnNonEmptyString
‪getIndpEnvTypo3SitePathReturnNonEmptyString()
Definition: GeneralUtilityTest.php:1381
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validPathStrWorksWithUnicodeFileNames
‪validPathStrWorksWithUnicodeFileNames($path)
Definition: GeneralUtilityTest.php:3992
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validURLReturnsFalseForInvalidResource
‪validURLReturnsFalseForInvalidResource($url)
Definition: GeneralUtilityTest.php:1846
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpFqdnReturnsFalse
‪cmpFqdnReturnsFalse($baseHost, $list)
Definition: GeneralUtilityTest.php:481
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpIPv4ReturnsTrueForMatchingAddress
‪cmpIPv4ReturnsTrueForMatchingAddress($ip, $list)
Definition: GeneralUtilityTest.php:256
‪TYPO3\CMS\Core\Utility\StringUtility\getUniqueId
‪static string getUniqueId($prefix='')
Definition: StringUtility.php:92
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\hmacReturnsHashOfProperLength
‪hmacReturnsHashOfProperLength()
Definition: GeneralUtilityTest.php:2303
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\removeDotsFromTypoScriptOverridesWithScalar
‪removeDotsFromTypoScriptOverridesWithScalar()
Definition: GeneralUtilityTest.php:2252
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\sanitizeLocalUrlAcceptsNotEncodedValidUrls
‪sanitizeLocalUrlAcceptsNotEncodedValidUrls($url, $host, $subDirectory)
Definition: GeneralUtilityTest.php:1981
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getDirsReturnsArrayOfDirectoriesFromGivenDirectory
‪getDirsReturnsArrayOfDirectoriesFromGivenDirectory()
Definition: GeneralUtilityTest.php:2280
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getAndPostDataProvider
‪array getAndPostDataProvider()
Definition: GeneralUtilityTest.php:199
‪TYPO3\CMS\Core\SingletonInterface
Definition: SingletonInterface.php:23
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\camelCaseToLowerCaseUnderscoredDataProvider
‪array camelCaseToLowerCaseUnderscoredDataProvider()
Definition: GeneralUtilityTest.php:1755
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToDirectory
‪fixPermissionsSetsPermissionsToDirectory()
Definition: GeneralUtilityTest.php:2474
‪TYPO3\CMS\Core\Utility\GeneralUtility\revExplode
‪static string[] revExplode($delimiter, $string, $count=0)
Definition: GeneralUtility.php:1025
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFilesInDirByExtensionFindsFiles
‪getFilesInDirByExtensionFindsFiles($fileExtensions)
Definition: GeneralUtilityTest.php:3260
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\revExplodeCorrectlyExplodesStringForGivenPartsCount
‪revExplodeCorrectlyExplodesStringForGivenPartsCount($delimiter, $testString, $count, $expectedArray)
Definition: GeneralUtilityTest.php:1095
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\resolveBackPathDataProvider
‪array array[] resolveBackPathDataProvider()
Definition: GeneralUtilityTest.php:3455
‪TYPO3\CMS\Core\Core\Environment
Definition: Environment.php:40
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpIPv6ReturnsFalseForNotMatchingAddress
‪cmpIPv6ReturnsFalseForNotMatchingAddress($ip, $list)
Definition: GeneralUtilityTest.php:343
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validUrlValidResourceDataProvider
‪array validUrlValidResourceDataProvider()
Definition: GeneralUtilityTest.php:1782
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\splitCalcDataProvider
‪array splitCalcDataProvider()
Definition: GeneralUtilityTest.php:779
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFilesInDirExcludesFilesMatchingPattern
‪getFilesInDirExcludesFilesMatchingPattern()
Definition: GeneralUtilityTest.php:3285
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\checkisOnCurrentHostInvalidHosts
‪array checkisOnCurrentHostInvalidHosts()
Definition: GeneralUtilityTest.php:1868
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\setSingletonInstanceCalledTwoTimesMakesMakeInstanceReturnLastSetInstance
‪setSingletonInstanceCalledTwoTimesMakesMakeInstanceReturnLastSetInstance()
Definition: GeneralUtilityTest.php:3687
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\resetSingletonInstancesResetsPreviouslySetInstance
‪resetSingletonInstancesResetsPreviouslySetInstance()
Definition: GeneralUtilityTest.php:3727
‪TYPO3\CMS\Core\Utility\GeneralUtility\intExplode
‪static int[] intExplode($delimiter, $string, $removeEmptyValues=false, $limit=0)
Definition: GeneralUtility.php:988
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\resetSingletonInstancesSetsGivenInstance
‪resetSingletonInstancesSetsGivenInstance()
Definition: GeneralUtilityTest.php:3740
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\isValidUrlInvalidResourceDataProvider
‪array isValidUrlInvalidResourceDataProvider()
Definition: GeneralUtilityTest.php:1821
‪TYPO3\CMS\Core\Utility\GeneralUtility\rmdir
‪static bool rmdir($path, $removeNonEmpty=false)
Definition: GeneralUtility.php:2075
‪TYPO3\CMS\Core\Core\Environment\getConfigPath
‪static string getConfigPath()
Definition: Environment.php:210
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\user_calledUserFunction
‪string user_calledUserFunction()
Definition: GeneralUtilityTest.php:4118
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceCalledTwoTimesAfterAddInstanceReturnTwoDifferentInstances
‪makeInstanceCalledTwoTimesAfterAddInstanceReturnTwoDifferentInstances()
Definition: GeneralUtilityTest.php:3805
‪TYPO3\CMS\Core\Tests\Unit\Utility\Fixtures\OtherReplacementClassFixture
Definition: OtherReplacementClassFixture.php:22
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\removeDotsFromTypoScriptOverridesSubArray
‪removeDotsFromTypoScriptOverridesSubArray()
Definition: GeneralUtilityTest.php:2225
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\$backupEnvironment
‪bool $backupEnvironment
Definition: GeneralUtilityTest.php:57
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\locationHeaderUrlDataProvider
‪locationHeaderUrlDataProvider()
Definition: GeneralUtilityTest.php:4549
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\tempnamReturnsPathWithoutBackslashes
‪tempnamReturnsPathWithoutBackslashes()
Definition: GeneralUtilityTest.php:2176
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToFile
‪fixPermissionsSetsPermissionsToFile()
Definition: GeneralUtilityTest.php:2434
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\addInstanceCalledTwoTimesMakesMakeInstanceReturnBothInstancesInAddingOrder
‪addInstanceCalledTwoTimesMakesMakeInstanceReturnBothInstancesInAddingOrder()
Definition: GeneralUtilityTest.php:3816
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\canRetrieveGlobalInputsThroughGet
‪canRetrieveGlobalInputsThroughGet($key, $get, $expected)
Definition: GeneralUtilityTest.php:213
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFilesInDirFindsHiddenFile
‪getFilesInDirFindsHiddenFile()
Definition: GeneralUtilityTest.php:3226
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\compileSelectedGetVarsFromArrayFiltersIncomingData
‪compileSelectedGetVarsFromArrayFiltersIncomingData()
Definition: GeneralUtilityTest.php:996
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\splitCalcCorrectlySplitsExpression
‪splitCalcCorrectlySplitsExpression(array $expected, string $expression)
Definition: GeneralUtilityTest.php:801
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepSetsGroupOwnershipOfCreatedParentDirectory
‪mkdirDeepSetsGroupOwnershipOfCreatedParentDirectory()
Definition: GeneralUtilityTest.php:2973
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpIPv4ReturnsFalseForNotMatchingAddress
‪cmpIPv4ReturnsFalseForNotMatchingAddress($ip, $list)
Definition: GeneralUtilityTest.php:282
‪TYPO3\CMS\Core\Tests\Unit\Utility\AccessibleProxies\ExtensionManagementUtilityAccessibleProxy
Definition: ExtensionManagementUtilityAccessibleProxy.php:26
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fixPermissionsSetsPermissionsToDirectoryWithTrailingSlash
‪fixPermissionsSetsPermissionsToDirectoryWithTrailingSlash()
Definition: GeneralUtilityTest.php:2494
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepSetsGroupOwnershipOnNewSubDirectory
‪mkdirDeepSetsGroupOwnershipOnNewSubDirectory()
Definition: GeneralUtilityTest.php:2991
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\isAllowedHostHeaderValueReturnsTrueIfHostValueMatches
‪isAllowedHostHeaderValueReturnsTrueIfHostValueMatches($httpHost, $hostNamePattern)
Definition: GeneralUtilityTest.php:1499
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2arrayProcessHandlesWhitespaces
‪xml2arrayProcessHandlesWhitespaces(string $input)
Definition: GeneralUtilityTest.php:4257
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceCalledTwoTimesForNonSingletonClassReturnsDifferentInstances
‪makeInstanceCalledTwoTimesForNonSingletonClassReturnsDifferentInstances()
Definition: GeneralUtilityTest.php:3611
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\sanitizeLocalUrlAcceptsNotEncodedValidPaths
‪sanitizeLocalUrlAcceptsNotEncodedValidPaths($path)
Definition: GeneralUtilityTest.php:1906
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\validFilePathForTypo3tempDirDataProvider
‪array validFilePathForTypo3tempDirDataProvider()
Definition: GeneralUtilityTest.php:2812
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getIndpEnvTypo3SitePathReturnsStringEndingWithSlash
‪getIndpEnvTypo3SitePathReturnsStringEndingWithSlash()
Definition: GeneralUtilityTest.php:1420
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:22
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\fileExtensionDataProvider
‪array fileExtensionDataProvider()
Definition: GeneralUtilityTest.php:3238
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\formatSizeTranslatesBytesToHigherOrderRepresentation
‪formatSizeTranslatesBytesToHigherOrderRepresentation($size, $labels, $base, $expected)
Definition: GeneralUtilityTest.php:722
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getBytesFromSizeMeasurementDataProvider
‪array getBytesFromSizeMeasurementDataProvider()
Definition: GeneralUtilityTest.php:1357
‪TYPO3\CMS\Core\Utility\GeneralUtility\mkdir
‪static bool mkdir($newFolder)
Definition: GeneralUtility.php:2005
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\getFilesInDirFindsRegularFile
‪getFilesInDirFindsRegularFile()
Definition: GeneralUtilityTest.php:3216
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\locationHeaderUrl
‪locationHeaderUrl($path, $host, $expected)
Definition: GeneralUtilityTest.php:4588
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\gpMergedDataProvider
‪array gpMergedDataProvider()
Definition: GeneralUtilityTest.php:175
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesLinkToDirectory
‪rmdirRemovesLinkToDirectory()
Definition: GeneralUtilityTest.php:3129
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\addInstanceWithSingletonInstanceThrowsException
‪addInstanceWithSingletonInstanceThrowsException()
Definition: GeneralUtilityTest.php:3782
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\makeInstanceReturnsClassInstance
‪makeInstanceReturnsClassInstance()
Definition: GeneralUtilityTest.php:3571
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\setSingletonInstanceForEmptyClassNameThrowsException
‪setSingletonInstanceForEmptyClassNameThrowsException()
Definition: GeneralUtilityTest.php:3649
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\cmpIPv6ReturnsTrueForMatchingAddress
‪cmpIPv6ReturnsTrueForMatchingAddress($ip, $list)
Definition: GeneralUtilityTest.php:315
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\serverNamePatternDataProvider
‪serverNamePatternDataProvider()
Definition: GeneralUtilityTest.php:1517
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirRemovesDeadLinkToFile
‪rmdirRemovesDeadLinkToFile()
Definition: GeneralUtilityTest.php:3158
‪TYPO3\CMS\Core\Utility\GeneralUtility\underscoredToUpperCamelCase
‪static string underscoredToUpperCamelCase($string)
Definition: GeneralUtility.php:890
‪TYPO3\CMS\Core\Core\Environment\getLegacyConfigPath
‪static string getLegacyConfigPath()
Definition: Environment.php:282
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\unlink_tempfileReturnsNullIfFileIsNowWithinTypo3temp
‪unlink_tempfileReturnsNullIfFileIsNowWithinTypo3temp()
Definition: GeneralUtilityTest.php:2152
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\splitFileRefReturnsFileTypeNotForFolders
‪splitFileRefReturnsFileTypeNotForFolders()
Definition: GeneralUtilityTest.php:3385
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\xml2ArrayProcessHandlesAttributeTypesDataProvider
‪array[] xml2ArrayProcessHandlesAttributeTypesDataProvider()
Definition: GeneralUtilityTest.php:4465
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\revExplodeRespectsLimitThreeWhenExploding
‪revExplodeRespectsLimitThreeWhenExploding()
Definition: GeneralUtilityTest.php:1104
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\writeFileToTypo3tempDirFailsWithInvalidPath
‪writeFileToTypo3tempDirFailsWithInvalidPath($invalidFilePath, string $expectedResult)
Definition: GeneralUtilityTest.php:2803
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\isAllowedHostHeaderValueReturnsFalseIfHostValueMatches
‪isAllowedHostHeaderValueReturnsFalseIfHostValueMatches($httpHost, $hostNamePattern)
Definition: GeneralUtilityTest.php:1511
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\mkdirDeepSetsGroupOwnershipOfCreatedDirectory
‪mkdirDeepSetsGroupOwnershipOfCreatedDirectory()
Definition: GeneralUtilityTest.php:2956
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\expandListExpandsForTwoThousandElementsExpandsOnlyToThousandElementsMaximum
‪expandListExpandsForTwoThousandElementsExpandsOnlyToThousandElementsMaximum()
Definition: GeneralUtilityTest.php:615
‪TYPO3\CMS\Core\Core\Environment\getVarPath
‪static string getVarPath()
Definition: Environment.php:192
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\rmdirReturnFalseIfNoFileWasRemoved
‪rmdirReturnFalseIfNoFileWasRemoved()
Definition: GeneralUtilityTest.php:3068
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\revExplodeDataProvider
‪array revExplodeDataProvider()
Definition: GeneralUtilityTest.php:1025
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\addInstanceForEmptyClassNameThrowsException
‪addInstanceForEmptyClassNameThrowsException()
Definition: GeneralUtilityTest.php:3755
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\dirnameDataProvider
‪array array[] dirnameDataProvider()
Definition: GeneralUtilityTest.php:3424
‪TYPO3\CMS\Core\Tests\Unit\Utility\GeneralUtilityTest\gpMergedWillMergeArraysFromGetAndPost
‪gpMergedWillMergeArraysFromGetAndPost($get, $post, $expected)
Definition: GeneralUtilityTest.php:163