Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-08-12 12:44:34 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2016-08-13 18:10:13 +0300
commitf68dd4d821a7c2ab19c0f70c07a0e586b1975cbd (patch)
treed283f23bd87ceef18c93522c69486b9d7dc9cda7 /tests
parentca1043e4a97cc6d9f622d174ea529f667e962a9b (diff)
Improve file_target finding logic when repairing unmerged shares
Pick the most recent subshare that has no parenthesis from duplication which should match whichever name the user picked last. If all subshares have duplicate parenthesis names, use the least recent group share's target instead.
Diffstat (limited to 'tests')
-rw-r--r--tests/lib/repair/repairunmergedsharestest.php66
1 files changed, 57 insertions, 9 deletions
diff --git a/tests/lib/repair/repairunmergedsharestest.php b/tests/lib/repair/repairunmergedsharestest.php
index fe9b3e5b96f..9fe9a073881 100644
--- a/tests/lib/repair/repairunmergedsharestest.php
+++ b/tests/lib/repair/repairunmergedsharestest.php
@@ -204,7 +204,7 @@ class RepairUnmergedSharesTest extends TestCase {
[
// #2 bogus share
// - outsider shares with group1, group2
- // - one subshare for each group share
+ // - one subshare for each group share, both with parenthesis
// - but the targets do not match when grouped
[
[Constants::SHARE_TYPE_GROUP, 123, 'recipientgroup1', '/test', 31],
@@ -218,7 +218,7 @@ class RepairUnmergedSharesTest extends TestCase {
[
['/test', 31],
['/test', 31],
- // reset to original name
+ // reset to original name as the sub-names have parenthesis
['/test', 31],
['/test', 31],
// leave unrelated alone
@@ -228,6 +228,54 @@ class RepairUnmergedSharesTest extends TestCase {
[
// #3 bogus share
// - outsider shares with group1, group2
+ // - one subshare for each group share, both renamed manually
+ // - but the targets do not match when grouped
+ [
+ [Constants::SHARE_TYPE_GROUP, 123, 'recipientgroup1', '/test', 31],
+ [Constants::SHARE_TYPE_GROUP, 123, 'recipientgroup2', '/test', 31],
+ // child of the previous ones
+ [DefaultShareProvider::SHARE_TYPE_USERGROUP, 123, 'user2', '/test_renamed (1 legit paren)', 31, 0],
+ [DefaultShareProvider::SHARE_TYPE_USERGROUP, 123, 'user2', '/test_renamed (2 legit paren)', 31, 1],
+ // different unrelated share
+ [Constants::SHARE_TYPE_GROUP, 456, 'recipientgroup1', '/test (4)', 31],
+ ],
+ [
+ ['/test', 31],
+ ['/test', 31],
+ // reset to less recent subshare name
+ ['/test_renamed (2 legit paren)', 31],
+ ['/test_renamed (2 legit paren)', 31],
+ // leave unrelated alone
+ ['/test (4)', 31],
+ ]
+ ],
+ [
+ // #4 bogus share
+ // - outsider shares with group1, group2
+ // - one subshare for each group share, one with parenthesis
+ // - but the targets do not match when grouped
+ [
+ [Constants::SHARE_TYPE_GROUP, 123, 'recipientgroup1', '/test', 31],
+ [Constants::SHARE_TYPE_GROUP, 123, 'recipientgroup2', '/test', 31],
+ // child of the previous ones
+ [DefaultShareProvider::SHARE_TYPE_USERGROUP, 123, 'user2', '/test (2)', 31, 0],
+ [DefaultShareProvider::SHARE_TYPE_USERGROUP, 123, 'user2', '/test_renamed', 31, 1],
+ // different unrelated share
+ [Constants::SHARE_TYPE_GROUP, 456, 'recipientgroup1', '/test (4)', 31],
+ ],
+ [
+ ['/test', 31],
+ ['/test', 31],
+ // reset to less recent subshare name but without parenthesis
+ ['/test_renamed', 31],
+ ['/test_renamed', 31],
+ // leave unrelated alone
+ ['/test (4)', 31],
+ ]
+ ],
+ [
+ // #5 bogus share
+ // - outsider shares with group1, group2
// - one subshare for each group share
// - first subshare not renamed (as in real world scenario)
// - but the targets do not match when grouped
@@ -251,7 +299,7 @@ class RepairUnmergedSharesTest extends TestCase {
]
],
[
- // #4 bogus share:
+ // #6 bogus share:
// - outsider shares with group1, group2
// - one subshare for each group share
// - non-matching targets
@@ -276,7 +324,7 @@ class RepairUnmergedSharesTest extends TestCase {
]
],
[
- // #5 bogus share:
+ // #7 bogus share:
// - outsider shares with group1, group2
// - one subshare for each group share
// - non-matching targets
@@ -301,7 +349,7 @@ class RepairUnmergedSharesTest extends TestCase {
]
],
[
- // #6 bogus share:
+ // #8 bogus share:
// - outsider shares with group1, group2 and also user2
// - one subshare for each group share
// - one extra share entry for direct share to user2
@@ -329,7 +377,7 @@ class RepairUnmergedSharesTest extends TestCase {
]
],
[
- // #7 bogus share:
+ // #9 bogus share:
// - outsider shares with group1 and also user2
// - no subshare at all
// - one extra share entry for direct share to user2
@@ -350,7 +398,7 @@ class RepairUnmergedSharesTest extends TestCase {
]
],
[
- // #8 legitimate share with own group:
+ // #10 legitimate share with own group:
// - insider shares with both groups the user is already in
// - no subshares in this case
[
@@ -368,7 +416,7 @@ class RepairUnmergedSharesTest extends TestCase {
]
],
[
- // #9 legitimate shares:
+ // #11 legitimate shares:
// - group share with same group
// - group share with other group
// - user share where recipient renamed
@@ -392,7 +440,7 @@ class RepairUnmergedSharesTest extends TestCase {
]
],
[
- // #10 legitimate share:
+ // #12 legitimate share:
// - outsider shares with group and user directly with different permissions
// - no subshares
// - same targets