From 1ea9062036bd0b4b1be430b16f7c9df434b0ac85 Mon Sep 17 00:00:00 2001 From: Baptiste Fotia Date: Tue, 30 Jan 2024 15:08:50 +0100 Subject: [PATCH] test(php): Fix the unit tests I added our context in the unit tests following the advice of Louis. Link : https://github.com/nextcloud/server/pull/43186#issuecomment-1916571027 Signed-off-by: Baptiste Fotia --- apps/settings/tests/Settings/Admin/SharingTest.php | 2 ++ tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/apps/settings/tests/Settings/Admin/SharingTest.php b/apps/settings/tests/Settings/Admin/SharingTest.php index 7dd4e56bcd267..2abb2db3b6f26 100644 --- a/apps/settings/tests/Settings/Admin/SharingTest.php +++ b/apps/settings/tests/Settings/Admin/SharingTest.php @@ -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); @@ -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); diff --git a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php index e3d6ea9922668..69805bf81f2e1 100644 --- a/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php +++ b/tests/lib/Contacts/ContactsMenu/ContactsStoreTest.php @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */ @@ -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 */