aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Contacts/ContactsMenu/ManagerTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/lib/Contacts/ContactsMenu/ManagerTest.php')
-rw-r--r--tests/lib/Contacts/ContactsMenu/ManagerTest.php58
1 files changed, 19 insertions, 39 deletions
diff --git a/tests/lib/Contacts/ContactsMenu/ManagerTest.php b/tests/lib/Contacts/ContactsMenu/ManagerTest.php
index 2ea3966ad4f..dd6c634c740 100644
--- a/tests/lib/Contacts/ContactsMenu/ManagerTest.php
+++ b/tests/lib/Contacts/ContactsMenu/ManagerTest.php
@@ -1,25 +1,8 @@
<?php
/**
- * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace Tests\Contacts\ContactsMenu;
@@ -74,7 +57,7 @@ class ManagerTest extends TestCase {
return $entries;
}
- public function testGetFilteredEntries() {
+ public function testGetFilteredEntries(): void {
$filter = 'con';
$user = $this->createMock(IUser::class);
$entries = $this->generateTestEntries();
@@ -82,11 +65,10 @@ class ManagerTest extends TestCase {
$this->config->expects($this->exactly(2))
->method('getSystemValueInt')
- ->withConsecutive(
- ['sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT],
- ['sharing.minSearchStringLength', 0]
- )
- ->willReturnOnConsecutiveCalls(25, 0);
+ ->willReturnMap([
+ ['sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT, 25],
+ ['sharing.minSearchStringLength', 0, 0],
+ ]);
$this->contactsStore->expects($this->once())
->method('getContacts')
->with($user, $filter)
@@ -111,7 +93,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($expected, $data);
}
- public function testGetFilteredEntriesLimit() {
+ public function testGetFilteredEntriesLimit(): void {
$filter = 'con';
$user = $this->createMock(IUser::class);
$entries = $this->generateTestEntries();
@@ -119,11 +101,10 @@ class ManagerTest extends TestCase {
$this->config->expects($this->exactly(2))
->method('getSystemValueInt')
- ->withConsecutive(
- ['sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT],
- ['sharing.minSearchStringLength', 0]
- )
- ->willReturnOnConsecutiveCalls(3, 0);
+ ->willReturnMap([
+ ['sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT, 3],
+ ['sharing.minSearchStringLength', 0, 0],
+ ]);
$this->contactsStore->expects($this->once())
->method('getContacts')
->with($user, $filter)
@@ -148,18 +129,17 @@ class ManagerTest extends TestCase {
$this->assertEquals($expected, $data);
}
- public function testGetFilteredEntriesMinSearchStringLength() {
+ public function testGetFilteredEntriesMinSearchStringLength(): void {
$filter = 'con';
$user = $this->createMock(IUser::class);
$provider = $this->createMock(IProvider::class);
$this->config->expects($this->exactly(2))
->method('getSystemValueInt')
- ->withConsecutive(
- ['sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT],
- ['sharing.minSearchStringLength', 0]
- )
- ->willReturnOnConsecutiveCalls(3, 4);
+ ->willReturnMap([
+ ['sharing.maxAutocompleteResults', Constants::SHARING_MAX_AUTOCOMPLETE_RESULTS_DEFAULT, 3],
+ ['sharing.minSearchStringLength', 0, 4],
+ ]);
$this->appManager->expects($this->once())
->method('isEnabledForUser')
->with($this->equalTo('contacts'), $user)
@@ -174,7 +154,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($expected, $data);
}
- public function testFindOne() {
+ public function testFindOne(): void {
$shareTypeFilter = 42;
$shareWithFilter = 'foobar';
@@ -197,7 +177,7 @@ class ManagerTest extends TestCase {
$this->assertEquals($entry, $data);
}
- public function testFindOne404() {
+ public function testFindOne404(): void {
$shareTypeFilter = 42;
$shareWithFilter = 'foobar';