aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/tests/ApplicationTest.php
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2022-05-25 09:55:22 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-07-28 16:53:22 +0200
commit03b1791cca3e0334637aa232d1f7c11850793646 (patch)
tree33db9b8db60a592089aaa7a4d6c04f4db4c1860f /apps/files_sharing/tests/ApplicationTest.php
parent9493f86de34e76e37c13f87aab3123a3efbfdd84 (diff)
downloadnextcloud-server-03b1791cca3e0334637aa232d1f7c11850793646.tar.gz
nextcloud-server-03b1791cca3e0334637aa232d1f7c11850793646.zip
Fix share attribute related tests + code style
Signed-off-by: Vincent Petry <vincent@nextcloud.com>
Diffstat (limited to 'apps/files_sharing/tests/ApplicationTest.php')
-rw-r--r--apps/files_sharing/tests/ApplicationTest.php19
1 files changed, 9 insertions, 10 deletions
diff --git a/apps/files_sharing/tests/ApplicationTest.php b/apps/files_sharing/tests/ApplicationTest.php
index 3f3164b233e..ee04996ac15 100644
--- a/apps/files_sharing/tests/ApplicationTest.php
+++ b/apps/files_sharing/tests/ApplicationTest.php
@@ -65,8 +65,7 @@ class ApplicationTest extends TestCase {
$this->application = new Application([]);
- // FIXME: how to mock this one ??
- $symfonyDispatcher = $this->createMock(SymfonyDispatcher::class);
+ $symfonyDispatcher = new SymfonyDispatcher();
$this->eventDispatcher = new EventDispatcher(
$symfonyDispatcher,
$this->createMock(IServerContainer::class),
@@ -133,9 +132,9 @@ class ApplicationTest extends TestCase {
*/
public function testCheckDirectCanBeDownloaded($path, $userFolder, $run) {
$user = $this->createMock(IUser::class);
- $user->method("getUID")->willReturn("test");
- $this->userSession->method("getUser")->willReturn($user);
- $this->userSession->method("isLoggedIn")->willReturn(true);
+ $user->method('getUID')->willReturn('test');
+ $this->userSession->method('getUser')->willReturn($user);
+ $this->userSession->method('isLoggedIn')->willReturn(true);
$this->rootFolder->method('getUserFolder')->willReturn($userFolder);
// Simulate direct download of file
@@ -210,11 +209,11 @@ class ApplicationTest extends TestCase {
*/
public function testCheckZipCanBeDownloaded($dir, $files, $userFolder, $run) {
$user = $this->createMock(IUser::class);
- $user->method("getUID")->willReturn("test");
- $this->userSession->method("getUser")->willReturn($user);
- $this->userSession->method("isLoggedIn")->willReturn(true);
+ $user->method('getUID')->willReturn('test');
+ $this->userSession->method('getUser')->willReturn($user);
+ $this->userSession->method('isLoggedIn')->willReturn(true);
- $this->rootFolder->method('getUserFolder')->with("test")->willReturn($userFolder);
+ $this->rootFolder->method('getUserFolder')->with('test')->willReturn($userFolder);
// Simulate zip download of folder folder
$event = new GenericEvent(null, ['dir' => $dir, 'files' => $files, 'run' => true]);
@@ -225,7 +224,7 @@ class ApplicationTest extends TestCase {
}
public function testCheckFileUserNotFound() {
- $this->userSession->method("isLoggedIn")->willReturn(false);
+ $this->userSession->method('isLoggedIn')->willReturn(false);
// Simulate zip download of folder folder
$event = new GenericEvent(null, ['dir' => '/test', 'files' => ['test.txt'], 'run' => true]);
span> * * @license AGPL-3.0 * * This code is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License, version 3, * as published by the Free Software Foundation. * * 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, version 3, * along with this program. If not, see <http://www.gnu.org/licenses/> * */ namespace OCA\User_LDAP; class WizardResult { protected $changes = array(); protected $options = array(); protected $markedChange = false; /** * @param string $key * @param mixed $value */ public function addChange($key, $value) { $this->changes[$key] = $value; } public function markChange() { $this->markedChange = true; } /** * @param string $key * @param array|string $values */ public function addOptions($key, $values) { if(!is_array($values)) { $values = array($values); } $this->options[$key] = $values; } /** * @return bool */ public function hasChanges() { return (count($this->changes) > 0 || $this->markedChange); } /** * @return array */ public function getResultArray() { $result = array(); $result['changes'] = $this->changes; if(count($this->options) > 0) { $result['options'] = $this->options; } return $result; } }