diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-09-12 23:40:46 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-09-26 23:10:24 +0200 |
commit | 3d1d03a51175e0e52b506764bc7d96ddeae4cb65 (patch) | |
tree | 8da6d6a6fd004b6c6783223b3de21a549c947592 /apps | |
parent | c92f7ee7674541f1e899e0f5077d79907d21df4c (diff) | |
download | nextcloud-server-3d1d03a51175e0e52b506764bc7d96ddeae4cb65.tar.gz nextcloud-server-3d1d03a51175e0e52b506764bc7d96ddeae4cb65.zip |
split off getEmail tests
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php | 244 |
1 files changed, 0 insertions, 244 deletions
diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php index 7b321678908..928a151c420 100644 --- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php @@ -116,250 +116,6 @@ class ShareesAPIControllerTest extends TestCase { ); } - - /** - * @dataProvider dataGetEmail - * - * @param string $searchTerm - * @param array $contacts - * @param bool $shareeEnumeration - * @param array $expected - * @param bool $reachedEnd - */ - public function testGetEmail($searchTerm, $contacts, $shareeEnumeration, $expected, $reachedEnd) { - $this->invokePrivate($this->sharees, 'shareeEnumeration', [$shareeEnumeration]); - $this->contactsManager->expects($this->any()) - ->method('search') - ->with($searchTerm, ['EMAIL', 'FN']) - ->willReturn($contacts); - - $result = $this->invokePrivate($this->sharees, 'getEmail', [$searchTerm]); - - $this->assertEquals($expected, $result); - $this->assertCount((int) $reachedEnd, $this->invokePrivate($this->sharees, 'reachedEndFor')); - } - - public function dataGetEmail() { - return [ - ['test', [], true, ['results' => [], 'exact' => [], 'exactIdMatch' => false], true], - ['test', [], false, ['results' => [], 'exact' => [], 'exactIdMatch' => false], true], - [ - 'test@remote.com', - [], - true, - ['results' => [], 'exact' => [['label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]], 'exactIdMatch' => false], - true, - ], - [ // no valid email address - 'test@remote', - [], - true, - ['results' => [], 'exact' => [], 'exactIdMatch' => false], - true, - ], - [ - 'test@remote.com', - [], - false, - ['results' => [], 'exact' => [['label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]], 'exactIdMatch' => false], - true, - ], - [ - 'test', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'EMAIL' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'EMAIL' => [ - 'username@localhost', - ], - ], - ], - true, - ['results' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => [], 'exactIdMatch' => false], - true, - ], - [ - 'test', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'EMAIL' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'EMAIL' => [ - 'username@localhost', - ], - ], - ], - false, - ['results' => [], 'exact' => [], 'exactIdMatch' => false], - true, - ], - [ - 'test@remote.com', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'EMAIL' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'EMAIL' => [ - 'username@localhost', - ], - ], - ], - true, - ['results' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exact' => [['label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]], 'exactIdMatch' => false], - true, - ], - [ - 'test@remote.com', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'EMAIL' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'EMAIL' => [ - 'username@localhost', - ], - ], - ], - false, - ['results' => [], 'exact' => [['label' => 'test@remote.com', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'test@remote.com']]], 'exactIdMatch' => false], - true, - ], - [ - 'username@localhost', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'EMAIL' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'EMAIL' => [ - 'username@localhost', - ], - ], - ], - true, - ['results' => [], 'exact' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exactIdMatch' => true], - true, - ], - [ - 'username@localhost', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'EMAIL' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'EMAIL' => [ - 'username@localhost', - ], - ], - ], - false, - ['results' => [], 'exact' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'username@localhost']]], 'exactIdMatch' => true], - true, - ], - // contact with space - [ - 'user name@localhost', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'EMAIL' => [ - ], - ], - [ - 'FN' => 'User Name @ Localhost', - 'EMAIL' => [ - 'user name@localhost', - ], - ], - ], - false, - ['results' => [], 'exact' => [['label' => 'User Name @ Localhost (user name@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_EMAIL, 'shareWith' => 'user name@localhost']]], 'exactIdMatch' => true], - true, - ], - // remote with space, no contact - [ - 'user space@remote.com', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'EMAIL' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'EMAIL' => [ - 'username@localhost', - ], - ], - ], - false, - ['results' => [], 'exact' => [], 'exactIdMatch' => false], - true, - ], - // Local user found by email - [ - 'test@example.com', - [ - [ - 'FN' => 'User', - 'EMAIL' => ['test@example.com'], - 'CLOUD' => ['test@localhost'], - 'isLocalSystemBook' => true, - ] - ], - false, - ['results' => [], 'exact' => [], 'exactIdMatch' => true], - false, - ] - ]; - } - public function dataSearch() { $noRemote = [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_EMAIL]; $allTypes = [Share::SHARE_TYPE_USER, Share::SHARE_TYPE_GROUP, Share::SHARE_TYPE_REMOTE, Share::SHARE_TYPE_EMAIL]; |