diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-09-12 22:38:36 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2017-09-26 23:10:24 +0200 |
commit | c92f7ee7674541f1e899e0f5077d79907d21df4c (patch) | |
tree | 8642b9002ec0a1b4088895f393969338227dbbcf /apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php | |
parent | b35760de2718cbf8c9361d2192051e50ff447d43 (diff) | |
download | nextcloud-server-c92f7ee7674541f1e899e0f5077d79907d21df4c.tar.gz nextcloud-server-c92f7ee7674541f1e899e0f5077d79907d21df4c.zip |
split off getRemote unit tests
adds two small fixes → they actually work \o/
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php')
-rw-r--r-- | apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php | 220 |
1 files changed, 0 insertions, 220 deletions
diff --git a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php index f9d762d65aa..7b321678908 100644 --- a/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php +++ b/apps/files_sharing/tests/Controller/ShareesAPIControllerTest.php @@ -116,226 +116,6 @@ class ShareesAPIControllerTest extends TestCase { ); } - /** - * @dataProvider dataGetRemote - * - * @param string $searchTerm - * @param array $contacts - * @param bool $shareeEnumeration - * @param array $expected - * @param bool $reachedEnd - */ - public function testGetRemote($searchTerm, $contacts, $shareeEnumeration, $expected, $reachedEnd) { - $this->invokePrivate($this->sharees, 'shareeEnumeration', [$shareeEnumeration]); - $this->contactsManager->expects($this->any()) - ->method('search') - ->with($searchTerm, ['CLOUD', 'FN']) - ->willReturn($contacts); - - $result = $this->invokePrivate($this->sharees, 'getRemote', [$searchTerm]); - - $this->assertEquals($expected, $result); - $this->assertCount((int) $reachedEnd, $this->invokePrivate($this->sharees, 'reachedEndFor')); - } - - public function dataGetRemote() { - return [ - ['test', [], true, ['results' => [], 'exact' => [], 'exactIdMatch' => false], true], - ['test', [], false, ['results' => [], 'exact' => [], 'exactIdMatch' => false], true], - [ - 'test@remote', - [], - true, - ['results' => [], 'exact' => [['label' => 'test@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'test@remote']]], 'exactIdMatch' => false], - true, - ], - [ - 'test@remote', - [], - false, - ['results' => [], 'exact' => [['label' => 'test@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'test@remote']]], 'exactIdMatch' => false], - true, - ], - [ - 'test', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'CLOUD' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'CLOUD' => [ - 'username@localhost', - ], - ], - ], - true, - ['results' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]], 'exact' => [], 'exactIdMatch' => false], - true, - ], - [ - 'test', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'CLOUD' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'CLOUD' => [ - 'username@localhost', - ], - ], - ], - false, - ['results' => [], 'exact' => [], 'exactIdMatch' => false], - true, - ], - [ - 'test@remote', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'CLOUD' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'CLOUD' => [ - 'username@localhost', - ], - ], - ], - true, - ['results' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]], 'exact' => [['label' => 'test@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'test@remote']]], 'exactIdMatch' => false], - true, - ], - [ - 'test@remote', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'CLOUD' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'CLOUD' => [ - 'username@localhost', - ], - ], - ], - false, - ['results' => [], 'exact' => [['label' => 'test@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'test@remote']]], 'exactIdMatch' => false], - true, - ], - [ - 'username@localhost', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'CLOUD' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'CLOUD' => [ - 'username@localhost', - ], - ], - ], - true, - ['results' => [], 'exact' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]], 'exactIdMatch' => true], - true, - ], - [ - 'username@localhost', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'CLOUD' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'CLOUD' => [ - 'username@localhost', - ], - ], - ], - false, - ['results' => [], 'exact' => [['label' => 'User @ Localhost (username@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'username@localhost', 'server' => 'localhost']]], 'exactIdMatch' => true], - true, - ], - // contact with space - [ - 'user name@localhost', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'CLOUD' => [ - ], - ], - [ - 'FN' => 'User Name @ Localhost', - 'CLOUD' => [ - 'user name@localhost', - ], - ], - ], - false, - ['results' => [], 'exact' => [['label' => 'User Name @ Localhost (user name@localhost)', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'user name@localhost', 'server' => 'localhost']]], 'exactIdMatch' => true], - true, - ], - // remote with space, no contact - [ - 'user space@remote', - [ - [ - 'FN' => 'User3 @ Localhost', - ], - [ - 'FN' => 'User2 @ Localhost', - 'CLOUD' => [ - ], - ], - [ - 'FN' => 'User @ Localhost', - 'CLOUD' => [ - 'username@localhost', - ], - ], - ], - false, - ['results' => [], 'exact' => [['label' => 'user space@remote', 'value' => ['shareType' => Share::SHARE_TYPE_REMOTE, 'shareWith' => 'user space@remote']]], 'exactIdMatch' => false], - true, - ], - ]; - } /** * @dataProvider dataGetEmail |