[BUGFIX] Fatal error: Class 't3lib_file_BaseTestCase' not found
[Packages/TYPO3.CMS.git] / tests / t3lib / file / Driver / AbstractDriverTest.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 2011-2012 Andreas Wolf <andreas.wolf@ikt-werk.de>
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 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27
28 require_once dirname(__FILE__) . '/../BaseTestCase.php';
29
30 /**
31 * Test case for the abstract driver.
32 *
33 * @author Andreas Wolf <andreas.wolf@ikt-werk.de>
34 * @package TYPO3
35 * @subpackage t3lib
36 */
37 class t3lib_file_Driver_AbstractDriverTest extends t3lib_file_BaseTestCase {
38
39 /**
40 * @var t3lib_file_Driver_AbstractDriver
41 */
42 protected $fixture;
43
44 /**
45 * @return t3lib_file_Driver_AbstractDriver
46 */
47 protected function createDriverFixture() {
48 return $this->getMockForAbstractClass('t3lib_file_Driver_AbstractDriver', array(), '', FALSE);
49 }
50
51
52 public function filenameValidationDataProvider() {
53 return array(
54 'all-lowercase filename with extension' => array(
55 'testfile.txt',
56 TRUE
57 ),
58 'regular filename with mixed case and extension' => array(
59 'someFilename.jpg',
60 TRUE
61 ),
62 'filename with german umlauts' => array(
63 'anÜmläütTestfile.jpg',
64 TRUE
65 ),
66 'filename with double extension' => array(
67 'someCompressedFile.tar.gz',
68 TRUE
69 ),
70 'filename with leading slash' => array(
71 '/invalidAsFilename',
72 FALSE
73 ),
74 'filename with null character' => array(
75 'someFile' . chr(0) . 'name',
76 FALSE
77 ),
78 );
79 }
80
81 /**
82 * @test
83 * @dataProvider filenameValidationDataProvider
84 */
85 public function filenamesAreCorrectlyValidated($filename, $expectedResult) {
86 $fixture = $this->createDriverFixture(array());
87 $result = $fixture->isValidFilename($filename);
88
89 $this->assertEquals($expectedResult, $result);
90 }
91 }
92
93 ?>