Skip to content

Commit

Permalink
test(php): Fix the unit tests
Browse files Browse the repository at this point in the history
I added our context in the unit tests following the advice of Louis.

Link : nextcloud#43186 (comment)

Signed-off-by: Baptiste Fotia <fotia.baptiste@hotmail.com>
  • Loading branch information
zak39 committed Jan 31, 2024
1 parent 9af96d9 commit 449d28e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/settings/tests/Settings/Admin/SharingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ public function testGetFormWithoutExcludedGroups(): void {
['core', 'shareapi_remote_expire_after_n_days', '7', '7'],
['core', 'shareapi_enforce_remote_expire_date', 'no', 'no'],
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'],
]);
$this->shareManager->method('shareWithGroupMembersOnly')
->willReturn(false);
Expand Down Expand Up @@ -210,6 +211,7 @@ public function testGetFormWithExcludedGroups(): void {
['core', 'shareapi_remote_expire_after_n_days', '7', '7'],
['core', 'shareapi_enforce_remote_expire_date', 'no', 'no'],
['core', 'shareapi_enforce_links_password_excluded_groups', '', ''],
['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'],
]);
$this->shareManager->method('shareWithGroupMembersOnly')
->willReturn(false);
Expand Down
5 changes: 5 additions & 0 deletions tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ public function testGetContactsWhenUserIsInExcludeGroups() {
['core', 'shareapi_exclude_groups', 'no', 'yes'],
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
['core', 'shareapi_exclude_groups_list', '', '["group1", "group5", "group6"]'],
['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'],
]);

/** @var IUser|MockObject $currentUser */
Expand Down Expand Up @@ -260,6 +261,7 @@ public function testGetContactsOnlyShareIfInTheSameGroup() {
['core', 'shareapi_restrict_user_enumeration_to_phone', 'no', 'no'],
['core', 'shareapi_exclude_groups', 'no', 'no'],
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'],
]);

/** @var IUser|MockObject $currentUser */
Expand Down Expand Up @@ -334,6 +336,7 @@ public function testGetContactsOnlyEnumerateIfInTheSameGroup() {
['core', 'shareapi_restrict_user_enumeration_to_phone', 'no', 'no'],
['core', 'shareapi_exclude_groups', 'no', 'no'],
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'],
]);

/** @var IUser|MockObject $currentUser */
Expand Down Expand Up @@ -466,6 +469,7 @@ public function testGetContactsOnlyEnumerateIfPhoneBookMatchWithOwnGroupsOnly()
['core', 'shareapi_restrict_user_enumeration_to_phone', 'no', 'yes'],
['core', 'shareapi_exclude_groups', 'no', 'no'],
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'],
]);

/** @var IUser|MockObject $currentUser */
Expand Down Expand Up @@ -619,6 +623,7 @@ public function testGetContactsOnlyEnumerateIfPhoneBookOrSameGroupInOwnGroupsOnl
['core', 'shareapi_restrict_user_enumeration_to_phone', 'no', 'yes'],
['core', 'shareapi_exclude_groups', 'no', 'no'],
['core', 'shareapi_only_share_with_group_members', 'no', 'yes'],
['core', 'shareapi_only_share_with_group_members_exclude_group_list', '', '[]'],
]);

/** @var IUser|MockObject $currentUser */
Expand Down

0 comments on commit 449d28e

Please sign in to comment.