Index: tests/phpunit/tests/functions.php
===================================================================
--- tests/phpunit/tests/functions.php	(revisão 37465)
+++ tests/phpunit/tests/functions.php	(cópia de trabalho)
@@ -150,6 +150,27 @@
 		);
 	}
 
+	/**
+	 * @dataProvider file_path_provider
+	 */
+	function test_validate_file( $result, $allowed_files, $expected ) {
+		$this->assertEquals( validate_file( '../foo/foo.txt' ), 1 );
+		$this->assertEquals( $expected, validate_file( $result, $allowed_files ) );
+	}
+
+	function file_path_provider() {
+		return array(
+			array( '../foo/foo.txt', array(), 1 ),
+			array( '../foo.txt', array(), 1 ),
+			array( '../foo.bar', array(), 1 ),
+			array( 'foo/bar/foo.txt', array(), 0 ),
+			array( 'FOO/foo.txt', array(), 0 ),
+			array( 'C:/WINDOWS/system32', array(), 2 ),
+			array( './FOO/foo.txt', array(), 1 ),
+			array( '/FOO/notallowed.txt', array( '/FOO/allowed.txt' ), 3 ),
+		);
+	}
+
 	function test_wp_unique_filename() {
 
 		$testdir = DIR_TESTDATA . '/images/';
