public function testAllowedUpload()
{
$app = $this->getApp();
$fp = new FilePermissions($app['config']);
$hiddenFile = '.bashrc';
$this->assertFalse($fp->allowedUpload($hiddenFile));
$badExtension = 'evil.exe';
$this->assertFalse($fp->allowedUpload($badExtension));
$okFile = 'mycoolimage.jpg';
if (ini_set('file_uploads', '0') !== false) {
try {
$fp->allowedUpload($okFile);
} catch (IOException $e) {
$this->assertEquals($e->getMessage(), 'File uploads are not allowed, check the file_uploads ini directive.');
}
ini_set('file_uploads', '1');
}
$this->assertTrue($fp->allowedUpload($okFile));
}