Fixing test, some 5.2 installs do not have function to read mime

This commit is contained in:
Ceeram 2012-03-19 09:51:40 +01:00
parent 94b3839b2e
commit c38419e33a

View file

@ -80,6 +80,10 @@ class FileTest extends CakeTestCase {
'filesize' => filesize($file), 'filesize' => filesize($file),
'mime' => 'text/x-php' 'mime' => 'text/x-php'
); );
if (!function_exists('finfo_open') && !function_exists('mime_content_type')) {
$expecting['mime'] = false;
}
$this->assertEquals($expecting, $result); $this->assertEquals($expecting, $result);
$result = $this->File->ext(); $result = $this->File->ext();
@ -473,6 +477,7 @@ class FileTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testMime() { public function testMime() {
$this->skipIf(!function_exists('finfo_open') && !function_exists('mime_content_type'), 'Not able to read mime type');
$path = CAKE . 'Test' . DS . 'test_app' . DS . 'webroot' . DS . 'img' . DS . 'cake.power.gif'; $path = CAKE . 'Test' . DS . 'test_app' . DS . 'webroot' . DS . 'img' . DS . 'cake.power.gif';
$file = new File($path); $file = new File($path);
$this->assertEquals('image/gif', $file->mime()); $this->assertEquals('image/gif', $file->mime());