diff options
author | Robin Appelman <robin@icewind.nl> | 2017-09-28 14:22:42 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2017-09-28 14:22:42 +0200 |
commit | b36dd8b71fb8751b07ef98443d739d0b1cda9c7d (patch) | |
tree | 95c994b25a8bcbfdfbbff514ca26607c1677dabe /apps/files_external/tests/Storage | |
parent | 1c2da7d7d38d3bffef1ff2396edab65e9d3370b8 (diff) | |
download | nextcloud-server-b36dd8b71fb8751b07ef98443d739d0b1cda9c7d.tar.gz nextcloud-server-b36dd8b71fb8751b07ef98443d739d0b1cda9c7d.zip |
Fallback to filename based detection if the remote dav server doesn't know the mimetype
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_external/tests/Storage')
-rw-r--r-- | apps/files_external/tests/Storage/WebdavTest.php | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/apps/files_external/tests/Storage/WebdavTest.php b/apps/files_external/tests/Storage/WebdavTest.php index 1e518e23b77..b007ded2662 100644 --- a/apps/files_external/tests/Storage/WebdavTest.php +++ b/apps/files_external/tests/Storage/WebdavTest.php @@ -28,6 +28,7 @@ namespace OCA\Files_External\Tests\Storage; use \OC\Files\Storage\DAV; +use OC\Files\Type\Detection; /** * Class WebdavTest @@ -43,7 +44,7 @@ class WebdavTest extends \Test\Files\Storage\Storage { $id = $this->getUniqueID(); $config = include('files_external/tests/config.webdav.php'); - if ( ! is_array($config) or !$config['run']) { + if (!is_array($config) or !$config['run']) { $this->markTestSkipped('WebDAV backend not configured'); } if (isset($config['wait'])) { @@ -61,4 +62,14 @@ class WebdavTest extends \Test\Files\Storage\Storage { parent::tearDown(); } + + public function testMimetypeFallback() { + $this->instance->file_put_contents('foo.bar', 'asd'); + + /** @var Detection $mimeDetector */ + $mimeDetector = \OC::$server->getMimeTypeDetector(); + $mimeDetector->registerType('bar', 'application/x-bar'); + + $this->assertEquals('application/x-bar', $this->instance->getMimeType('foo.bar')); + } } |