Fixed bug #17490: After introducing the locking in #17289 no CSRF token will ever...
[Packages/TYPO3.CMS.git] / tests / t3lib / config_defaultTest.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2010-2011 Oliver Hader <oliver@typo3.org>
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 *
17 * This script is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * This copyright notice MUST APPEAR in all copies of the script!
23 ***************************************************************/
24
25 /**
26 * Test case for basic core related constants in config_default.php
27 *
28 * @author Oliver Hader <oliver@typo3.org>
29 *
30 * @package TYPO3
31 */
32 class config_defaultTest extends tx_phpunit_testcase {
33 /**
34 * Tests whether an accordant PHP extension is denied.
35 *
36 * @param string phpExtension
37 * @dataProvider phpExtensionsDataProvider
38 * @test
39 */
40 public function fileDenyPatternMatchesPhpExtension($phpExtension) {
41 $this->assertGreaterThan(0, preg_match('/' . FILE_DENY_PATTERN_DEFAULT . '/', $phpExtension), $phpExtension);
42 }
43
44 /**
45 * Data provider for 'fileDenyPatternMatchesPhpExtension' test case.
46 *
47 * @return array
48 */
49 public function phpExtensionsDataProvider() {
50 $fileName = uniqid('filename');
51
52 $data = array();
53 $phpExtensions = t3lib_div::trimExplode(',', 'php,php3,php4,php5,php6,phpsh,phtml', TRUE);
54
55 foreach ($phpExtensions as $extension) {
56 $data[] = array($fileName . '.' . $extension);
57 $data[] = array($fileName . '.' . $extension . '.txt');
58 }
59
60 return $data;
61 }
62 }
63 ?>