mirror of
https://github.com/nextcloud/server.git
synced 2026-05-19 08:25:56 -04:00
test: Fix getting returned sharees when there are several results
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
parent
abc82b4d09
commit
bd4e856f41
2 changed files with 35 additions and 0 deletions
|
|
@ -729,6 +729,37 @@ trait Sharing {
|
|||
$shareeType = substr($shareeType, 6);
|
||||
}
|
||||
|
||||
// "simplexml_load_string" creates a SimpleXMLElement object for each
|
||||
// XML element with child elements. In turn, each child is indexed by
|
||||
// its tag in the SimpleXMLElement object. However, when there are
|
||||
// several child XML elements with the same tag, an array with all the
|
||||
// children with the same tag is indexed instead. Therefore, when the
|
||||
// XML contains
|
||||
// <XXX>
|
||||
// <element>
|
||||
// <label>...</label>
|
||||
// <value>...</value>
|
||||
// </element>
|
||||
// </XXX>
|
||||
// the "$elements[$shareeType]" variable contains an "element" key which
|
||||
// in turn contains "label" and "value" keys, but when the XML contains
|
||||
// <XXX>
|
||||
// <element>
|
||||
// <label>...</label>
|
||||
// <value>...</value>
|
||||
// </element>
|
||||
// <element>
|
||||
// <label>...</label>
|
||||
// <value>...</value>
|
||||
// </element>
|
||||
// </XXX>
|
||||
// the "$elements[$shareeType]" variable contains an "element" key which
|
||||
// in turn contains "0" and "1" keys, and in turn each one contains
|
||||
// "label" and "value" keys.
|
||||
if (array_key_exists('element', $elements[$shareeType]) && is_int(array_keys($elements[$shareeType]['element'])[0])) {
|
||||
$elements[$shareeType] = $elements[$shareeType]['element'];
|
||||
}
|
||||
|
||||
$sharees = [];
|
||||
foreach ($elements[$shareeType] as $element) {
|
||||
$sharee = [$element['label'], $element['value']['shareType'], $element['value']['shareWith']];
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ Feature: sharees
|
|||
And user "Sharee1" exists
|
||||
And group "ShareeGroup" exists
|
||||
And user "test" belongs to group "ShareeGroup"
|
||||
And user "Sharee2" exists
|
||||
|
||||
Scenario: Search without exact match
|
||||
Given As an "test"
|
||||
|
|
@ -19,6 +20,7 @@ Feature: sharees
|
|||
And "exact users" sharees returned is empty
|
||||
And "users" sharees returned are
|
||||
| Sharee1 | 0 | Sharee1 | Sharee1 |
|
||||
| Sharee2 | 0 | Sharee2 | Sharee2 |
|
||||
And "exact groups" sharees returned is empty
|
||||
And "groups" sharees returned are
|
||||
| ShareeGroup | 1 | ShareeGroup |
|
||||
|
|
@ -35,6 +37,7 @@ Feature: sharees
|
|||
And "exact users" sharees returned is empty
|
||||
And "users" sharees returned are
|
||||
| Sharee1 | 0 | Sharee1 | Sharee1 |
|
||||
| Sharee2 | 0 | Sharee2 | Sharee2 |
|
||||
And "exact groups" sharees returned is empty
|
||||
And "groups" sharees returned are
|
||||
| ShareeGroup | 1 | ShareeGroup |
|
||||
|
|
@ -254,6 +257,7 @@ Feature: sharees
|
|||
And "exact users" sharees returned is empty
|
||||
And "users" sharees returned are
|
||||
| Sharee1 | 0 | Sharee1 | Sharee1 |
|
||||
| Sharee2 | 0 | Sharee2 | Sharee2 |
|
||||
And "exact groups" sharees returned is empty
|
||||
And "groups" sharees returned is empty
|
||||
And "exact remotes" sharees returned is empty
|
||||
|
|
|
|||
Loading…
Reference in a new issue