19 use \org\bovigo\vfs\vfsStream;
20 use \org\bovigo\vfs\vfsStreamDirectory;
21 use \org\bovigo\vfs\vfsStreamWrapper;
50 foreach ($this->testFilesToDelete as $absoluteFileName) {
64 $connected = @fsockopen(
'typo3.org', 80);
93 'No key parameter' => array(NULL, array(), array(), NULL),
94 'Key not found' => array(
'cake', array(), array(), NULL),
95 'Value only in GET' => array(
'cake', array(
'cake' =>
'li\\e'), array(),
'lie'),
96 'Value only in POST' => array(
'cake', array(), array(
'cake' =>
'l\\ie'),
'lie'),
97 'Value from POST preferred over GET' => array(
'cake', array(
'cake' =>
'is a'), array(
'cake' =>
'\\lie'),
'lie'),
98 'Value can be an array' => array(
100 array(
'cake' => array(
'is a' =>
'l\\ie')),
102 array(
'is a' =>
'lie')
126 $fullDataArray = array(
'cake' => array(
'a' =>
'is a',
'b' =>
'lie'));
127 $postPartData = array(
'cake' => array(
'b' =>
'lie'));
128 $getPartData = array(
'cake' => array(
'a' =>
'is a'));
129 $getPartDataModified = array(
'cake' => array(
'a' =>
'is not a'));
131 'Key doesn\' exist' => array(array(
'foo'), array(
'bar'), array()),
132 'No POST data' => array($fullDataArray, array(), $fullDataArray[
'cake']),
133 'No GET data' => array(array(), $fullDataArray, $fullDataArray[
'cake']),
134 'POST and GET are merged' => array($getPartData, $postPartData, $fullDataArray[
'cake']),
135 'POST is preferred over GET' => array($getPartDataModified, $fullDataArray, $fullDataArray[
'cake'])
150 'Requested input data doesn\'t exist' => array(
'cake', array(), NULL),
151 'No key will return entire input data' => array(NULL, array(
'cake' =>
'l\\ie'), array(
'cake' =>
'lie')),
152 'Can retrieve specific input' => array(
'cake', array(
'cake' =>
'li\\e',
'foo'),
'lie'),
153 'Can retrieve nested input data' => array(
'cake', array(
'cake' => array(
'is a' =>
'l\\ie')), array(
'is a' =>
'lie'))
185 $this->assertSame($expected, $_GET);
195 'No input data used without target key' => array(NULL, NULL, array()),
196 'No input data used with target key' => array(NULL,
'cake', array(
'cake' =>
'')),
197 'No target key used with string input data' => array(
'data', NULL, array()),
198 'No target key used with array input data' => array(array(
'cake' =>
'lie'), NULL, array(
'cake' =>
'lie')),
199 'Target key and string input data' => array(
'lie',
'cake', array(
'cake' =>
'lie')),
200 'Replace existing GET data' => array(
'lie',
'cake', array(
'cake' =>
'lie'), array(
'cake' =>
'is a lie')),
201 'Target key pointing to sublevels and string input data' => array(
'lie',
'cake|is', array(
'cake' => array(
'is' =>
'lie'))),
202 'Target key pointing to sublevels and array input data' => array(array(
'a' =>
'lie'),
'cake|is', array(
'cake' => array(
'is' => array(
'a' =>
'lie'))))
216 'host with full IP address' => array(
'127.0.0.1',
'127.0.0.1'),
217 'host with two wildcards at the end' => array(
'127.0.0.1',
'127.0.*.*'),
218 'host with wildcard at third octet' => array(
'127.0.0.1',
'127.0.*.1'),
219 'host with wildcard at second octet' => array(
'127.0.0.1',
'127.*.0.1'),
220 '/8 subnet' => array(
'127.0.0.1',
'127.1.1.1/8'),
221 '/32 subnet (match only name)' => array(
'127.0.0.1',
'127.0.0.1/32'),
222 '/30 subnet' => array(
'10.10.3.1',
'10.10.3.3/30'),
223 'host with wildcard in list with IPv4/IPv6 addresses' => array(
'192.168.1.1',
'127.0.0.1, 1234:5678::/126, 192.168.*'),
224 'host in list with IPv4/IPv6 addresses' => array(
'192.168.1.1',
'::1, 1234:5678::/126, 192.168.1.1'),
243 'single host' => array(
'127.0.0.1',
'127.0.0.2'),
244 'single host with wildcard' => array(
'127.0.0.1',
'127.*.1.1'),
245 'single host with /32 subnet mask' => array(
'127.0.0.1',
'127.0.0.2/32'),
246 '/31 subnet' => array(
'127.0.0.1',
'127.0.0.2/31'),
247 'list with IPv4/IPv6 addresses' => array(
'127.0.0.1',
'10.0.2.3, 192.168.1.1, ::1'),
248 'list with only IPv6 addresses' => array(
'10.20.30.40',
'::1, 1234:5678::/127')
270 'empty address' => array(
'::',
'::'),
271 'empty with netmask in list' => array(
'::',
'::/0'),
272 'empty with netmask 0 and host-bits set in list' => array(
'::',
'::123/0'),
273 'localhost' => array(
'::1',
'::1'),
274 'localhost with leading zero blocks' => array(
'::1',
'0:0::1'),
275 'host with submask /128' => array(
'::1',
'0:0::1/128'),
276 '/16 subnet' => array(
'1234::1',
'1234:5678::/16'),
277 '/126 subnet' => array(
'1234:5678::3',
'1234:5678::/126'),
278 '/126 subnet with host-bits in list set' => array(
'1234:5678::3',
'1234:5678::2/126'),
279 'list with IPv4/IPv6 addresses' => array(
'1234:5678::3',
'::1, 127.0.0.1, 1234:5678::/126, 192.168.1.1')
298 'empty against localhost' => array(
'::',
'::1'),
299 'empty against localhost with /128 netmask' => array(
'::',
'::1/128'),
300 'localhost against different host' => array(
'::1',
'::2'),
301 'localhost against host with prior bits set' => array(
'::1',
'::1:1'),
302 'host against different /17 subnet' => array(
'1234::1',
'1234:f678::/17'),
303 'host against different /127 subnet' => array(
'1234:5678::3',
'1234:5678::/127'),
304 'host against IPv4 address list' => array(
'1234:5678::3',
'127.0.0.1, 192.168.1.1'),
305 'host against mixed list with IPv6 host in different subnet' => array(
'1234:5678::3',
'::1, 1234:5678::/127')
327 'empty 1' => array(
'::', str_pad(
'', 16,
"\x00")),
328 'empty 2, already normalized' => array(
'0000:0000:0000:0000:0000:0000:0000:0000', str_pad(
'', 16,
"\x00")),
329 'already normalized' => array(
'0102:0304:0000:0000:0000:0000:0506:0078',
"\x01\x02\x03\x04" . str_pad(
'', 8,
"\x00") .
"\x05\x06\x00\x78"),
330 'expansion in middle 1' => array(
'1::2',
"\x00\x01" . str_pad(
'', 12,
"\x00") .
"\x00\x02"),
331 'expansion in middle 2' => array(
'beef::fefa',
"\xbe\xef" . str_pad(
'', 12,
"\x00") .
"\xfe\xfa"),
353 'empty' => array(str_pad(
'', 16,
"\x00"),
'::'),
354 'non-empty front' => array(
"\x01" . str_pad(
'', 15,
"\x00"),
'100::'),
355 'non-empty back' => array(str_pad(
'', 15,
"\x00") .
"\x01",
'::1'),
356 'normalized' => array(
"\x01\x02\x03\x04" . str_pad(
'', 8,
"\x00") .
"\x05\x06\x00\x78",
'102:304::506:78'),
357 'expansion in middle 1' => array(
"\x00\x01" . str_pad(
'', 12,
"\x00") .
"\x00\x02",
'1::2'),
358 'expansion in middle 2' => array(
"\xbe\xef" . str_pad(
'', 12,
"\x00") .
"\xfe\xfa",
'beef::fefa'),
380 'empty' => array(
'::',
'0000:0000:0000:0000:0000:0000:0000:0000'),
381 'localhost' => array(
'::1',
'0000:0000:0000:0000:0000:0000:0000:0001'),
382 'expansion in middle 1' => array(
'1::2',
'0001:0000:0000:0000:0000:0000:0000:0002'),
383 'expansion in middle 2' => array(
'1:2::3',
'0001:0002:0000:0000:0000:0000:0000:0003'),
384 'expansion in middle 3' => array(
'1::2:3',
'0001:0000:0000:0000:0000:0000:0002:0003'),
385 'expansion in middle 4' => array(
'1:2::3:4:5',
'0001:0002:0000:0000:0000:0003:0004:0005')
409 if (strtolower(PHP_OS) ===
'darwin') {
410 $this->markTestSkipped(
'This test does not work on OSX / Darwin OS.');
425 '0.0.0.0' => array(
'0.0.0.0'),
426 'private IPv4 class C' => array(
'192.168.0.1'),
427 'private IPv4 class A' => array(
'10.0.13.1'),
428 'private IPv6' => array(
'fe80::daa2:5eff:fe8b:7dfb')
447 'null' => array(NULL),
449 'string' => array(
'test'),
450 'string empty' => array(
''),
451 'string NULL' => array(
'NULL'),
452 'out of bounds IPv4' => array(
'300.300.300.300'),
453 'dotted decimal notation with only two dots' => array(
'127.0.1')
475 'localhost should usually resolve, IPv4' => array(
'127.0.0.1',
'*'),
476 'localhost should usually resolve, IPv6' => array(
'::1',
'*'),
479 'aaa.bbb.ccc.ddd.eee, full' => array(
'aaa.bbb.ccc.ddd.eee',
'aaa.bbb.ccc.ddd.eee'),
480 'aaa.bbb.ccc.ddd.eee, wildcard first' => array(
'aaa.bbb.ccc.ddd.eee',
'*.ccc.ddd.eee'),
481 'aaa.bbb.ccc.ddd.eee, wildcard last' => array(
'aaa.bbb.ccc.ddd.eee',
'aaa.bbb.ccc.*'),
482 'aaa.bbb.ccc.ddd.eee, wildcard middle' => array(
'aaa.bbb.ccc.ddd.eee',
'aaa.*.eee'),
483 'list-matches, 1' => array(
'aaa.bbb.ccc.ddd.eee',
'xxx, yyy, zzz, aaa.*.eee'),
484 'list-matches, 2' => array(
'aaa.bbb.ccc.ddd.eee',
'127:0:0:1,,aaa.*.eee,::1')
503 'num-parts of hostname to check can only be less or equal than hostname, 1' => array(
'aaa.bbb.ccc.ddd.eee',
'aaa.bbb.ccc.ddd.eee.fff'),
504 'num-parts of hostname to check can only be less or equal than hostname, 2' => array(
'aaa.bbb.ccc.ddd.eee',
'aaa.*.bbb.ccc.ddd.eee')
535 'Element as second element of four items' => array(
'one,findme,three,four'),
536 'Element at beginning of list' => array(
'findme,one,two'),
537 'Element at end of list' => array(
'one,two,findme'),
538 'One item list' => array(
'findme')
558 'Four item list' => array(
'one,two,three,four'),
559 'One item list' => array(
'one'),
560 'Empty list' => array(
'')
584 'Element as second element of three' => array(
'one,removeme,two',
'one,two'),
585 'Element at beginning of list' => array(
'removeme,one,two',
'one,two'),
586 'Element at end of list' => array(
'one,two,removeme',
'one,two'),
587 'One item list' => array(
'removeme',
''),
588 'Element not contained in list' => array(
'one,two,three',
'one,two,three'),
589 'Empty element survives' => array(
'one,,three,,removeme',
'one,,three,'),
590 'Empty element survives at start' => array(
',removeme,three,removeme',
',three'),
591 'Empty element survives at end' => array(
'removeme,three,removeme,',
'three,'),
592 'Empty list' => array(
'',
''),
593 'List contains removeme multiple times' => array(
'removeme,notme,removeme,removeme',
'notme'),
594 'List contains removeme multiple times nothing else' => array(
'removeme,removeme,removeme',
''),
595 'List contains removeme multiple times nothing else 2x' => array(
'removeme,removeme',
''),
596 'List contains removeme multiple times nothing else 3x' => array(
'removeme,removeme,removeme',
''),
597 'List contains removeme multiple times nothing else 4x' => array(
'removeme,removeme,removeme,removeme',
''),
598 'List contains removeme multiple times nothing else 5x' => array(
'removeme,removeme,removeme,removeme,removeme',
''),
622 'Expand for the same number' => array(
'1,2-2,7',
'1,2,7'),
623 'Small range expand with parameters reversed ignores reversed items' => array(
'1,5-3,7',
'1,7'),
624 'Small range expand' => array(
'1,3-5,7',
'1,3,4,5,7'),
625 'Expand at beginning' => array(
'3-5,1,7',
'3,4,5,1,7'),
626 'Expand at end' => array(
'1,7,3-5',
'1,7,3,4,5'),
627 'Multiple small range expands' => array(
'1,3-5,7-10,12',
'1,3,4,5,7,8,9,10,12'),
628 'One item list' => array(
'1-5',
'1,2,3,4,5'),
629 'Nothing to expand' => array(
'1,2,3,4',
'1,2,3,4'),
630 'Empty list' => array(
'',
'')
639 $this->assertSame(1000, count(explode(
',', $list)));
662 'List without duplicates' => array(
'one,two,three',
'one,two,three'),
663 'List with two consecutive duplicates' => array(
'one,two,two,three,three',
'one,two,three'),
664 'List with non-consecutive duplicates' => array(
'one,two,three,two,three',
'one,two,three'),
665 'One item list' => array(
'one',
'one'),
666 'Empty list' => array(
'',
'')
680 'match first part of string' => array(
'hello world',
'hello'),
681 'match whole string' => array(
'hello',
'hello'),
682 'integer is part of string with same number' => array(
'24', 24),
683 'string is part of integer with same number' => array(24,
'24'),
684 'integer is part of string starting with same number' => array(
'24 beer please', 24)
703 'no string match' => array(
'hello',
'bye'),
704 'no case sensitive string match' => array(
'hello world',
'Hello'),
705 'array is not part of string' => array(
'string', array()),
706 'string is not part of array' => array(array(),
'string'),
707 'NULL is not part of string' => array(
'string', NULL),
708 'string is not part of NULL' => array(NULL,
'string'),
709 'NULL is not part of array' => array(array(), NULL),
710 'array is not part of NULL' => array(NULL, array()),
711 'empty string is not part of empty string' => array(
'',
''),
712 'NULL is not part of empty string' => array(
'', NULL),
713 'false is not part of empty string' => array(
'', FALSE),
714 'empty string is not part of NULL' => array(NULL,
''),
715 'empty string is not part of false' => array(FALSE,
''),
716 'empty string is not part of zero integer' => array(0,
''),
717 'zero integer is not part of NULL' => array(NULL, 0),
718 'zero integer is not part of empty string' => array(
'', 0)
748 'Bytes keep beeing bytes (min)' => array(1,
'',
'1 '),
749 'Bytes keep beeing bytes (max)' => array(899,
'',
'899 '),
750 'Kilobytes are detected' => array(1024,
'',
'1.0 K'),
751 'Megabytes are detected' => array(1048576,
'',
'1.0 M'),
752 'Gigabytes are detected' => array(1073741824,
'',
'1.0 G'),
753 'Decimal is omitted for large kilobytes' => array(31080,
'',
'30 K'),
754 'Decimal is omitted for large megabytes' => array(31458000,
'',
'30 M'),
755 'Decimal is omitted for large gigabytes' => array(32212254720,
'',
'30 G'),
756 'Label for bytes can be exchanged' => array(1,
' Foo|||',
'1 Foo'),
757 'Label for kilobytes can be exchanged' => array(1024,
'| Foo||',
'1.0 Foo'),
758 'Label for megabyes can be exchanged' => array(1048576,
'|| Foo|',
'1.0 Foo'),
759 'Label for gigabytes can be exchanged' => array(1073741824,
'||| Foo',
'1.0 Foo')
773 'empty string returns empty array' => array(
777 'number without operator returns array with plus and number' => array(
778 array(array(
'+', 42)),
781 'two numbers with asterisk return first number with plus and second number with asterisk' => array(
782 array(array(
'+', 42), array(
'*', 31)),
803 $string =
'<typo3 version="6.0"> </typo3>';
804 $encoded = htmlspecialchars($string);
805 $decoded = htmlspecialchars_decode($encoded);
806 $this->assertEquals($string, $decoded);
827 'Empty string' => array(
'',
''),
828 'Double encoded &' => array(
'&amp;',
'&'),
829 'Double encoded numeric entity' => array(
'&#1234;',
'Ӓ'),
830 'Double encoded hexadecimal entity' => array(
'&#x1b;',
''),
831 'Single encoded entities are not touched' => array(
'& Ӓ ',
'& Ӓ ')
853 'Empty string is not changed' => array(
'', FALSE,
''),
854 'Normal string is not changed' => array(
'The cake is a lie √', FALSE,
'The cake is a lie √'),
855 'String with single quotes' => array(
'The \'cake\' is a lie', FALSE,
'The \\\'cake\\\' is a lie'),
856 'String with single quotes and backslashes - just escape single quotes' => array(
'The \\\'cake\\\' is a lie', FALSE,
'The \\\\\'cake\\\\\' is a lie'),
857 'String with single quotes and backslashes - escape both' => array(
'The \\\'cake\\\' is a lie', TRUE,
'The \\\\\\\'cake\\\\\\\' is a lie')
868 $input =
'Encode \'me\', but leave my spaces √';
869 $expected =
'Encode %27me%27%2C but leave my spaces %E2%88%9A';
880 $input =
'Encode \'me\', but leave my / √';
881 $expected =
'Encode%20%27me%27%2C%20but%20leave%20my%20/%20%E2%88%9A';
895 'Empty string' => array(
'',
''),
896 'String containing only latin characters' => array(
'the cake is a lie.',
'THE CAKE IS A LIE.'),
897 'String with umlauts and accent characters' => array(
'the càkê is ä lie.',
'THE CàKê IS ä LIE.')
927 'short mail address' => array(
'a@b.c'),
928 'simple mail address' => array(
'test@example.com'),
929 'uppercase characters' => array(
'QWERTYUIOPASDFGHJKLZXCVBNM@QWERTYUIOPASDFGHJKLZXCVBNM.NET'),
932 'dash in local part' => array(
'test-mail@example.com'),
933 'plus in local part' => array(
'test+mail@example.com'),
936 'slash in local part' => array(
'foo/bar@example.com'),
937 'hash in local part' => array(
'foo#bar@example.com'),
942 'umlauts in domain part' => array(
'foo@äöüfoo.com')
961 'empty string' => array(
''),
962 'empty array' => array(array()),
963 'integer' => array(42),
964 'float' => array(42.23),
965 'array' => array(array(
'foo')),
966 'object' => array(
new \stdClass()),
967 '@ sign only' => array(
'@'),
968 'string longer than 320 characters' => array(str_repeat(
'0123456789', 33)),
969 'duplicate @' => array(
'test@@example.com'),
970 'duplicate @ combined with further special characters in local part' => array(
'test!.!@#$%^&*@example.com'),
971 'opening parenthesis in local part' => array(
'foo(bar@example.com'),
972 'closing parenthesis in local part' => array(
'foo)bar@example.com'),
973 'opening square bracket in local part' => array(
'foo[bar@example.com'),
974 'closing square bracket as local part' => array(
']@example.com'),
977 'dash as second level domain' => array(
'foo@-.com'),
978 'domain part starting with dash' => array(
'foo@-foo.com'),
979 'domain part ending with dash' => array(
'foo@foo-.com'),
980 'number as top level domain' => array(
'foo@bar.123'),
983 'dot at beginning of domain part' => array(
'test@.com'),
986 'umlauts in local part' => array(
'äöüfoo@bar.com'),
987 'trailing whitespace' => array(
'test@example.com '),
988 'trailing carriage return' => array(
'test@example.com' . CR),
989 'trailing linefeed' => array(
'test@example.com' . LF),
990 'trailing carriage return linefeed' => array(
'test@example.com' . CRLF),
991 'trailing tab' => array(
'test@example.com' . TAB)
1021 'Empty array' => array(array(),
'search', FALSE),
1022 'One item array no match' => array(array(
'one'),
'two', FALSE),
1023 'One item array match' => array(array(
'one'),
'one', TRUE),
1024 'Multiple items array no match' => array(array(
'one', 2,
'three', 4),
'four', FALSE),
1025 'Multiple items array match' => array(array(
'one', 2,
'three', 4),
'three', TRUE),
1026 'Integer search items can match string values' => array(array(
'0',
'1',
'2'), 1, TRUE),
1027 'Search item is not casted to integer for a match' => array(array(4),
'4a', FALSE),
1028 'Empty item won\'t match - in contrast to the php-builtin ' => array(array(0, 1, 2),
'', FALSE)
1039 $testString =
'1,foo,2';
1040 $expectedArray = array(1, 0, 2);
1042 $this->assertEquals($expectedArray, $actualArray);
1068 'Empty argument will match "all" elements' => array(NULL, $array, $array),
1069 'No match' => array(
'four', $array, array()),
1070 'One match' => array(
'two', $array, array(
'two' =>
'two')),
1071 'Multiple matches' => array(
'two,one', $array, array(
'one' =>
'one',
'two' =>
'two')),
1072 'Argument can be an array' => array(array(
'three'), $array, array(
'three' =>
'three'))
1085 'aa' => array(
'first',
'second'),
1086 'bb' => array(
'third',
'fourth'),
1087 'cc' => array(
'fifth',
'sixth')
1089 $expected = array(
'bb' => array(
'third',
'fourth'));
1090 $keepItems =
'third';
1091 $getValueFunc = create_function(
'$value',
'return $value[0];');
1093 $this->assertEquals($expected, $match);
1104 'aa' => array(
'first',
'second'),
1105 'bb' => array(
'third',
'fourth'),
1106 'cc' => array(
'fifth',
'sixth')
1108 $expected = array(
'bb' => array(
'third',
'fourth'));
1109 $keepItems =
'third';
1117 $this->assertEquals($expected, $match);
1130 $valueArray = array(
'one' =>
'√',
'two' => 2);
1132 'Empty input' => array(
'foo', array(),
''),
1133 'String parameters' => array(
'foo', $valueArray,
'&foo[one]=%E2%88%9A&foo[two]=2'),
1134 'Nested array parameters' => array(
'foo', array($valueArray),
'&foo[0][one]=%E2%88%9A&foo[0][two]=2'),
1135 'Keep blank parameters' => array(
'foo', array(
'one' =>
'√',
''),
'&foo[one]=%E2%88%9A&foo[0]=')
1151 $input = array(
'one' =>
'√',
'');
1152 $expected =
'&foo[one]=%E2%88%9A';
1160 $input = array(
'one' =>
'√',
'');
1161 $expected =
'&foo%5Bone%5D=%E2%88%9A&foo%5B0%5D=';
1170 $expected = $array ? array($name => $array) : array();
1189 'Empty string' => array(
'', array()),
1190 'Simple parameter string' => array(
'&one=%E2%88%9A&two=2', array(
'one' =>
'√',
'two' => 2)),
1191 'Nested parameter string' => array(
'&foo[one]=%E2%88%9A&two=2', array(
'foo[one]' =>
'√',
'two' => 2))
1202 $filter =
'foo,bar';
1203 $getArray = array(
'foo' => 1,
'cake' =>
'lie');
1204 $expected = array(
'foo' => 1);
1206 $this->assertSame($expected,
$result);
1214 $filter =
'foo,bar';
1215 $getArray = array(
'foo' => 1,
'cake' =>
'lie');
1216 $expected = array(
'foo' => 1,
'bar' =>
'2');
1218 $this->assertSame($expected,
$result);
1233 $keyMapping = array(
1243 $this->assertEquals($expected, $array);
1257 $array1 = array(10 =>
'FOO',
'20' =>
'BAR');
1258 $array2 = array(
'5' =>
'PLONK');
1259 $expected = array(
'5' =>
'PLONK', 10 =>
'FOO',
'20' =>
'BAR');
1272 'limit 0 should return unexploded string' => array(
1276 array(
'my:words:here')
1278 'limit 1 should return unexploded string' => array(
1282 array(
'my:words:here')
1284 'limit 2 should return two pieces' => array(
1288 array(
'my:words',
'here')
1290 'limit 3 should return unexploded string' => array(
1294 array(
'my',
'words',
'here')
1296 'limit 0 should return unexploded string if no delimiter is contained' => array(
1300 array(
'mywordshere')
1302 'limit 1 should return unexploded string if no delimiter is contained' => array(
1306 array(
'mywordshere')
1308 'limit 2 should return unexploded string if no delimiter is contained' => array(
1312 array(
'mywordshere')
1314 'limit 3 should return unexploded string if no delimiter is contained' => array(
1318 array(
'mywordshere')
1320 'multi character delimiter is handled properly with limit 2' => array(
1324 array(
'a[b][c',
'd]')
1326 'multi character delimiter is handled properly with limit 3' => array(
1330 array(
'a[b',
'c',
'd]')
1341 $this->assertEquals($expectedArray, $actualArray);
1348 $testString =
'even:more:of:my:words:here';
1349 $expectedArray = array(
'even:more:of:my',
'words',
'here');
1351 $this->assertEquals($expectedArray, $actualArray);
1361 $testString =
' a , b , c ,d ,, e,f,';
1362 $expectedArray = array(
'a',
'b',
'c',
'd',
'',
'e',
'f',
'');
1364 $this->assertEquals($expectedArray, $actualArray);
1371 $testString =
' a , b , ' . LF .
' ,d ,, e,f,';
1372 $expectedArray = array(
'a',
'b',
'd',
'e',
'f');
1374 $this->assertEquals($expectedArray, $actualArray);
1381 $testString =
'a , b , c , ,d ,, ,e,f,';
1382 $expectedArray = array(
'a',
'b',
'c',
'd',
'e',
'f');
1384 $this->assertEquals($expectedArray, $actualArray);
1391 $testString =
' a , b , c , , d,, ,e ';
1392 $expectedArray = array(
'a',
'b',
'c , , d,, ,e');
1395 $this->assertEquals($expectedArray, $actualArray);
1402 $testString =
' a , b , c , , d,, ,e ';
1403 $expectedArray = array(
'a',
'b',
'c , d,e');
1406 $this->assertEquals($expectedArray, $actualArray);
1413 $testString =
' a , b , c , d, ,e, f , , ';
1414 $expectedArray = array(
'a',
'b',
'c',
'd',
'',
'e');
1417 $this->assertEquals($expectedArray, $actualArray);
1424 $testString =
' a , b , c , d, ,e, f , , ';
1425 $expectedArray = array(
'a',
'b',
'c');
1428 $this->assertEquals($expectedArray, $actualArray);
1435 $testString =
' a , b , , c , , , ';
1436 $expectedArray = array(
'a',
'b',
'c');
1439 $this->assertEquals($expectedArray, $actualArray);
1446 $testString =
'a , b , c , ,d ,, ,e,f, 0 ,';
1447 $expectedArray = array(
'a',
'b',
'c',
'd',
'e',
'f',
'0');
1449 $this->assertEquals($expectedArray, $actualArray);
1459 $inputArray = array(
1465 $compareValue =
'test2';
1466 $expectedResult = array(
1471 $this->assertEquals($expectedResult, $actualResult);
1478 $inputArray = array(
1485 $compareValue =
'bar';
1486 $expectedResult = array(
1491 $this->assertEquals($expectedResult, $actualResult);
1498 $inputArray = array(
1504 $expectedResult = array(
1509 $this->assertEquals($expectedResult, $actualResult);
1522 '100 kilo Bytes' => array(
'102400',
'100k'),
1523 '100 mega Bytes' => array(
'104857600',
'100m'),
1524 '100 giga Bytes' => array(
'107374182400',
'100g')
1550 if (TYPO3_OS ===
'WIN') {
1551 $this->markTestSkipped(
'Test not available on Windows OS.');
1554 $this->assertEquals(
'/',
$result[0]);
1561 if (TYPO3_OS !==
'WIN') {
1562 $this->markTestSkipped(
'Test available only on Windows OS.');
1565 $this->assertRegExp(
'/^[a-z]:\//i',
$result);
1581 'localhost ipv4 without port' => array(
'127.0.0.1',
'127.0.0.1',
''),
1582 'localhost ipv4 with port' => array(
'127.0.0.1:81',
'127.0.0.1',
'81'),
1583 'localhost ipv6 without port' => array(
'[::1]',
'[::1]',
''),
1584 'localhost ipv6 with port' => array(
'[::1]:81',
'[::1]',
'81'),
1585 'ipv6 without port' => array(
'[2001:DB8::1]',
'[2001:DB8::1]',
''),
1586 'ipv6 with port' => array(
'[2001:DB8::1]:81',
'[2001:DB8::1]',
'81'),
1587 'hostname without port' => array(
'lolli.did.this',
'lolli.did.this',
''),
1588 'hostname with port' => array(
'lolli.did.this:42',
'lolli.did.this',
'42')
1597 $_SERVER[
'HTTP_HOST'] = $httpHost;
1605 unset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'trustedHostsPattern']);
1614 'hostname without port matching' => array(
'lolli.did.this',
'.*\.did\.this'),
1615 'other hostname without port matching' => array(
'helmut.did.this',
'.*\.did\.this'),
1616 'two different hostnames without port matching 1st host' => array(
'helmut.is.secure',
'(helmut\.is\.secure|lolli\.is\.secure)'),
1617 'two different hostnames without port matching 2nd host' => array(
'lolli.is.secure',
'(helmut\.is\.secure|lolli\.is\.secure)'),
1618 'hostname with port matching' => array(
'lolli.did.this:42',
'.*\.did\.this:42'),
1619 'hostnames are case insensitive 1' => array(
'lolli.DID.this:42',
'.*\.did.this:42'),
1620 'hostnames are case insensitive 2' => array(
'lolli.did.this:42',
'.*\.DID.this:42'),
1629 'hostname without port' => array(
'lolli.did.this',
'helmut\.did\.this'),
1630 'hostname with port, but port not allowed' => array(
'lolli.did.this:42',
'helmut\.did\.this'),
1631 'two different hostnames in pattern but host header starts with differnet value #1' => array(
'sub.helmut.is.secure',
'(helmut\.is\.secure|lolli\.is\.secure)'),
1632 'two different hostnames in pattern but host header starts with differnet value #2' => array(
'sub.lolli.is.secure',
'(helmut\.is\.secure|lolli\.is\.secure)'),
1633 'two different hostnames in pattern but host header ends with differnet value #1' => array(
'helmut.is.secure.tld',
'(helmut\.is\.secure|lolli\.is\.secure)'),
1634 'two different hostnames in pattern but host header ends with differnet value #2' => array(
'lolli.is.secure.tld',
'(helmut\.is\.secure|lolli\.is\.secure)'),
1645 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'trustedHostsPattern'] = $hostNamePattern;
1656 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'trustedHostsPattern'] = $hostNamePattern;
1662 'host value matches server name and server port is default http' => array(
1663 'httpHost' =>
'secure.web.server',
1664 'serverName' =>
'secure.web.server',
1665 'isAllowed' => TRUE,
1666 'serverPort' =>
'80',
1669 'host value matches server name if compared case insensitive 1' => array(
1670 'httpHost' =>
'secure.web.server',
1671 'serverName' =>
'secure.WEB.server',
1672 'isAllowed' => TRUE,
1674 'host value matches server name if compared case insensitive 2' => array(
1675 'httpHost' =>
'secure.WEB.server',
1676 'serverName' =>
'secure.web.server',
1677 'isAllowed' => TRUE,
1679 'host value matches server name and server port is default https' => array(
1680 'httpHost' =>
'secure.web.server',
1681 'serverName' =>
'secure.web.server',
1682 'isAllowed' => TRUE,
1683 'serverPort' =>
'443',
1686 'host value matches server name and server port' => array(
1687 'httpHost' =>
'secure.web.server:88',
1688 'serverName' =>
'secure.web.server',
1689 'isAllowed' => TRUE,
1690 'serverPort' =>
'88',
1692 'host value matches server name case insensitive 1 and server port' => array(
1693 'httpHost' =>
'secure.WEB.server:88',
1694 'serverName' =>
'secure.web.server',
1695 'isAllowed' => TRUE,
1696 'serverPort' =>
'88',
1698 'host value matches server name case insensitive 2 and server port' => array(
1699 'httpHost' =>
'secure.web.server:88',
1700 'serverName' =>
'secure.WEB.server',
1701 'isAllowed' => TRUE,
1702 'serverPort' =>
'88',
1704 'host value is ipv6 but matches server name and server port' => array(
1705 'httpHost' =>
'[::1]:81',
1706 'serverName' =>
'[::1]',
1707 'isAllowed' => TRUE,
1708 'serverPort' =>
'81',
1710 'host value does not match server name' => array(
1711 'httpHost' =>
'insecure.web.server',
1712 'serverName' =>
'secure.web.server',
1713 'isAllowed' => FALSE,
1715 'host value does not match server port' => array(
1716 'httpHost' =>
'secure.web.server:88',
1717 'serverName' =>
'secure.web.server',
1718 'isAllowed' => FALSE,
1719 'serverPort' =>
'89',
1721 'host value has default port that does not match server port' => array(
1722 'httpHost' =>
'secure.web.server',
1723 'serverName' =>
'secure.web.server',
1724 'isAllowed' => FALSE,
1725 'serverPort' =>
'81',
1728 'host value has default port that does not match server ssl port' => array(
1729 'httpHost' =>
'secure.web.server',
1730 'serverName' =>
'secure.web.server',
1731 'isAllowed' => FALSE,
1732 'serverPort' =>
'444',
1750 $_SERVER[
'SERVER_NAME'] = $serverName;
1751 $_SERVER[
'SERVER_PORT'] = $serverPort;
1752 $_SERVER[
'HTTPS'] = $ssl;
1776 $_SERVER[
'HTTP_HOST'] = $httpHost;
1777 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'trustedHostsPattern'] = $hostNamePattern;
1788 $_SERVER[
'HTTP_HOST'] = $httpHost;
1798 $_SERVER[
'HTTP_HOST'] = $httpHost;
1812 'single word' => array(
'Blogexample',
'blogexample'),
1813 'multiple words' => array(
'BlogExample',
'blog_example')
1835 'single word' => array(
'minimalvalue',
'minimalvalue'),
1836 'multiple words' => array(
'minimalValue',
'minimal_value')
1858 'single word' => array(
'blogexample',
'blogexample'),
1859 'single word starting upper case' => array(
'blogexample',
'Blogexample'),
1860 'two words starting lower case' => array(
'minimal_value',
'minimalValue'),
1861 'two words starting upper case' => array(
'blog_example',
'BlogExample')
1883 'single word' => array(
'blogexample',
'blogexample'),
1884 'single Word starting upper case' => array(
'blogexample',
'Blogexample'),
1885 'two words' => array(
'blogExample',
'BlogExample')
1893 public function lcFirst($expected, $inputString) {
1904 $this->assertEquals(
'=?utf-8?Q?We_test_whether_the_copyright_character_=C2=A9_is_encoded_correctly?=', Utility\
GeneralUtility::encodeHeader(
'We test whether the copyright character © is encoded correctly',
'quoted-printable',
'utf-8'));
1911 $this->assertEquals(
'=?utf-8?Q?Is_the_copyright_character_=C2=A9_really_encoded_correctly=3F_Really=3F?=', Utility\
GeneralUtility::encodeHeader(
'Is the copyright character © really encoded correctly? Really?',
'quoted-printable',
'utf-8'));
1924 'http' => array(
'http://www.example.org/'),
1925 'http without trailing slash' => array(
'http://qwe'),
1926 'http directory with trailing slash' => array(
'http://www.example/img/dir/'),
1927 'http directory without trailing slash' => array(
'http://www.example/img/dir'),
1928 'http index.html' => array(
'http://example.com/index.html'),
1929 'http index.php' => array(
'http://www.example.com/index.php'),
1930 'http test.png' => array(
'http://www.example/img/test.png'),
1931 'http username password querystring and ancher' => array(
'https://user:pw@www.example.org:80/path?arg=value#fragment'),
1932 'file' => array(
'file:///tmp/test.c'),
1933 'file directory' => array(
'file://foo/bar'),
1934 'ftp directory' => array(
'ftp://ftp.example.com/tmp/'),
1935 'mailto' => array(
'mailto:foo@bar.com'),
1936 'news' => array(
'news:news.php.net'),
1937 'telnet' => array(
'telnet://192.0.2.16:80/'),
1938 'ldap' => array(
'ldap://[2001:db8::7]/c=GB?objectClass?one'),
1939 'http punycode domain name' => array(
'http://www.xn--bb-eka.at'),
1940 'http punicode subdomain' => array(
'http://xn--h-zfa.oebb.at'),
1941 'http domain-name umlauts' => array(
'http://www.öbb.at'),
1942 'http subdomain umlauts' => array(
'http://äh.oebb.at'),
1961 'http missing colon' => array(
'http//www.example/wrong/url/'),
1962 'http missing slash' => array(
'http:/www.example'),
1963 'hostname only' => array(
'www.example.org/'),
1964 'file missing protocol specification' => array(
'/tmp/test.c'),
1965 'slash only' => array(
'/'),
1966 'string http://' => array(
'http://'),
1967 'string http:/' => array(
'http:/'),
1968 'string http:' => array(
'http:'),
1969 'string http' => array(
'http'),
1970 'empty string' => array(
''),
1971 'string -1' => array(
'-1'),
1972 'string array()' => array(
'array()'),
1973 'random string' => array(
'qwe'),
1974 'http directory umlauts' => array(
'http://www.oebb.at/äöü/'),
2004 'empty string' => array(
''),
2005 'arbitrary string' => array(
'arbitrary string'),
2006 'localhost IP' => array(
'127.0.0.1'),
2007 'relative path' => array(
'./relpath/file.txt'),
2008 'absolute path' => array(
'/abspath/file.txt?arg=value'),
2023 'alt_intro.php' => array(
'alt_intro.php'),
2024 'alt_intro.php?foo=1&bar=2' => array(
'alt_intro.php?foo=1&bar=2'),
2025 '../index.php' => array(
'../index.php'),
2026 '../typo3/alt_intro.php' => array(
'../typo3/alt_intro.php'),
2027 '../~userDirectory/index.php' => array(
'../~userDirectory/index.php'),
2028 '../typo3/mod.php?var1=test-case&var2=~user' => array(
'../typo3/mod.php?var1=test-case&var2=~user'),
2029 PATH_site .
'typo3/alt_intro.php' => array(PATH_site .
'typo3/alt_intro.php'),
2057 $host =
'localhost';
2058 $subDirectory =
'/cms/';
2061 $subDirectory .
'typo3/alt_intro.php' => array(
2062 $subDirectory .
'typo3/alt_intro.php',
2066 $subDirectory .
'index.php' => array(
2067 $subDirectory .
'index.php',
2071 'http://' .
$host .
'/typo3/alt_intro.php' => array(
2072 'http://' .
$host .
'/typo3/alt_intro.php',
2076 'http://' .
$host . $subDirectory .
'typo3/alt_intro.php' => array(
2077 'http://' .
$host . $subDirectory .
'typo3/alt_intro.php',
2092 $_SERVER[
'HTTP_HOST'] =
$host;
2093 $_SERVER[
'SCRIPT_NAME'] = $subDirectory .
'typo3/index.php';
2105 $_SERVER[
'HTTP_HOST'] =
$host;
2106 $_SERVER[
'SCRIPT_NAME'] = $subDirectory .
'typo3/index.php';
2117 'empty string' => array(
''),
2118 'http domain' => array(
'http://www.google.de/'),
2119 'https domain' => array(
'https://www.google.de/'),
2120 'relative path with XSS' => array(
'../typo3/whatever.php?argument=javascript:alert(0)'),
2121 'base64 encoded string' => array(
'data:%20text/html;base64,PHNjcmlwdD5hbGVydCgnWFNTJyk8L3NjcmlwdD4='),
2149 $fixtureFile = __DIR__ .
'/Fixtures/clear.gif';
2150 $testFilename = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_') .
'.gif';
2151 @copy($fixtureFile, $testFilename);
2153 $fileExists = file_exists($testFilename);
2154 $this->assertFalse($fileExists);
2161 $fixtureFile = __DIR__ .
'/Fixtures/clear.gif';
2162 $testFilename = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'.test_') .
'.gif';
2163 @copy($fixtureFile, $testFilename);
2165 $fileExists = file_exists($testFilename);
2166 $this->assertFalse($fileExists);
2173 $fixtureFile = __DIR__ .
'/Fixtures/clear.gif';
2174 $testFilename = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_') .
'.gif';
2175 @copy($fixtureFile, $testFilename);
2177 $this->assertTrue($returnValue);
2185 $this->assertNull($returnValue);
2193 $this->assertNull($returnValue);
2205 $fileName = basename($filePath);
2206 $this->assertStringStartsWith(
'foo', $fileName);
2214 $this->assertNotContains(
'\\', $filePath);
2222 $this->assertStringStartsWith(PATH_site, $filePath);
2232 $inputArray = array(
2234 'key11' =>
'val\'ue1',
2235 'key12' =>
'val"ue2' 2237 'key2' =>
'val\\ue3' 2239 $expectedResult = array(
2241 'key11' =>
'val\\\'ue1',
2242 'key12' =>
'val\\"ue2' 2244 'key2' =>
'val\\\\ue3' 2247 $this->assertEquals($expectedResult, $inputArray);
2257 $inputArray = array(
2259 'key11' =>
'val\\\'ue1',
2260 'key12' =>
'val\\"ue2' 2262 'key2' =>
'val\\\\ue3' 2264 $expectedResult = array(
2266 'key11' =>
'val\'ue1',
2267 'key12' =>
'val"ue2' 2269 'key2' =>
'val\\ue3' 2272 $this->assertEquals($expectedResult, $inputArray);
2291 $expectedResult = array(
2295 $this->assertEquals($expectedResult, $actualResult);
2305 'key21' =>
'value21',
2306 'key22' =>
'value22',
2308 'key231' =>
'value231',
2309 'key232' =>
'value232' 2316 'key21' =>
'value21',
2318 'key231' =>
'value231' 2322 $expectedResult = array(
2324 'key22' =>
'value22',
2326 'key232' =>
'value232' 2331 $this->assertEquals($expectedResult, $actualResult);
2340 'key11' =>
'value11',
2341 'key12' =>
'value12' 2349 'key21' =>
'value21' 2352 $expectedResult = array(
2356 $this->assertEquals($expectedResult, $actualResult);
2366 $typoScript = array(
2367 'propertyA.' => array(
2375 $expectedResult = array(
2376 'propertyA' => array(
2391 $typoScript = array(
2392 'propertyA.' => array(
2393 'keyA' =>
'getsOverridden',
2401 $expectedResult = array(
2402 'propertyA' => array(
2417 $typoScript = array(
2418 'propertyA.' => array(
2422 'keyA' =>
'willOverride',
2427 $expectedResult = array(
2428 'propertyA' => array(
2429 'keyA' =>
'willOverride',
2444 $testValues = array(
2449 foreach ($testValues as $testValue) {
2471 $expectedResult = array(
2485 $this->assertEquals($expectedResult, array_values($testArray));
2529 $expectedResult = array(
2543 $this->assertEquals($expectedResult, array_values(array_keys($testArray[
'aaa'][
'bad'])));
2544 $this->assertEquals($expectedResult, array_values(array_keys($testArray[
'aaa'])));
2545 $this->assertEquals($expectedResult, array_values(array_keys($testArray)));
2555 $path = PATH_typo3conf;
2557 $this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $directories);
2566 $expectedResult =
'error';
2567 $this->assertEquals($expectedResult,
$result);
2578 $this->assertTrue(!empty($hmac) && is_string($hmac));
2579 $this->assertTrue(strlen($hmac) == 40);
2610 'Immune characters are returned as is' => array(
2614 'Alphanumerical characters are returned as is' => array(
2615 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789',
2616 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' 2618 'Angle brackets and ampersand are encoded' => array(
2620 '\\u003C\\u003E\\u0026' 2622 'Quotes and backslashes are encoded' => array(
2624 '\\u0022\\u0027\\u005C' 2626 'Forward slashes are escaped' => array(
2628 '\\u003C\\/script\\u003E' 2630 'Empty string stays empty' => array(
2634 'Exclamation mark and space are properly encoded' => array(
2636 'Hello\\u0020World\\u0021' 2638 'Whitespaces are properly encoded' => array(
2639 TAB . LF . CR .
' ',
2640 '\\u0009\\u000A\\u000D\\u0020' 2642 'Null byte is properly encoded' => array(
2646 'Umlauts are properly encoded' => array(
2648 '\\u00dc\\u00fc\\u00d6\\u00f6\\u00c4\\u00e4' 2671 $GLOBALS[
'HTTP_GET_VARS'] = array();
2672 $getParameters = array(
'foo' =>
'bar');
2674 $this->assertSame($getParameters, $_GET);
2682 $GLOBALS[
'HTTP_GET_VARS'] = array();
2683 $getParameters = array(
'foo' =>
'bar');
2685 $this->assertSame($getParameters,
$GLOBALS[
'HTTP_GET_VARS']);
2693 $GLOBALS[
'HTTP_GET_VARS'] = array();
2696 $this->assertEquals(array(
'oneKey' =>
'oneValue'),
$GLOBALS[
'HTTP_GET_VARS']);
2704 $GLOBALS[
'HTTP_GET_VARS'] = array();
2706 $this->assertEquals(
'oneValue',
$GLOBALS[
'HTTP_GET_VARS'][
'oneKey']);
2714 $GLOBALS[
'HTTP_GET_VARS'] = array();
2717 $this->assertEquals(array(
'foo' =>
'bar',
'oneKey' =>
'oneValue'),
$GLOBALS[
'HTTP_GET_VARS']);
2725 $GLOBALS[
'HTTP_GET_VARS'] = array();
2727 $this->assertEquals(array(
'parentKey' => array(
'childKey' =>
'oneValue')),
$GLOBALS[
'HTTP_GET_VARS']);
2735 $GLOBALS[
'HTTP_GET_VARS'] = array();
2737 $this->assertEquals(array(
'parentKey' => array(
'childKey' =>
'oneValue')),
$GLOBALS[
'HTTP_GET_VARS']);
2745 $GLOBALS[
'HTTP_GET_VARS'] = array();
2747 $this->assertEquals(array(
2748 'parentKey' => array(
2749 'childKey' => array(
'key1' =>
'value1',
'key2' =>
'value2')
2761 unset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_div.php'][
'minifyJavaScript']);
2773 $hookClassName = $this->
getUniqueId(
'tx_coretest');
2774 $minifyHookMock = $this->getMock(
'stdClass', array(
'minify'), array(), $hookClassName);
2775 $functionName =
'&' . $hookClassName .
'->minify';
2776 $GLOBALS[
'T3_VAR'][
'callUserFunction'][$functionName] = array();
2777 $GLOBALS[
'T3_VAR'][
'callUserFunction'][$functionName][
'obj'] = $minifyHookMock;
2778 $GLOBALS[
'T3_VAR'][
'callUserFunction'][$functionName][
'method'] =
'minify';
2779 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_div.php'][
'minifyJavaScript'][] = $functionName;
2780 $minifyHookMock->expects($this->once())->method(
'minify')->will($this->returnCallback(array($this,
'isMinifyJavaScriptHookCalledCallback')));
2793 if ($params[
'script'] !==
'foo') {
2805 $hookClassName = $this->
getUniqueId(
'tx_coretest');
2806 $minifyHookMock = $this->getMock(
'stdClass', array(
'minify'), array(), $hookClassName);
2807 $functionName =
'&' . $hookClassName .
'->minify';
2808 $GLOBALS[
'T3_VAR'][
'callUserFunction'][$functionName] = array();
2809 $GLOBALS[
'T3_VAR'][
'callUserFunction'][$functionName][
'obj'] = $minifyHookMock;
2810 $GLOBALS[
'T3_VAR'][
'callUserFunction'][$functionName][
'method'] =
'minify';
2811 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_div.php'][
'minifyJavaScript'][] = $functionName;
2812 $minifyHookMock->expects($this->any())->method(
'minify')->will($this->returnCallback(array($this,
'minifyJavaScriptErroneousCallback')));
2815 $this->assertSame(
'Error minifying java script: foo', $error);
2825 $t3libDivMock = $this->
getUniqueId(
'GeneralUtility');
2826 eval(
'namespace ' . __NAMESPACE__ .
'; class ' . $t3libDivMock .
' extends \\TYPO3\\CMS\\Core\\Utility\\GeneralUtility {' .
' public static function devLog($errorMessage) {' .
' if (!($errorMessage === \'Error minifying java script: foo\')) {' .
' throw new \\UnexpectedValue(\'broken\');' .
' }' .
' throw new \\RuntimeException();' .
' }' .
'}');
2827 $t3libDivMock = __NAMESPACE__ .
'\\' . $t3libDivMock;
2828 $hookClassName = $this->
getUniqueId(
'tx_coretest');
2829 $minifyHookMock = $this->getMock(
'stdClass', array(
'minify'), array(), $hookClassName);
2830 $functionName =
'&' . $hookClassName .
'->minify';
2831 $GLOBALS[
'T3_VAR'][
'callUserFunction'][$functionName] = array();
2832 $GLOBALS[
'T3_VAR'][
'callUserFunction'][$functionName][
'obj'] = $minifyHookMock;
2833 $GLOBALS[
'T3_VAR'][
'callUserFunction'][$functionName][
'method'] =
'minify';
2834 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_div.php'][
'minifyJavaScript'][] = $functionName;
2835 $minifyHookMock->expects($this->any())->method(
'minify')->will($this->returnCallback(array($this,
'minifyJavaScriptErroneousCallback')));
2836 $this->setExpectedException(
'\\RuntimeException');
2837 $t3libDivMock::minifyJavaScript(
'string to compress');
2848 throw new \RuntimeException(
'foo', 1344888548);
2858 if (TYPO3_OS ==
'WIN') {
2859 $this->markTestSkipped(
'fixPermissionsSetsGroup() tests not available on Windows');
2861 if (!function_exists(
'posix_getegid')) {
2862 $this->markTestSkipped(
'Function posix_getegid() not available, fixPermissionsSetsGroup() tests skipped');
2864 if (posix_getegid() === -1) {
2865 $this->markTestSkipped(
'The fixPermissionsSetsGroup() is not available on Mac OS because posix_getegid() always returns -1 on Mac OS.');
2868 $filename = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_');
2870 $this->testFilesToDelete[] = $filename;
2871 $currentGroupId = posix_getegid();
2873 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'createGroup'] = $currentGroupId;
2876 $this->assertEquals($currentGroupId, filegroup($filename));
2883 if (TYPO3_OS ==
'WIN') {
2884 $this->markTestSkipped(
'fixPermissions() tests not available on Windows');
2887 $filename = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_');
2889 $this->testFilesToDelete[] = $filename;
2890 chmod($filename, 482);
2892 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'fileCreateMask'] =
'0660';
2895 $this->assertTrue($fixPermissionsResult);
2896 $this->assertEquals(
'0660', substr(decoct(fileperms($filename)), 2));
2903 if (TYPO3_OS ==
'WIN') {
2904 $this->markTestSkipped(
'fixPermissions() tests not available on Windows');
2907 $filename = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'.test_');
2909 $this->testFilesToDelete[] = $filename;
2910 chmod($filename, 482);
2912 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'fileCreateMask'] =
'0660';
2915 $this->assertTrue($fixPermissionsResult);
2916 $this->assertEquals(
'0660', substr(decoct(fileperms($filename)), 2));
2923 if (TYPO3_OS ==
'WIN') {
2924 $this->markTestSkipped(
'fixPermissions() tests not available on Windows');
2927 $directory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_');
2929 $this->testFilesToDelete[] = $directory;
2930 chmod($directory, 1551);
2932 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'folderCreateMask'] =
'0770';
2935 $this->assertTrue($fixPermissionsResult);
2936 $this->assertEquals(
'0770', substr(decoct(fileperms($directory)), 1));
2943 if (TYPO3_OS ==
'WIN') {
2944 $this->markTestSkipped(
'fixPermissions() tests not available on Windows');
2947 $directory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_');
2949 $this->testFilesToDelete[] = $directory;
2950 chmod($directory, 1551);
2952 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'folderCreateMask'] =
'0770';
2956 $this->assertTrue($fixPermissionsResult);
2957 $this->assertEquals(
'0770', substr(decoct(fileperms($directory)), 1));
2964 if (TYPO3_OS ==
'WIN') {
2965 $this->markTestSkipped(
'fixPermissions() tests not available on Windows');
2968 $directory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'.test_');
2970 $this->testFilesToDelete[] = $directory;
2971 chmod($directory, 1551);
2973 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'folderCreateMask'] =
'0770';
2977 $this->assertTrue($fixPermissionsResult);
2978 $this->assertEquals(
'0770', substr(decoct(fileperms($directory)), 1));
2985 if (TYPO3_OS ==
'WIN') {
2986 $this->markTestSkipped(
'fixPermissions() tests not available on Windows');
2989 $baseDirectory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_');
2991 $this->testFilesToDelete[] = $baseDirectory;
2992 chmod($baseDirectory, 1751);
2994 chmod($baseDirectory .
'/file', 482);
2996 chmod($baseDirectory .
'/foo', 1751);
2998 chmod($baseDirectory .
'/foo/file', 482);
3000 chmod($baseDirectory .
'/.bar', 1751);
3004 touch($baseDirectory .
'/.bar/.file',
'42');
3005 chmod($baseDirectory .
'/.bar/.file', 482);
3006 touch($baseDirectory .
'/.bar/..file2',
'42');
3007 chmod($baseDirectory .
'/.bar/..file2', 482);
3009 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'fileCreateMask'] =
'0660';
3010 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'folderCreateMask'] =
'0770';
3014 $resultBaseDirectoryPermissions = substr(decoct(fileperms($baseDirectory)), 1);
3015 $resultBaseFilePermissions = substr(decoct(fileperms($baseDirectory .
'/file')), 2);
3016 $resultFooDirectoryPermissions = substr(decoct(fileperms($baseDirectory .
'/foo')), 1);
3017 $resultFooFilePermissions = substr(decoct(fileperms($baseDirectory .
'/foo/file')), 2);
3018 $resultBarDirectoryPermissions = substr(decoct(fileperms($baseDirectory .
'/.bar')), 1);
3019 $resultBarFilePermissions = substr(decoct(fileperms($baseDirectory .
'/.bar/.file')), 2);
3020 $resultBarFile2Permissions = substr(decoct(fileperms($baseDirectory .
'/.bar/..file2')), 2);
3022 $this->assertTrue($fixPermissionsResult);
3023 $this->assertEquals(
'0770', $resultBaseDirectoryPermissions);
3024 $this->assertEquals(
'0660', $resultBaseFilePermissions);
3025 $this->assertEquals(
'0770', $resultFooDirectoryPermissions);
3026 $this->assertEquals(
'0660', $resultFooFilePermissions);
3027 $this->assertEquals(
'0770', $resultBarDirectoryPermissions);
3028 $this->assertEquals(
'0660', $resultBarFilePermissions);
3029 $this->assertEquals(
'0660', $resultBarFile2Permissions);
3036 if (TYPO3_OS ==
'WIN') {
3037 $this->markTestSkipped(
'fixPermissions() tests not available on Windows');
3040 $filename = PATH_site .
'typo3temp/../typo3temp/' . $this->
getUniqueId(
'test_');
3041 $this->testFilesToDelete[] = $filename;
3043 chmod($filename, 482);
3045 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'fileCreateMask'] =
'0660';
3048 $this->assertFalse($fixPermissionsResult);
3055 if (TYPO3_OS ==
'WIN') {
3056 $this->markTestSkipped(
'fixPermissions() tests not available on Windows');
3058 $filename =
'typo3temp/' . $this->
getUniqueId(
'test_');
3060 $this->testFilesToDelete[] = PATH_site . $filename;
3061 chmod(PATH_site . $filename, 482);
3063 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'fileCreateMask'] =
'0660';
3066 $this->assertTrue($fixPermissionsResult);
3067 $this->assertEquals(
'0660', substr(decoct(fileperms(PATH_site . $filename)), 2));
3074 if (TYPO3_OS ==
'WIN') {
3075 $this->markTestSkipped(
'fixPermissions() tests not available on Windows');
3077 $filename = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_');
3079 $this->testFilesToDelete[] = $filename;
3080 chmod($filename, 482);
3081 unset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'fileCreateMask']);
3084 $this->assertTrue($fixPermissionsResult);
3085 $this->assertEquals(
'0644', substr(decoct(fileperms($filename)), 2));
3092 if (TYPO3_OS ==
'WIN') {
3093 $this->markTestSkipped(
'fixPermissions() tests not available on Windows');
3095 $directory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_');
3097 $this->testFilesToDelete[] = $directory;
3098 chmod($directory, 1551);
3099 unset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'folderCreateMask']);
3102 $this->assertTrue($fixPermissionsResult);
3103 $this->assertEquals(
'0755', substr(decoct(fileperms($directory)), 1));
3113 $directory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_');
3115 $this->testFilesToDelete[] = $directory;
3117 $this->assertTrue($mkdirResult);
3118 $this->assertTrue(is_dir($directory));
3125 $directory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'.test_');
3127 $this->testFilesToDelete[] = $directory;
3129 $this->assertTrue($mkdirResult);
3130 $this->assertTrue(is_dir($directory));
3137 $directory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_') .
'/';
3139 $this->testFilesToDelete[] = $directory;
3141 $this->assertTrue($mkdirResult);
3142 $this->assertTrue(is_dir($directory));
3149 if (TYPO3_OS ==
'WIN') {
3150 $this->markTestSkipped(
'mkdirSetsPermissionsOfCreatedDirectory() test not available on Windows');
3152 $directory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_');
3153 $oldUmask = umask(19);
3154 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'folderCreateMask'] =
'0772';
3156 $this->testFilesToDelete[] = $directory;
3158 $resultDirectoryPermissions = substr(decoct(fileperms($directory)), 1);
3160 $this->assertEquals($resultDirectoryPermissions,
'0772');
3167 if (!function_exists(
'posix_getegid')) {
3168 $this->markTestSkipped(
'Function posix_getegid() not available, mkdirSetsGroupOwnershipOfCreatedDirectory() tests skipped');
3170 if (posix_getegid() === -1) {
3171 $this->markTestSkipped(
'The mkdirSetsGroupOwnershipOfCreatedDirectory() is not available on Mac OS because posix_getegid() always returns -1 on Mac OS.');
3174 if ($swapGroup !== FALSE) {
3175 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'createGroup'] = $swapGroup;
3178 $this->testFilesToDelete[] = PATH_site .
'typo3temp/' . $directory;
3180 $resultDirectoryGroupInfo = posix_getgrgid(filegroup(PATH_site .
'typo3temp/' . $directory));
3181 $resultDirectoryGroup = $resultDirectoryGroupInfo[
'name'];
3182 $this->assertEquals($resultDirectoryGroup, $swapGroup);
3197 if (TYPO3_OS ==
'WIN') {
3198 $this->markTestSkipped($methodName .
'() test not available on Windows.');
3201 if (!function_exists(
'posix_getgroups')) {
3202 $this->markTestSkipped(
'Function posix_getgroups() not available, ' . $methodName .
'() tests skipped');
3204 $groups = posix_getgroups();
3205 if (count($groups) <= 1) {
3206 $this->markTestSkipped($methodName .
'() test cannot be done when the web server user is only member of 1 group.');
3209 $uname = strtolower(php_uname());
3211 if (strpos($uname,
'darwin') !== FALSE) {
3215 $groupInfo = posix_getgrgid($groups[$groupOffset]);
3216 return $groupInfo[
'name'];
3226 $directory =
'typo3temp/' . $this->
getUniqueId(
'test_');
3228 $this->testFilesToDelete[] = PATH_site . $directory;
3229 $this->assertTrue(is_dir(PATH_site . $directory));
3236 $directory =
'typo3temp/' . $this->
getUniqueId(
'test_');
3237 $subDirectory = $directory .
'/foo';
3239 $this->testFilesToDelete[] = PATH_site . $directory;
3240 $this->assertTrue(is_dir(PATH_site . $subDirectory));
3247 if (TYPO3_OS ==
'WIN') {
3248 $this->markTestSkipped(
'mkdirDeepFixesPermissionsOfCreatedDirectory() test not available on Windows.');
3250 $directory = $this->
getUniqueId(
'mkdirdeeptest_');
3251 $oldUmask = umask(19);
3252 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'folderCreateMask'] =
'0777';
3254 $this->testFilesToDelete[] = PATH_site .
'typo3temp/' . $directory;
3257 $this->assertEquals(
'777', substr(decoct(fileperms(PATH_site .
'typo3temp/' . $directory)), -3, 3));
3264 if (TYPO3_OS ==
'WIN') {
3265 $this->markTestSkipped(
'mkdirDeepFixesPermissionsOnNewParentDirectory() test not available on Windows.');
3267 $directory = $this->
getUniqueId(
'mkdirdeeptest_');
3268 $subDirectory = $directory .
'/bar';
3269 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'folderCreateMask'] =
'0777';
3270 $oldUmask = umask(19);
3272 $this->testFilesToDelete[] = PATH_site .
'typo3temp/' . $directory;
3275 $this->assertEquals(
'777', substr(decoct(fileperms(PATH_site .
'typo3temp/' . $directory)), -3, 3));
3282 if (TYPO3_OS ==
'WIN') {
3283 $this->markTestSkipped(
'mkdirDeepDoesNotChangePermissionsOfExistingSubDirectories() test not available on Windows.');
3285 $baseDirectory = PATH_site .
'typo3temp/';
3286 $existingDirectory = $this->
getUniqueId(
'test_existing_') .
'/';
3287 $newSubDirectory = $this->
getUniqueId(
'test_new_');
3288 @mkdir(($baseDirectory . $existingDirectory));
3289 $this->testFilesToDelete[] = $baseDirectory . $existingDirectory;
3290 chmod($baseDirectory . $existingDirectory, 482);
3292 $this->assertEquals(
'0742', substr(decoct(fileperms($baseDirectory . $existingDirectory)), 2));
3300 if ($swapGroup !== FALSE) {
3301 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'createGroup'] = $swapGroup;
3302 $directory = $this->
getUniqueId(
'mkdirdeeptest_');
3304 $this->testFilesToDelete[] = PATH_site .
'typo3temp/' . $directory;
3306 $resultDirectoryGroupInfo = posix_getgrgid(filegroup(PATH_site .
'typo3temp/' . $directory));
3307 $resultDirectoryGroup = $resultDirectoryGroupInfo[
'name'];
3308 $this->assertEquals($resultDirectoryGroup, $swapGroup);
3317 if ($swapGroup !== FALSE) {
3318 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'createGroup'] = $swapGroup;
3319 $directory = $this->
getUniqueId(
'mkdirdeeptest_');
3320 $subDirectory = $directory .
'/bar';
3322 $this->testFilesToDelete[] = PATH_site .
'typo3temp/' . $directory;
3324 $resultDirectoryGroupInfo = posix_getgrgid(filegroup(PATH_site .
'typo3temp/' . $directory));
3325 $resultDirectoryGroup = $resultDirectoryGroupInfo[
'name'];
3326 $this->assertEquals($resultDirectoryGroup, $swapGroup);
3335 if ($swapGroup !== FALSE) {
3336 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'createGroup'] = $swapGroup;
3337 $directory = $this->
getUniqueId(
'mkdirdeeptest_');
3338 $subDirectory = $directory .
'/bar';
3340 $this->testFilesToDelete[] = PATH_site .
'typo3temp/' . $directory;
3342 $resultDirectoryGroupInfo = posix_getgrgid(filegroup(PATH_site .
'typo3temp/' . $subDirectory));
3343 $resultDirectoryGroup = $resultDirectoryGroupInfo[
'name'];
3344 $this->assertEquals($resultDirectoryGroup, $swapGroup);
3352 if (!class_exists(
'org\\bovigo\\vfs\\vfsStreamWrapper')) {
3353 $this->markTestSkipped(
'mkdirDeepCreatesDirectoryInVfsStream() test not available with this phpunit version.');
3355 vfsStreamWrapper::register();
3357 vfsStreamWrapper::setRoot(
new vfsStreamDirectory($baseDirectory));
3359 $this->assertTrue(is_dir(
'vfs://' . $baseDirectory .
'/sub'));
3394 $file = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'file_');
3397 $this->assertFalse(file_exists($file));
3404 $file = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'file_');
3413 $file = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'file_');
3421 $directory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'directory_');
3424 $this->assertFalse(file_exists($directory));
3431 $directory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'directory_') .
'/';
3434 $this->assertFalse(file_exists($directory));
3441 $directory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'directory_') .
'/';
3444 touch($directory . $file);
3445 $this->testFilesToDelete[] = $directory;
3447 $this->assertTrue(file_exists($directory));
3448 $this->assertTrue(file_exists($directory . $file));
3449 $this->assertFalse($return);
3456 $directory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'directory_') .
'/';
3458 mkdir($directory .
'sub/');
3459 touch($directory .
'sub/file');
3461 $this->assertFalse(file_exists($directory));
3462 $this->assertTrue($return);
3469 if (TYPO3_OS ===
'WIN') {
3470 $this->markTestSkipped(
'Test not available on Windows OS.');
3472 $existingDirectory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'notExists_') .
'/';
3473 mkdir($existingDirectory);
3474 $this->testFilesToDelete[] = $existingDirectory;
3475 $symlinkName = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'link_');
3476 symlink($existingDirectory, $symlinkName);
3478 $this->assertFalse(is_link($symlinkName));
3485 if (TYPO3_OS ===
'WIN') {
3486 $this->markTestSkipped(
'Test not available on Windows OS.');
3488 $notExistingDirectory = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'notExists_') .
'/';
3489 $symlinkName = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'link_');
3490 symlink($notExistingDirectory, $symlinkName);
3492 $this->assertFalse(is_link($symlinkName));
3499 if (TYPO3_OS ===
'WIN') {
3500 $this->markTestSkipped(
'Test not available on Windows OS.');
3502 $notExistingFile = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'notExists_');
3503 $symlinkName = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'link_');
3504 symlink($notExistingFile, $symlinkName);
3506 $this->assertFalse(is_link($symlinkName));
3519 if (!class_exists(
'org\\bovigo\\vfs\\vfsStreamWrapper')) {
3520 $this->markTestSkipped(
'getFilesInDirCreateTestDirectory() helper method not available without vfsStream.');
3523 'subDirectory' => array(
3524 'test.php' =>
'butter',
3525 'other.php' =>
'milk',
3526 'stuff.csv' =>
'honey',
3528 'excludeMe.txt' =>
'cocoa nibs',
3529 'testB.txt' =>
'olive oil',
3530 'testA.txt' =>
'eggs',
3531 'testC.txt' =>
'carrots',
3532 'test.js' =>
'oranges',
3533 'test.css' =>
'apples',
3534 '.secret.txt' =>
'sammon',
3536 vfsStream::setup(
'test', NULL, $structure);
3537 $vfsUrl = vfsStream::url(
'test');
3539 if (version_compare(PHP_VERSION,
'5.4.0',
'>=')) {
3541 foreach ($structure as $structureLevel1Key => $structureLevel1Content) {
3543 if (is_array($structureLevel1Content)) {
3544 foreach ($structureLevel1Content as $structureLevel2Key => $structureLevel2Content) {
3545 touch($vfsUrl .
'/' . $structureLevel1Key .
'/' . $structureLevel2Key, $newMtime);
3548 touch($vfsUrl .
'/' . $structureLevel1Key, $newMtime);
3561 $this->assertContains(
'testA.txt', $files);
3570 $this->assertContains(
'.secret.txt', $files);
3579 $this->assertContains(
'testA.txt', $files);
3580 $this->assertContains(
'test.js', $files);
3589 $this->assertContains(
'testA.txt', $files);
3590 $this->assertContains(
'test.js', $files);
3591 $this->assertNotContains(
'test.css', $files);
3600 $this->assertContains(
'test.js', $files);
3601 $this->assertNotContains(
'excludeMe.txt', $files);
3609 $this->assertContains(
3610 $vfsStreamUrl .
'/testA.txt',
3622 array(
'.secret.txt',
'excludeMe.txt',
'test.css',
'test.js',
'testA.txt',
'testB.txt',
'testC.txt')
3630 if (version_compare(PHP_VERSION,
'5.4.0',
'<')) {
3631 $this->markTestSkipped(
'touch() does not work with vfsStream in PHP 5.3 and below.');
3636 $iterator = new \DirectoryIterator($vfsStreamUrl);
3637 foreach ($iterator as $fileinfo) {
3638 if ($fileinfo->isFile()) {
3639 $files[$fileinfo->getFilename()] = $fileinfo->getMTime();
3654 $this->assertArrayHasKey(
3655 md5($vfsStreamUrl .
'/testA.txt'),
3665 $this->assertNotContains(
3680 $this->assertNotContains(
'..', $files);
3681 $this->assertNotContains(
'.', $files);
3697 array(
'aa',
'bb',
'"cc"',
'"dd"'),
3698 array(
'aa',
'bb',
'cc',
'dd')
3702 array(
'aa',
'bb',
'"cc dd"'),
3703 array(
'aa',
'bb',
'cc dd')
3706 '\'aa bb\
' "cc dd"',
3707 array(
'\'aa bb\
'',
'"cc dd"'),
3708 array(
'aa bb',
'cc dd')
3711 '\'aa bb\
' cc "dd"',
3712 array(
'\'aa bb\
'',
'cc',
'"dd"'),
3713 array(
'aa bb',
'cc',
'dd')
3717 '/opt/local/bin/gm.exe convert +profile \'*\' -geometry 170x136! -negate "C:/Users/Someuser.Domain/Documents/Htdocs/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]" "C:/Users/Someuser.Domain/Documents/Htdocs/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif"',
3719 '/opt/local/bin/gm.exe',
3726 '"C:/Users/Someuser.Domain/Documents/Htdocs/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]"',
3727 '"C:/Users/Someuser.Domain/Documents/Htdocs/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif"' 3730 '/opt/local/bin/gm.exe',
3737 'C:/Users/Someuser.Domain/Documents/Htdocs/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]',
3738 'C:/Users/Someuser.Domain/Documents/Htdocs/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif' 3742 'C:/opt/local/bin/gm.exe convert +profile \'*\' -geometry 170x136! -negate "C:/Program Files/Apache2/htdocs/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]" "C:/Program Files/Apache2/htdocs/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif"',
3744 'C:/opt/local/bin/gm.exe',
3751 '"C:/Program Files/Apache2/htdocs/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]"',
3752 '"C:/Program Files/Apache2/htdocs/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif"' 3755 'C:/opt/local/bin/gm.exe',
3762 'C:/Program Files/Apache2/htdocs/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]',
3763 'C:/Program Files/Apache2/htdocs/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif' 3767 '/usr/bin/gm convert +profile \'*\' -geometry 170x136! -negate "/Shared Items/Data/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]" "/Shared Items/Data/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif"',
3776 '"/Shared Items/Data/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]"',
3777 '"/Shared Items/Data/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif"' 3787 '/Shared Items/Data/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]',
3788 '/Shared Items/Data/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif' 3792 '/usr/bin/gm convert +profile \'*\' -geometry 170x136! -negate "/Network/Servers/server01.internal/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]" "/Network/Servers/server01.internal/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif"',
3801 '"/Network/Servers/server01.internal/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]"',
3802 '"/Network/Servers/server01.internal/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif"' 3812 '/Network/Servers/server01.internal/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]',
3813 '/Network/Servers/server01.internal/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif' 3817 '/usr/bin/gm convert +profile \'*\' -geometry 170x136! -negate \'/Network/Servers/server01.internal/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]\' \'/Network/Servers/server01.internal/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif\'',
3826 '\'/Network/Servers/server01.internal/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]\
'',
3827 '\'/Network/Servers/server01.internal/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif\
'' 3837 '/Network/Servers/server01.internal/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif[0]',
3838 '/Network/Servers/server01.internal/Projects/typo3temp/temp/61401f5c16c63d58e1d92e8a2449f2fe_maskNT.gif' 3853 $this->assertEquals($expectedQuoted, $actualQuoted,
'The exploded command does not match the expected');
3854 $this->assertEquals($expectedUnquoted, $acutalUnquoted,
'The exploded and unquoted command does not match the expected');
3864 $directoryName = $this->
getUniqueId(
'test_') .
'.com';
3865 $directoryPath = PATH_site .
'typo3temp/';
3866 $directory = $directoryPath . $directoryName;
3867 mkdir($directory, octdec(
$GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'folderCreateMask']));
3869 $directoryCreated = is_dir($directory);
3871 $this->assertTrue($directoryCreated);
3872 $this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $fileInfo);
3873 $this->assertEquals($directoryPath, $fileInfo[
'path']);
3874 $this->assertEquals($directoryName, $fileInfo[
'file']);
3875 $this->assertEquals($directoryName, $fileInfo[
'filebody']);
3876 $this->assertEquals(
'', $fileInfo[
'fileext']);
3877 $this->assertArrayNotHasKey(
'realFileext', $fileInfo);
3884 $testFile =
'fileadmin/media/someFile.png';
3886 $this->assertInternalType(\PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $fileInfo);
3887 $this->assertEquals(
'fileadmin/media/', $fileInfo[
'path']);
3888 $this->assertEquals(
'someFile.png', $fileInfo[
'file']);
3889 $this->assertEquals(
'someFile', $fileInfo[
'filebody']);
3890 $this->assertEquals(
'png', $fileInfo[
'fileext']);
3902 'absolute path with multiple part and file' => array(
'/dir1/dir2/script.php',
'/dir1/dir2'),
3903 'absolute path with one part' => array(
'/dir1/',
'/dir1'),
3904 'absolute path to file without extension' => array(
'/dir1/something',
'/dir1'),
3905 'relative path with one part and file' => array(
'dir1/script.php',
'dir1'),
3906 'relative one-character path with one part and file' => array(
'd/script.php',
'd'),
3907 'absolute zero-part path with file' => array(
'/script.php',
''),
3908 'empty string' => array(
'',
'')
3931 'empty path' => array(
'',
''),
3932 'this directory' => array(
'./',
'./'),
3933 'relative directory without ..' => array(
'dir1/dir2/dir3/',
'dir1/dir2/dir3/'),
3934 'relative path without ..' => array(
'dir1/dir2/script.php',
'dir1/dir2/script.php'),
3935 'absolute directory without ..' => array(
'/dir1/dir2/dir3/',
'/dir1/dir2/dir3/'),
3936 'absolute path without ..' => array(
'/dir1/dir2/script.php',
'/dir1/dir2/script.php'),
3937 'only one directory upwards without trailing slash' => array(
'..',
'..'),
3938 'only one directory upwards with trailing slash' => array(
'../',
'../'),
3939 'one level with trailing ..' => array(
'dir1/..',
''),
3940 'one level with trailing ../' => array(
'dir1/../',
''),
3941 'two levels with trailing ..' => array(
'dir1/dir2/..',
'dir1'),
3942 'two levels with trailing ../' => array(
'dir1/dir2/../',
'dir1/'),
3943 'leading ../ without trailing /' => array(
'../dir1',
'../dir1'),
3944 'leading ../ with trailing /' => array(
'../dir1/',
'../dir1/'),
3945 'leading ../ and inside path' => array(
'../dir1/dir2/../dir3/',
'../dir1/dir3/'),
3946 'one times ../ in relative directory' => array(
'dir1/../dir2/',
'dir2/'),
3947 'one times ../ in absolute directory' => array(
'/dir1/../dir2/',
'/dir2/'),
3948 'one times ../ in relative path' => array(
'dir1/../dir2/script.php',
'dir2/script.php'),
3949 'one times ../ in absolute path' => array(
'/dir1/../dir2/script.php',
'/dir2/script.php'),
3950 'consecutive ../' => array(
'dir1/dir2/dir3/../../../dir4',
'dir4'),
3951 'distrubuted ../ with trailing /' => array(
'dir1/../dir2/dir3/../',
'dir2/'),
3952 'distributed ../ without trailing /' => array(
'dir1/../dir2/dir3/..',
'dir2'),
3953 'multiple distributed and consecutive ../ together' => array(
'dir1/dir2/dir3/dir4/../../dir5/dir6/dir7/../dir8/',
'dir1/dir2/dir5/dir6/dir8/'),
3954 'dirname with leading ..' => array(
'dir1/..dir2/dir3/',
'dir1/..dir2/dir3/'),
3955 'dirname with trailing ..' => array(
'dir1/dir2../dir3/',
'dir1/dir2../dir3/'),
3956 'more times upwards than downwards in directory' => array(
'dir1/../../',
'../'),
3957 'more times upwards than downwards in path' => array(
'dir1/../../script.php',
'../script.php')
4018 $className = get_class($this->getMock(
'foo'));
4027 if (!class_exists($className, FALSE)) {
4028 eval(
'class ' . $className .
' {' .
' public $constructorParameter1;' .
' public $constructorParameter2;' .
' public function __construct($parameter1, $parameter2) {' .
' $this->constructorParameter1 = $parameter1;' .
' $this->constructorParameter2 = $parameter2;' .
' }' .
'}');
4031 $this->assertEquals(
'one parameter', $instance->constructorParameter1,
'The first constructor parameter has not been set.');
4032 $this->assertEquals(
'another parameter', $instance->constructorParameter2,
'The second constructor parameter has not been set.');
4039 $classNameOriginal = get_class($this->getMock($this->
getUniqueId(
'foo')));
4040 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'Objects'][$classNameOriginal] = array(
'className' => $classNameOriginal .
'Other');
4041 eval(
'class ' . $classNameOriginal .
'Other extends ' . $classNameOriginal .
' {}');
4049 $classNameOriginal = get_class($this->getMock($this->
getUniqueId(
'foo')));
4050 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'Objects'][$classNameOriginal] = array(
'className' => $classNameOriginal .
'Other');
4051 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'Objects'][$classNameOriginal .
'Other'] = array(
'className' => $classNameOriginal .
'OtherOther');
4052 eval(
'class ' . $classNameOriginal .
'Other extends ' . $classNameOriginal .
' {}');
4053 eval(
'class ' . $classNameOriginal .
'OtherOther extends ' . $classNameOriginal .
'Other {}');
4061 $className = get_class($this->getMock(
'foo'));
4069 $className = get_class($this->getMock(
'TYPO3\\CMS\\Core\\SingletonInterface'));
4077 $className = get_class($this->getMock(
'TYPO3\\CMS\\Core\\SingletonInterface'));
4088 $instance = $this->getMock(
'TYPO3\\CMS\\Core\\SingletonInterface');
4097 $instance = $this->getMock(
'TYPO3\\CMS\\Core\\SingletonInterface', array(
'foo'));
4098 $singletonClassName = get_class($this->getMock(
'TYPO3\\CMS\\Core\\SingletonInterface'));
4106 $instance = $this->getMock(
'TYPO3\\CMS\\Core\\SingletonInterface');
4107 $singletonClassName = get_class($instance);
4116 $instance1 = $this->getMock(
'TYPO3\\CMS\\Core\\SingletonInterface');
4117 $singletonClassName = get_class($instance1);
4118 $instance2 =
new $singletonClassName();
4128 $instance = $this->getMock(
'TYPO3\\CMS\\Core\\SingletonInterface');
4129 $instanceClassName = get_class($instance);
4132 $this->assertArrayHasKey($instanceClassName, $registeredSingletonInstances);
4133 $this->assertSame($registeredSingletonInstances[$instanceClassName], $instance);
4140 $instance = $this->getMock(
'TYPO3\\CMS\\Core\\SingletonInterface');
4141 $instanceClassName = get_class($instance);
4145 $this->assertArrayNotHasKey($instanceClassName, $registeredSingletonInstances);
4152 $instance = $this->getMock(
'TYPO3\\CMS\\Core\\SingletonInterface');
4153 $instanceClassName = get_class($instance);
4155 array($instanceClassName => $instance)
4158 $this->assertArrayHasKey($instanceClassName, $registeredSingletonInstances);
4159 $this->assertSame($registeredSingletonInstances[$instanceClassName], $instance);
4167 $instance = $this->getMock(
'foo');
4176 $instance = $this->getMock(
'foo', array(
'bar'));
4177 $singletonClassName = get_class($this->getMock(
'foo'));
4186 $instance = $this->getMock(
'TYPO3\\CMS\\Core\\SingletonInterface');
4194 $instance = $this->getMock(
'foo');
4195 $className = get_class($instance);
4204 $instance = $this->getMock(
'foo');
4205 $className = get_class($instance);
4214 $instance1 = $this->getMock(
'foo');
4215 $className = get_class($instance1);
4217 $instance2 =
new $className();
4219 $this->assertSame($instance1, Utility\
GeneralUtility::makeInstance($className),
'The first returned instance does not match the first added instance.');
4220 $this->assertSame($instance2, Utility\
GeneralUtility::makeInstance($className),
'The second returned instance does not match the second added instance.');
4227 $instance = $this->getMock(
'foo');
4228 $className = get_class($instance);
4241 'double slash in path' => array(
'path//path'),
4242 'backslash in path' => array(
'path\\path'),
4243 'directory up in path' => array(
'path/../path'),
4244 'directory up at the beginning' => array(
'../path'),
4245 'NUL character in path' => array(
'path' . chr(0) .
'path'),
4246 'BS character in path' => array(
'path' . chr(8) .
'path'),
4247 'invalid UTF-8-sequence' => array(
"\xc0" .
'path/path'),
4248 'Could be overlong NUL in some UTF-8 implementations, invalid in RFC3629' => array(
"\xc0\x80" .
'path/path'),
4252 $utf8Characters =
'Ссылка/';
4253 foreach ($data as $key => $value) {
4254 $data[$key .
' with UTF-8 characters prepended'] = array($utf8Characters . $value[0]);
4255 $data[$key .
' with UTF-8 characters appended'] = array($value[0] . $utf8Characters);
4259 foreach ($data as $key => $value) {
4260 $data[$key .
' encoded with UTF-16'] = array(mb_convert_encoding($value[0],
'UTF-16'));
4264 $data[
'Valid path but UTF-16 encoded'] = array(mb_convert_encoding(
'fileadmin/foo.txt',
'UTF-16'));
4265 $data[
'UTF-8 characters with UTF-16 encoded'] = array(mb_convert_encoding(
'fileadmin/templates/Ссылка (fce).xml',
'UTF-16'));
4287 'normal ascii path' => array(
'fileadmin/templates/myfile..xml'),
4288 'special character' => array(
'fileadmin/templates/Ссылка (fce).xml')
4310 'Nul character in file' => array(
'image' . chr(0) .
'.gif'),
4311 'Nul character in file with .php' => array(
'image.php' . chr(0) .
'.gif'),
4312 'Regular .php file' => array(
'file.php'),
4313 'Regular .php5 file' => array(
'file.php5'),
4314 'Regular .php3 file' => array(
'file.php3'),
4315 'Regular .phpsh file' => array(
'file.phpsh'),
4316 'Regular .phtml file' => array(
'file.phtml'),
4317 'PHP file in the middle' => array(
'file.php.txt'),
4318 '.htaccess file' => array(
'.htaccess'),
4342 $sourceDirectory =
'typo3temp/' . $this->
getUniqueId(
'test_') .
'/';
4343 $absoluteSourceDirectory = PATH_site . $sourceDirectory;
4344 $this->testFilesToDelete[] = $absoluteSourceDirectory;
4347 $targetDirectory =
'typo3temp/' . $this->
getUniqueId(
'test_') .
'/';
4348 $absoluteTargetDirectory = PATH_site . $targetDirectory;
4349 $this->testFilesToDelete[] = $absoluteTargetDirectory;
4358 $this->assertFileExists($absoluteTargetDirectory .
'file');
4359 $this->assertFileExists($absoluteTargetDirectory .
'foo/file');
4366 $sourceDirectory =
'typo3temp/' . $this->
getUniqueId(
'test_') .
'/';
4367 $absoluteSourceDirectory = PATH_site . $sourceDirectory;
4368 $this->testFilesToDelete[] = $absoluteSourceDirectory;
4371 $targetDirectory =
'typo3temp/' . $this->
getUniqueId(
'test_') .
'/';
4372 $absoluteTargetDirectory = PATH_site . $targetDirectory;
4373 $this->testFilesToDelete[] = $absoluteTargetDirectory;
4382 $this->assertFileExists($absoluteTargetDirectory .
'file');
4383 $this->assertFileExists($absoluteTargetDirectory .
'foo/file');
4393 if (TYPO3_OS ==
'WIN') {
4394 $this->markTestSkipped(
'syslogFixesPermissionsOnFileIfUsingFileLogging() test not available on Windows.');
4397 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'systemLogLevel'] = 0;
4398 $GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_div.php'][
'systemLogInit'] = TRUE;
4399 unset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SC_OPTIONS'][
't3lib/class.t3lib_div.php'][
'systemLog']);
4400 $testLogFilename = PATH_site .
'typo3temp/' . $this->
getUniqueId(
'test_') .
'.txt';
4401 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'systemLog'] =
'file,' . $testLogFilename .
',0';
4402 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'fileCreateMask'] =
'0777';
4405 $this->testFilesToDelete[] = $testLogFilename;
4407 $this->assertEquals(
'0777', substr(decoct(fileperms($testLogFilename)), 2));
4414 if (TYPO3_OS ==
'WIN') {
4415 $this->markTestSkipped(
'deprecationLogFixesPermissionsOnLogFile() test not available on Windows.');
4420 $GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'enableDeprecationLog'] = TRUE;
4421 $GLOBALS[
'TYPO3_CONF_VARS'][
'BE'][
'fileCreateMask'] =
'0777';
4424 $this->testFilesToDelete[] = $deprecationLogFilename;
4426 $resultFilePermissions = substr(decoct(fileperms($deprecationLogFilename)), 2);
4427 $this->assertEquals(
'0777', $resultFilePermissions);
4439 $inputData = array(
'foo' =>
'bar');
4453 $inputData = array(
'foo' =>
'bar');
4465 'Function is not prefixed' => array(
't3lib_divTest->calledUserFunction'),
4466 'Class doesn\'t exists' => array(
't3lib_divTest21345->user_calledUserFunction'),
4467 'No method name' => array(
't3lib_divTest'),
4468 'No class name' => array(
'->user_calledUserFunction'),
4469 'No function name' => array(
'')
4481 $functionName = create_function(
'',
'return "Worked fine";');
4482 $inputData = array(
'foo' =>
'bar');
4484 $this->assertEquals(
'Worked fine',
$result);
4491 $inputData = array(
'foo' =>
'bar');
4493 $this->assertEquals(
'Worked fine',
$result);
4500 return 'Worked fine';
4507 $inputData = array(
'foo' =>
'bar');
4509 $this->assertEquals(
'Worked fine',
$result);
4516 $inputData = array(
'called' => array());
4519 $this->assertEquals(1,
sizeof($inputData[
'called']));
4530 $params[
'called'][spl_object_hash($this)]++;
4537 $inputData = array(
'foo' =>
'bar');
4538 $closure =
function (
$parameters, $reference) use($inputData) {
4539 $reference->assertEquals($inputData,
$parameters,
'Passed data doesn\'t match expected output');
4540 return 'Worked fine';
4586 for ($i = 0; $i < $numberOfTests; $i++) {
4590 $this->assertEquals($results, array_unique($results));
4607 'second' =>
'second',
4614 'second' =>
'overrule',
4615 'third' =>
'__UNSET',
4616 'fourth' =>
'overrile' 4618 'fifth' =>
'__UNSET' 4622 'second' =>
'overrule',
4623 'fourth' =>
'overrile' 4627 $this->assertEquals($expected,
$result);
4637 $urlMatch =
'http://example.com/index.php\\?RDCT=[0-9a-z]{20}';
4639 array(
'http://only-url.com',
'|^' . $urlMatch .
'$|'),
4640 array(
'https://only-secure-url.com',
'|^' . $urlMatch .
'$|'),
4641 array(
'A http://url in the sentence.',
'|^A ' . $urlMatch .
' in the sentence\\.$|'),
4642 array(
'URL in round brackets (http://www.example.com) in the sentence.',
'|^URL in round brackets \\(' . $urlMatch .
'\\) in the sentence.$|'),
4643 array(
'URL in square brackets [http://www.example.com/a/b.php?c[d]=e] in the sentence.',
'|^URL in square brackets \\[' . $urlMatch .
'\\] in the sentence.$|'),
4644 array(
'URL in square brackets at the end of the sentence [http://www.example.com/a/b.php?c[d]=e].',
'|^URL in square brackets at the end of the sentence \\[' . $urlMatch .
'].$|'),
4645 array(
'Square brackets in the http://www.url.com?tt_news[uid]=1',
'|^Square brackets in the ' . $urlMatch .
'$|'),
4646 array(
'URL with http://dot.com.',
'|^URL with ' . $urlMatch .
'.$|'),
4647 array(
'URL in <a href="http://www.example.com/">a tag</a>',
'|^URL in <a href="' . $urlMatch .
'">a tag</a\\>$|'),
4648 array(
'URL in HTML <b>http://www.example.com</b><br />',
'|^URL in HTML <b>' . $urlMatch .
'</b><br />$|'),
4649 array(
'URL with http://username@example.com/',
'|^URL with ' . $urlMatch .
'$|'),
4650 array(
'Secret in URL http://username:secret@example.com',
'|^Secret in URL ' . $urlMatch .
'$|'),
4651 array(
'URL in quotation marks "http://example.com"',
'|^URL in quotation marks "' . $urlMatch .
'"$|'),
4652 array(
'URL with umlauts http://müller.de',
'|^URL with umlauts ' . $urlMatch .
'$|'),
4654 text with a http://url.com',
'|^Multiline 4655 text with a ' . $urlMatch .
'$|s'),
4656 array(
'http://www.shout.com!',
'|^' . $urlMatch .
'!$|'),
4657 array(
'And with two URLs http://www.two.com/abc http://urls.com/abc?x=1&y=2',
'|^And with two URLs ' . $urlMatch .
' ' . $urlMatch .
'$|')
4668 $GLOBALS[
'TYPO3_DB'] = $this->getMock(
'TYPO3\\CMS\\Core\\Database\\DatabaseConnection', array(), array(),
'', FALSE);
4677 'Extracts redirect URL from Location header' => array(
"HTTP/1.0 302 Redirect\r\nServer: Apache\r\nLocation: http://example.com/\r\nX-pad: avoid browser bug\r\n\r\nLocation: test\r\n",
'http://example.com/'),
4678 'Returns empty string if no Location is found in header' => array(
"HTTP/1.0 302 Redirect\r\nServer: Apache\r\nX-pad: avoid browser bug\r\n\r\nLocation: test\r\n",
''),
4697 'Simple content' => array(
"HTTP/1.0 302 Redirect\r\nServer: Apache\r\nX-pad: avoid browser bug\r\n\r\nHello, world!",
'Hello, world!'),
4698 'Content with multiple returns' => array(
"HTTP/1.0 302 Redirect\r\nServer: Apache\r\nX-pad: avoid browser bug\r\n\r\nHello, world!\r\n\r\nAnother hello here!",
"Hello, world!\r\n\r\nAnother hello here!"),
4726 $this->assertEquals(
'<phparray> 4727 <el type="array"></el> 4728 </phparray>', $output);
compileSelectedGetVarsFromArrayUsesGetPostDataFallback()
resolveBackPathWithDataProvider($input, $expectedValue)
makeInstancePassesParametersToConstructor()
strtouppperDataProvider()
callUserFunctionCanPersistObjectsBetweenCalls()
canRetrieveGlobalInputsThroughGet($key, $get, $expected)
unlink_tempfileReturnsNullIfFileDoesNotExist()
substUrlsInPlainText($input, $expected)
static stripSlashesOnArray(array &$theArray)
static cmpIPv6($baseIP, $list)
keepItemsInArrayWorksWithOneArgument($search, $array, $expected)
getRedirectUrlReturnsRedirectUrlFromHttpResponse($httpResponse, $expected)
static getSingletonInstances()
minifyJavaScriptReturnsInputStringIfNoHookIsRegistered()
static minifyJavaScript($script, &$error='')
arrayDiffAssocRecursiveHandlesOneDimensionalArrays()
validPathStrInvalidCharactersDataProvider()
underscoredToLowerCamelCaseDataProvider()
compileSelectedGetVarsFromArrayFiltersIncomingData()
stripSlashesOnArrayStripsSlashesRecursive()
makeInstanceInstanciatesConfiguredImplementation()
setSingletonInstanceCalledTwoTimesMakesMakeInstanceReturnLastSetInstance()
lcFirst($expected, $inputString)
static uniqueList($in_list, $secondParameter=NULL)
callUserFunctionCanCallMethod()
user_calledUserFunctionCountCallers(&$params)
splitFileRefReturnsFileTypeForFilesWithoutPathSite()
fixPermissionsSetsGroup()
implodeArrayForUrlBuildsValidParameterString($name, $input, $expected)
sanitizeLocalUrlValidUrlsDataProvider()
getSingletonInstancesContainsPreviouslySetSingletonInstance()
static setSingletonInstance($className, \TYPO3\CMS\Core\SingletonInterface $instance)
tempnamReturnsPathStartingWithGivenPrefix()
static unlink_tempfile($uploadedTempFileName)
static cmpIPv6DataProviderMatching()
static substUrlsInPlainText($message, $urlmode='76', $index_script_url='')
rmdirReturnFalseIfNoFileWasRemoved()
mkdirDeepThrowsExceptionIfDeepDirectoryIsNotOfTypeString()
static explodeUrl2Array($string, $multidim=FALSE)
static mkdir_deep($directory, $deepDirectory='')
isFirstPartOfStrReturnsTrueForMatchingFirstPartDataProvider()
getDirsReturnsArrayOfDirectoriesFromGivenDirectory()
uniqueListUnifiesCommaSeparatedList($initialList, $unifiedList)
underscoredToUpperCamelCaseDataProvider()
mkdirDeepDoesNotChangePermissionsOfExistingSubDirectories()
static addInstance($className, $instance)
validEmailValidDataProvider()
checkRemoveArrayEntryByValueRemovesEntryWithEmptyString()
arrayMergeRecursiveOverruleDoesConsiderUnsetValues()
gpMergedWillMergeArraysFromGetAndPost($get, $post, $expected)
static $isAllowedHostHeaderValueCallCount
static cmpIPv4($baseIP, $list)
hmacReturnsHashOfProperLength()
fixPermissionsCorrectlySetsPermissionsRecursive()
static getRedirectUrlFromHttpHeaders($content)
keepItemsInArrayWorksWithOneArgumentDataProvider()
addInstanceCalledTwoTimesMakesMakeInstanceReturnBothInstancesInAddingOrder()
quoteJsValueDataProvider()
generateRandomBytesReturnsExpectedAmountOfBytes($numberOfBytes)
inListForItemContainedReturnsTrueDataProvider()
resolveBackPathDataProvider()
static validIpDataProvider()
static isAllowedHostHeaderValue($hostHeaderValue)
setSingletonInstanceMakesMakeInstanceReturnThatInstance()
validURLReturnsFalseForInvalidRessoure($url)
explodeUrl2ArrayDataProvider()
implodeArrayForUrlCanUrlEncodeKeyNames()
uniqueListUnifiesCommaSeparatedListDataProvider()
checkTrimExplodeKeepsRemainingResultsWithoutEmptyItemsAfterReachingLimitWithPositiveParameter()
canRetrieveValueWithGP($key, $get, $post, $expected)
unlink_tempfileReturnsNullIfFileIsNowWithinTypo3temp()
resetSingletonInstancesSetsGivenInstance()
rmdirDoesNotRemoveDirectoryWithFilesAndReturnsFalseIfRecursiveDeletionIsOff()
getFilesInDirDoesNotFindDotfiles()
implodeArrayForUrlDataProvider()
static isFirstPartOfStr($str, $partStr)
static slashJS($string, $extended=FALSE, $char='\'')
validEmailReturnsTrueForValidMailAddress($address)
deHSCentitiesReturnsDecodedStringDataProvider()
static validPathStr($theFile)
getFilesInDirFindsHiddenFile()
isFirstPartOfStrReturnsTrueForMatchingFirstPart($string, $part)
checkTrimExplodeReturnsExactResultsWithoutReachingLimitWithPositiveParameter()
revExplodeCorrectlyExplodesStringForGivenPartsCount($delimiter, $testString, $count, $expectedArray)
getIndpEnvTypo3SitePathReturnsStringStartingWithSlash()
static cmpFQDN($baseHost, $list)
static cmpFqdnInvalidDataProvider()
sanitizeLocalUrlAcceptsNotEncodedValidPaths($path)
generateRandomBytesReturnsExpectedAmountOfBytesDataProvider()
expandListExpandsIntegerRanges($list, $expectation)
static quoteJSvalue($value)
tempnamReturnsAbsolutePathInsideDocumentRoot()
getFilesInDirReturnsArrayWithMd5OfElementAndPathAsArrayKey()
static validEmail($email)
implodeArrayForUrlCanSkipEmptyParameters()
makeInstanceResolvesConfiguredImplementationsRecursively()
callUserFunctionWillReturnFalseForInvalidParameters($functionName)
expandListExpandsIntegerRangesDataProvider()
static intExplode($delimiter, $string, $removeEmptyValues=FALSE, $limit=0)
dirnameWithDataProvider($input, $expectedValue)
const ENV_TRUSTED_HOSTS_PATTERN_ALLOW_ALL
makeInstanceCalledTwoTimesAfterAddInstanceReturnTwoDifferentInstances()
explodeUrl2ArrayTransformsParameterStringToNestedArray($name, $array, $input)
validURLReturnsTrueForValidResource($url)
substUrlsInPlainTextDataProvider()
static writeFileToTypo3tempDir($filepath, $content)
validEmailReturnsFalseForInvalidMailAddress($address)
encodeHeaderEncodesQuestionmarksInQuotedPrintableMailHeader()
sanitizeLocalUrlDeniesPlainInvalidUrls($url)
mkdirDeepCreatesSubdirectoriesRecursive()
static getIndpEnv($getEnvName)
rawUrlEncodeJsPreservesWhitespaces()
canSetNewGetInputValues($input, $key, $expected, $getPreset=array())
static rmdir($path, $removeNonEmpty=FALSE)
isValidUrlInvalidRessourceDataProvider()
normalizeIPv6CorrectlyNormalizesAddresses($compressed, $normalized)
checkisOnCurrentHostInvalidHosts()
syslogFixesPermissionsOnFileIfUsingFileLogging()
minifyJavaScriptErroneousCallback()
intExplodeConvertsStringsToInteger()
addInstanceWithSingletonInstanceThrowsException()
rmFromListRemovesElementsFromCommaSeparatedList($initialList, $listWithElementRemoved)
isOnCurrentHostReturnsTrueWithCurrentHost()
cmpIPv4ReturnsTrueForMatchingAddress($ip, $list)
mkdirDeepSetsGroupOwnershipOnNewSubDirectory()
strtoupperConvertsOnlyLatinCharacters($input, $expected)
static setAllowHostHeaderValue($allowHostHeaderValue)
getIndpEnvTypo3SitePathReturnNonEmptyString()
checkTrimExplodeTrimsSpacesAtElementStartAndEnd()
IPv6Bin2HexCorrectlyConvertsAddresses($binary, $hex)
addSlashesOnArrayAddsSlashesRecursive()
static hmac($input, $additionalSecret='')
arrayDiffAssocRecursiveHandlesMixedArrays()
encodeHeaderEncodesWhitespacesInQuotedPrintableMailHeader()
static fixPermissions($path, $recursive=FALSE)
static underscoredToLowerCamelCase($string)
inListForItemContainedReturnsTrue($haystack)
checkTrimExplodeKeepsRemainingResultsWithEmptyItemsAfterReachingLimitWithPositiveParameter()
getIndpEnvForHostThrowsExceptionForNotAllowedHostnameValues($httpHost, $hostNamePattern)
callUserFunctionWillThrowExceptionForInvalidParameters($functionName)
keepItemsInArrayCanUseCallbackOnSearchArray()
static generateRandomBytes($bytesToReturn)
static camelCaseToLowerCaseUnderscored($string)
isFirstPartOfStrReturnsFalseForNotMatchingFirstPart($string, $part)
quoteJsValueTest($input, $expected)
callUserFunctionCanCallFunction()
getFilesInDirExcludesFilesMatchingPattern()
getDirsReturnsStringErrorOnPathFailure()
static rmFromList($element, $list)
stripHttpHeadersStripsHeadersFromHttpResponse($httpResponse, $expected)
static getDeprecationLogFileName()
static makeInstance($className)
makeInstanceCalledTwoTimesForNonSingletonClassReturnsDifferentInstances()
addInstanceMakesMakeInstanceReturnThatInstance()
fixPermissionsSetsDefaultPermissionsToDirectory()
getSetAssignsOneValueToOneKey()
static trimExplode($delim, $string, $removeEmptyValues=FALSE, $limit=0)
splitCalcCorrectlySplitsExpression($expected, $expression)
makeInstanceWithEmptyClassNameThrowsException()
cmpFqdnReturnsTrue($baseHost, $list)
static verifyFilenameAgainstDenyPattern($filename)
naturalKeySortRecursiveReturnsFalseIfInputIsNotAnArray()
unlink_tempfileRemovesValidFileInTypo3temp()
static remapArrayKeys(&$array, $mappingTable)
removeDotsFromTypoScriptSucceedsWithDottedArray()
mkdirDeepFixesPermissionsOfCreatedDirectory()
getSetWritesArrayToGlobalsHttpGetVars()
static copyDirectory($source, $destination)
static hostnamesMatchingTrustedHostsConfigurationDataProvider()
makeInstanceWithZeroStringClassNameThrowsException()
tempnamReturnsPathWithoutBackslashes()
fixPermissionsSetsPermissionsToFile()
rmdirRemovesDirectoriesRecursiveAndReturnsTrue()
static callUserFunction($funcName, &$params, &$ref, $checkPrefix='', $errorMode=0)
fixPermissionsSetsDefaultPermissionsToFile()
checkTrimExplodeKeepsZeroAsString()
static isOnCurrentHost($url)
splitFileRefReturnsFileTypeNotForFolders()
generateRandomBytesReturnsDifferentBytesDuringDifferentCallsDataProvider()
sanitizeLocalUrlValidPathsDataProvider()
camelCaseToLowerCaseUnderscored($expected, $inputString)
inArrayChecksStringExistenceWithinArray($array, $item, $expected)
static _GETset($inputGet, $key='')
static array2xml(array $array, $NSprefix='', $level=0, $docTag='phparray', $spaceInd=0, array $options=array(), array $stackData=array())
getIndpEnvTypo3SitePathReturnsStringEndingWithSlash()
getSetForOneValueDoesNotDropUnrelatedValues()
getFilesInDirCanOrderByMtime()
static compressIPv6($address)
static unQuoteFilenames($parameters, $unQuote=FALSE)
removeDotsFromTypoScriptOverridesSubArray()
purgeInstancesDropsAddedInstance()
static resetSingletonInstances(array $newSingletonInstances)
validIpReturnsTrueForValidIp($ip)
static hostnameAndPortDataProvider()
minifyJavaScriptWritesExceptionMessageToDevLog()
callUserFunctionInvalidParameterDataprovider()
static split_fileref($fileNameWithPath)
static naturalKeySortRecursive(&$array)
static deprecationLog($msg)
static addSlashesOnArray(array &$theArray)
getIndpEnvTypo3SitePathReturnsStringStartingWithDrive()
static normalizeIPv6($address)
deHSCentitiesReturnsDecodedString($input, $expected)
getFilesInDirByExtensionDoesNotFindFilesWithOtherExtensions()
getFilesInDirDoesSortAlphabeticallyByDefault()
inListForItemNotContainedReturnsFalse($haystack)
addInstanceForClassThatIsNoSubclassOfProvidedClassThrowsException()
fixPermissionsDoesNotSetPermissionsToNotAllowedPath()
htmlspecialcharsDecodeReturnsDecodedString()
static deHSCentities($str)
generateRandomBytesReturnsDifferentBytesDuringDifferentCalls($numberOfBytes)
cmpFqdnReturnsFalse($baseHost, $list)
static underscoredToUpperCamelCase($string)
resetSingletonInstancesResetsPreviouslySetInstance()
getFilesInDirDoesNotFindDirectories()
mkdirCreatesDirectoryWithTrailingSlash()
imageMagickCommandsDataProvider()
setSingletonInstanceForEmptyClassNameThrowsException()
getSetCanAssignAStringValueToASpecificArrayChildElement()
makeInstanceCalledTwoTimesForSingletonClassWithPurgeInstancesInbetweenReturnsDifferentInstances()
isAllowedHostHeaderValueReturnsFalseIfTrusedHostsIsNotConfigured()
remapArrayKeysExchangesKeysWithGivenMapping()
if($list_of_literals) if(!empty($literals)) if(!empty($literals)) $result
Analyse literals to prepend the N char to them if their contents aren't numeric.
naturalKeySortRecursiveSortsOneDimensionalArrayByNaturalOrder()
validPathStrDetectsInvalidCharacters($path)
getFilesInDirFindsRegularFile()
getSetCanAssignsAnArrayToASpecificArrayElement()
getSetWritesArrayToGetSystemVariable()
unlink_tempfileRemovesHiddenFile()
static compileSelectedGetVarsFromArray($varList, array $getArray, $GPvarAlt=TRUE)
static hostnamesNotMatchingTrustedHostsConfigurationDataProvider()
compressIPv6CorrectlyCompressesAdresses($compressed, $normalized)
mkdirDeepFixesPermissionsOnNewParentDirectory()
getIndpEnvTypo3PortParsesHostnamesAndIpAdresses($httpHost, $dummy, $expectedPort)
validIpReturnsFalseForInvalidIp($ip)
static getBytesFromSizeMeasurement($measurement)
mkdirDeepThrowsExceptionIfBaseDirectoryIsNotOfTypeString()
static inArray(array $in_array, $item)
getSetForArrayDropsExistingValues()
sanitizeLocalUrlAcceptsEncodedValidPaths($path)
sanitizeLocalUrlInvalidDataProvider()
sanitizeLocalUrlDeniesEncodedInvalidUrls($url)
mkdirDeepCreatesDirectory()
callUserFunctionAcceptsClosures()
arrayDiffAssocRecursiveHandlesMultiDimensionalArrays()
underscoredToUpperCamelCase($expected, $inputString)
isMinifyJavaScriptHookCalledCallback(array $params)
static cmpFqdnValidDataProvider()
getIndpEnvTypo3HostOnlyParsesHostnamesAndIpAdresses($httpHost, $expectedIp)
checkTrimExplodeRemovesNewLines()
makeInstanceWithNonEmptyArrayThrowsException()
rmdirRemovesDeadLinkToDirectory()
verifyFilenameAgainstDenyPatternDetectsNotAllowedFiles($deniedFile)
fixPermissionsSetsPermissionsToHiddenFile()
static tempnam($filePrefix, $fileSuffix='')
fixPermissionsSetsPermissionsWithRelativeFileReference()
rmFromListRemovesElementsFromCommaSeparatedListDataProvider()
rawUrlEncodeFpPreservesSlashes()
mkdirDeepSetsGroupOwnershipOfCreatedParentDirectory()
static removeDotsFromTS(array $ts)
rmdirRemovesDirectoryWithTrailingSlash()
makeInstanceWithNullClassNameThrowsException()
getBytesFromSizeMeasurementCalculatesCorrectByteValue($expected, $byteString)
static rawUrlEncodeFP($str)
underscoredToLowerCamelCase($expected, $inputString)
static invalidIpDataProvider()
strtolowerConvertsOnlyLatinCharacters($expected, $input)
minifyJavaScriptCallsRegisteredHookWithInputString()
canRetrieveGlobalInputsThroughPost($key, $post, $expected)
deprecationLogFixesPermissionsOnLogFile()
allGetIndpEnvCallsRelatedToHostNamesCallIsAllowedHostHeaderValue()
static splitCalc($string, $operators)
compressIPv6CorrectlyCompressesAdressWithSomeAddressOnRightSide()
IPv6Hex2BinCorrectlyConvertsAddresses($hex, $binary)
xml2ArrayConvertsEmptyArraysToElementWithoutContent()
explodeUrl2ArrayTransformsParameterStringToFlatArray($input, $expected)
static normalizeCompressIPv6DataProviderCorrect()
makeInstanceWithEmptyArrayThrowsException()
inListForItemNotContainedReturnsFalseDataProvider()
validUrlValidResourceDataProvider()
slashJsEscapesSingleQuotesAndSlashes($input, $extended, $expected)
getFilesInDirCanPrependPath()
fixPermissionsSetsPermissionsToHiddenDirectory()
cmpIPv6ReturnsFalseForNotMatchingAddress($ip, $list)
static implodeArrayForUrl($name, array $theArray, $str='', $skipBlank=FALSE, $rawurlencodeParamName=FALSE)
static formatSize($sizeInBytes, $labels='')
formatSizeTranslatesBytesToHigherOrderRepresentation($size, $label, $expected)
revExplodeRespectsLimitThreeWhenExploding()
static array_merge(array $arr1, array $arr2)
getIndpEnvForHostAllowsAllHostnameValuesIfHostPatternIsSetToAllowAll($httpHost, $hostNamePattern)
hmacReturnsEqualHashesForEqualInput()
sanitizeLocalUrlAcceptsNotEncodedValidUrls($url, $host, $subDirectory)
fixPermissionsSetsPermissionsToDirectoryWithTrailingSlash()
mkdirDeepThrowsExceptionIfDirectoryCreationFails()
static getFilesInDir($path, $extensionList='', $prependPath=FALSE, $order='', $excludePattern='')
static IPv6Bin2HexDataProviderCorrect()
checkTrimExplodeKeepsRamainingResultsWithEmptyItemsAfterReachingLimitWithNegativeParameter()
static array_merge_recursive_overrule(array $arr0, array $arr1, $notAddKeys=FALSE, $includeEmptyValues=TRUE, $enableUnsetFeature=TRUE)
sanitizeLocalUrlAcceptsEncodedValidUrls($url, $host, $subDirectory)
mkdirSetsGroupOwnershipOfCreatedDirectory()
removeDotsFromTypoScriptOverridesWithScalar()
fixPermissionsSetsPermissionsToDirectory()
static cmpIPv6DataProviderNotMatching()
explodeAndUnquoteImageMagickCommands($source, $expectedQuoted, $expectedUnquoted)
expandListExpandsForTwoThousandElementsExpandsOnlyToThousandElementsMaximum()
cmpIPv4ReturnsFalseForNotMatchingAddress($ip, $list)
static _GPmerged($parameter)
deniedFilesDataProvider()
isAllowedHostHeaderValueWorksCorrectlyWithWithServerNamePattern($httpHost, $serverName, $isAllowed, $serverPort='80', $ssl='Off')
static sanitizeLocalUrl($url='')
getFilesInDirByExtensionFindsFiles()
getFilesInDirCreateTestDirectory()
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
static removeArrayEntryByValue(array $array, $cmpValue)
checkRemoveArrayEntryByValueRemovesEntriesFromMultiDimensionalArray()
static revExplode($delimiter, $string, $count=0)
getStripHttpHeadersDataProvider()
isFirstPartOfStrReturnsFalseForNotMatchingFirstPartDataProvider()
mkdirCreatesHiddenDirectory()
setSingletonInstanceForClassThatIsNoSubclassOfProvidedClassThrowsException()
static inList($list, $item)
checkTrimExplodeKeepsRamainingResultsWithoutEmptyItemsAfterReachingLimitWithNegativeParameter()
getSetCanAssignAnArrayToASpecificArrayChildElement()
mkdirDeepSetsGroupOwnershipOfCreatedDirectory()
static cmpIPv4DataProviderNotMatching()
makeInstanceReturnsClassInstance()
addInstanceForEmptyClassNameThrowsException()
serverNamePatternDataProvider()
minifyJavaScriptReturnsErrorStringOfHookException()
mkdirSetsPermissionsOfCreatedDirectory()
copyDirectoryCopiesFilesAndDirectoriesWithAbsolutePaths()
const ENV_TRUSTED_HOSTS_PATTERN_SERVER_NAME
mkdirDeepCreatesDirectoryInVfsStream()
checkTrimExplodeRemovesEmptyElements()
naturalKeySortRecursiveSortsMultiDimensionalArrayByNaturalOrder()
checkRemoveArrayEntryByValueRemovesEntriesFromOneDimensionalArray()
getRedirectUrlFromHttpHeadersDataProvider()
isAllowedHostHeaderValueReturnsTrueIfHostValueMatches($httpHost, $hostNamePattern)
isAllowedHostHeaderValueReturnsFalseIfHostValueMatches($httpHost, $hostNamePattern)
static encodeHeader($line, $enc='quoted-printable', $charset='utf-8')
rmdirReturnTrueIfFileWasRemoved()
static IPv6Hex2BinDataProviderCorrect()
arrayMergeKeepsIndexesAfterMerge()
static arrayDiffAssocRecursive(array $array1, array $array2)
validPathStrDataProvider()
validEmailInvalidDataProvider()
copyDirectoryCopiesFilesAndDirectoriesWithRelativePaths()
rmdirRemovesLinkToDirectory()
static resolveBackPath($pathStr)
camelCaseToLowerCaseUnderscoredDataProvider()
hmacReturnsNoEqualHashesForNonEqualInput()
getBytesFromSizeMeasurementDataProvider()
static rawUrlEncodeJS($str)
cmpIPv6ReturnsTrueForMatchingAddress($ip, $list)
callUserFunctionCanPrefixFuncNameWithFilePath()
unlink_tempfileReturnsTrueIfFileWasRemoved()
user_calledUserFunction()
static cmpIPv4DataProviderMatching()
rmdirRemovesDeadLinkToFile()
static keepItemsInArray(array $array, $keepItems, $getValueFunc=NULL)
makeInstanceCalledTwoTimesForSingletonClassReturnsSameInstance()
validPathStrWorksWithUnicodeFileNames($path)
static stripHttpHeaders($content)
const SYSLOG_SEVERITY_NOTICE
keepItemsInArrayCanUseClosure()