summaryrefslogtreecommitdiffstats
path: root/tests/lib/repair
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-06-25 19:35:05 +0200
committerVincent Petry <pvince81@owncloud.com>2014-06-25 19:49:18 +0200
commitb749292c18367a653d11d9d93e3320cf1dc9d330 (patch)
tree04523e2bc0b646bd53c047ea06563b902fc0665e /tests/lib/repair
parentb1e778d5fd05ae7224e73dc2cdc72a94c4f8b55c (diff)
downloadnextcloud-server-b749292c18367a653d11d9d93e3320cf1dc9d330.tar.gz
nextcloud-server-b749292c18367a653d11d9d93e3320cf1dc9d330.zip
Added test case for when target mime types already exist
Diffstat (limited to 'tests/lib/repair')
-rw-r--r--tests/lib/repair/repairmimetypes.php46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/lib/repair/repairmimetypes.php b/tests/lib/repair/repairmimetypes.php
index 42af116b72d..91600502da0 100644
--- a/tests/lib/repair/repairmimetypes.php
+++ b/tests/lib/repair/repairmimetypes.php
@@ -92,6 +92,52 @@ class TestRepairMimeTypes extends PHPUnit_Framework_TestCase {
)
);
}
+
+ /**
+ * Test renaming and splitting old office mime types when
+ * new ones already exist
+ */
+ public function testRenameOfficeMimeTypesWhenExist() {
+ $this->addEntries(
+ array(
+ array('test.doc', 'application/msword'),
+ array('test.docx', 'application/msword'),
+ array('test.xls', 'application/msexcel'),
+ array('test.xlsx', 'application/msexcel'),
+ array('test.ppt', 'application/mspowerpoint'),
+ array('test.pptx', 'application/mspowerpoint'),
+ // make it so that the new mimetypes already exist
+ array('bogus.docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'),
+ array('bogus.xlsx', 'application/vnd.ms-excel'),
+ array('bogus.pptx', 'application/vnd.ms-powerpoint'),
+ array('bogus2.docx', 'application/wrong'),
+ array('bogus2.xlsx', 'application/wrong'),
+ array('bogus2.pptx', 'application/wrong'),
+ )
+ );
+
+ $this->repair->run();
+
+ // force mimetype reload
+ $this->storage->getCache()->loadMimeTypes();
+
+ $this->checkEntries(
+ array(
+ array('test.doc', 'application/msword'),
+ array('test.docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'),
+ array('test.xls', 'application/msexcel'),
+ array('test.xlsx', 'application/vnd.ms-excel'),
+ array('test.ppt', 'application/mspowerpoint'),
+ array('test.pptx', 'application/vnd.ms-powerpoint'),
+ array('bogus.docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'),
+ array('bogus.xlsx', 'application/vnd.ms-excel'),
+ array('bogus.pptx', 'application/vnd.ms-powerpoint'),
+ array('bogus2.docx', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'),
+ array('bogus2.xlsx', 'application/vnd.ms-excel'),
+ array('bogus2.pptx', 'application/vnd.ms-powerpoint'),
+ )
+ );
+ }
}
/**