From 474e42cc0863f222c2acf54148d2b138ff42e7ea Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 1 Sep 2012 12:40:05 +0100 Subject: [PATCH] Switch File::info() tests to use a different file. text/php files are not detected reliably across platforms. Use a plain text file instead. This should fix builds on travis.ci --- lib/Cake/Test/Case/Utility/FileTest.php | 31 +++++++++++++------------ 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/lib/Cake/Test/Case/Utility/FileTest.php b/lib/Cake/Test/Case/Utility/FileTest.php index e63bcbd9f..93c7227be 100644 --- a/lib/Cake/Test/Case/Utility/FileTest.php +++ b/lib/Cake/Test/Case/Utility/FileTest.php @@ -64,38 +64,39 @@ class FileTest extends CakeTestCase { * @return void */ public function testBasic() { - $file = __FILE__; + $file = CAKE . DS . 'LICENSE.txt'; - $result = $this->File->pwd(); - $expecting = $file; - $this->assertEquals($expecting, $result); + $this->File = new File($file, false); $result = $this->File->name; - $expecting = basename(__FILE__); + $expecting = basename($file); $this->assertEquals($expecting, $result); $result = $this->File->info(); $expecting = array( - 'dirname' => dirname(__FILE__), - 'basename' => basename(__FILE__), - 'extension' => 'php', - 'filename' => 'FileTest', + 'dirname' => dirname($file), + 'basename' => basename($file), + 'extension' => 'txt', + 'filename' => 'LICENSE', 'filesize' => filesize($file), - 'mime' => 'text/x-php' + 'mime' => 'text/plain' ); - if (!function_exists('finfo_open') && (!function_exists('mime_content_type') || - function_exists('mime_content_type') && false === mime_content_type($this->File->pwd()))) { + if ( + !function_exists('finfo_open') && + (!function_exists('mime_content_type') || + function_exists('mime_content_type') && + mime_content_type($this->File->pwd()) === false) + ) { $expecting['mime'] = false; } - $this->assertEquals($expecting, $result); $result = $this->File->ext(); - $expecting = 'php'; + $expecting = 'txt'; $this->assertEquals($expecting, $result); $result = $this->File->name(); - $expecting = 'FileTest'; + $expecting = 'LICENSE'; $this->assertEquals($expecting, $result); $result = $this->File->md5();