public function testManage()
{
$app = $this->getApp();
$this->removeCSRF($app);
$this->setRequest(Request::create('/bolt/files'));
$response = $this->controller()->manage($this->getRequest(), 'files', '');
$context = $response->getContext()['context'];
/** @var DirectoryInterface $dir */
$dir = $context['directory'];
$this->assertTrue($dir instanceof DirectoryInterface);
$this->assertEquals('files://', $dir->getFullPath());
$this->assertEquals([], $context['files']);
// Try and upload a file
$perms = $this->getMockBuilder(FilePermissions::class)->setMethods(['allowedUpload'])->setConstructorArgs([$app['config']])->getMock();
$perms->expects($this->any())->method('allowedUpload')->will($this->returnValue(true));
$this->setService('filepermissions', $perms);
$this->setRequest(Request::create('/upload/files', 'POST', [], [], ['form' => ['FileUpload' => [new UploadedFile(PHPUNIT_ROOT . '/resources/generic-logo-evil.exe', 'logo.exe')], '_token' => 'xyz']]));
$this->controller()->manage($this->getRequest(), 'files', '');
}