/** * testMimeTypeFalse method * * @expectedException \Cake\Error\Exception * @return void */ public function testMimeTypeFalse() { $image = CORE_PATH . 'Cake/Test/TestApp/webroot/img/cake.power.gif'; $File = new File($image, false); $this->skipIf($File->mime(), 'mimeType can be determined, no Exception will be thrown'); Validation::mimeType($image, array('image/gif')); }
/** * Test mime() * * @return void */ public function testMime() { $this->skipIf(!function_exists('finfo_open') && !function_exists('mime_content_type'), 'Not able to read mime type'); $path = TEST_APP . 'webroot/img/cake.power.gif'; $file = new File($path); $expected = 'image/gif'; if (function_exists('mime_content_type') && mime_content_type($file->pwd()) === false) { $expected = false; } $this->assertEquals($expected, $file->mime()); }