Tests file_usage()->listUsage().
function testGetUsage() {
$file = $this
->createFile();
db_insert('file_usage')
->fields(array(
'fid' => $file->fid,
'module' => 'testing',
'type' => 'foo',
'id' => 1,
'count' => 1,
))
->execute();
db_insert('file_usage')
->fields(array(
'fid' => $file->fid,
'module' => 'testing',
'type' => 'bar',
'id' => 2,
'count' => 2,
))
->execute();
$usage = file_usage()
->listUsage($file);
$this
->assertEqual(count($usage['testing']), 2, t('Returned the correct number of items.'));
$this
->assertTrue(isset($usage['testing']['foo'][1]), t('Returned the correct id.'));
$this
->assertTrue(isset($usage['testing']['bar'][2]), t('Returned the correct id.'));
$this
->assertEqual($usage['testing']['foo'][1], 1, t('Returned the correct count.'));
$this
->assertEqual($usage['testing']['bar'][2], 2, t('Returned the correct count.'));
}