You are here

function FileEntityFileTypeClassificationTestCase::getFileType in File Entity (fieldable files) 7.3

Same name and namespace in other branches
  1. 7.2 file_entity.test \FileEntityFileTypeClassificationTestCase::getFileType()

Get the file type of a given file.

Parameters

$file: A file object.

Return value

The file's file type as a string.

1 call to FileEntityFileTypeClassificationTestCase::getFileType()
FileEntityFileTypeClassificationTestCase::testFileTypeClassification in ./file_entity.test
Test that existing files are properly classified by file type.

File

./file_entity.test, line 190
Test integration for the file_entity module.

Class

FileEntityFileTypeClassificationTestCase
Tests file type classification functionality.

Code

function getFileType($file) {
  $type = db_select('file_managed', 'fm')
    ->fields('fm', array(
    'type',
  ))
    ->condition('fid', $file->fid, '=')
    ->execute()
    ->fetchAssoc();
  return $type;
}