diff --git a/lib/Cake/Test/Case/Utility/FileTest.php b/lib/Cake/Test/Case/Utility/FileTest.php index 0fb17b63c..1a90d9260 100644 --- a/lib/Cake/Test/Case/Utility/FileTest.php +++ b/lib/Cake/Test/Case/Utility/FileTest.php @@ -73,8 +73,12 @@ class FileTest extends CakeTestCase { $result = $this->File->info(); $expecting = array( - 'dirname' => dirname(__FILE__), 'basename' => basename(__FILE__), - 'extension' => 'php', 'filename' =>'FileTest', 'filesize' => filesize($file) + 'dirname' => dirname(__FILE__), + 'basename' => basename(__FILE__), + 'extension' => 'php', + 'filename' =>'FileTest', + 'filesize' => filesize($file), + 'mime' => 'text/x-php' ); $this->assertEquals($expecting, $result); diff --git a/lib/Cake/Utility/File.php b/lib/Cake/Utility/File.php index 32d04e51d..9618b3c77 100644 --- a/lib/Cake/Utility/File.php +++ b/lib/Cake/Utility/File.php @@ -554,6 +554,9 @@ class File { * @return false|string The mimetype of the file, or false if reading fails. */ public function mime() { + if (!$this->exists()) { + return false; + } if (function_exists('finfo_open')) { $finfo = finfo_open(FILEINFO_MIME); list($type, $charset) = explode(';', finfo_file($finfo, $this->pwd()));