Completed
Push — master ( 158b3e...c62fa5 )
by Joas
29:53 queued 14s
created
apps/user_status/tests/Unit/Service/PredefinedStatusServiceTest.php 1 patch
Indentation   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -14,165 +14,165 @@
 block discarded – undo
14 14
 use Test\TestCase;
15 15
 
16 16
 class PredefinedStatusServiceTest extends TestCase {
17
-	protected IL10N&MockObject $l10n;
18
-	protected PredefinedStatusService $service;
19
-
20
-	protected function setUp(): void {
21
-		parent::setUp();
22
-
23
-		$this->l10n = $this->createMock(IL10N::class);
24
-
25
-		$this->service = new PredefinedStatusService($this->l10n);
26
-	}
27
-
28
-	public function testGetDefaultStatuses(): void {
29
-		$this->l10n->expects($this->exactly(7))
30
-			->method('t')
31
-			->willReturnCallback(function ($text, $parameters = []) {
32
-				return vsprintf($text, $parameters);
33
-			});
34
-
35
-		$actual = $this->service->getDefaultStatuses();
36
-		$this->assertEquals([
37
-			[
38
-				'id' => 'meeting',
39
-				'icon' => '
Please login to merge, or discard this patch.
apps/user_status/tests/Unit/Dashboard/UserStatusWidgetTest.php 1 patch
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -20,50 +20,50 @@
 block discarded – undo
20 20
 use Test\TestCase;
21 21
 
22 22
 class UserStatusWidgetTest extends TestCase {
23
-	private IL10N&MockObject $l10n;
24
-	private IDateTimeFormatter&MockObject $dateTimeFormatter;
25
-	private IURLGenerator&MockObject $urlGenerator;
26
-	private IInitialState&MockObject $initialState;
27
-	private IUserManager&MockObject $userManager;
28
-	private IUserSession&MockObject $userSession;
29
-	private StatusService&MockObject $service;
30
-	private UserStatusWidget $widget;
23
+    private IL10N&MockObject $l10n;
24
+    private IDateTimeFormatter&MockObject $dateTimeFormatter;
25
+    private IURLGenerator&MockObject $urlGenerator;
26
+    private IInitialState&MockObject $initialState;
27
+    private IUserManager&MockObject $userManager;
28
+    private IUserSession&MockObject $userSession;
29
+    private StatusService&MockObject $service;
30
+    private UserStatusWidget $widget;
31 31
 
32
-	protected function setUp(): void {
33
-		parent::setUp();
32
+    protected function setUp(): void {
33
+        parent::setUp();
34 34
 
35
-		$this->l10n = $this->createMock(IL10N::class);
36
-		$this->dateTimeFormatter = $this->createMock(IDateTimeFormatter::class);
37
-		$this->urlGenerator = $this->createMock(IURLGenerator::class);
38
-		$this->initialState = $this->createMock(IInitialState::class);
39
-		$this->userManager = $this->createMock(IUserManager::class);
40
-		$this->userSession = $this->createMock(IUserSession::class);
41
-		$this->service = $this->createMock(StatusService::class);
35
+        $this->l10n = $this->createMock(IL10N::class);
36
+        $this->dateTimeFormatter = $this->createMock(IDateTimeFormatter::class);
37
+        $this->urlGenerator = $this->createMock(IURLGenerator::class);
38
+        $this->initialState = $this->createMock(IInitialState::class);
39
+        $this->userManager = $this->createMock(IUserManager::class);
40
+        $this->userSession = $this->createMock(IUserSession::class);
41
+        $this->service = $this->createMock(StatusService::class);
42 42
 
43
-		$this->widget = new UserStatusWidget($this->l10n, $this->dateTimeFormatter, $this->urlGenerator, $this->initialState, $this->userManager, $this->userSession, $this->service);
44
-	}
43
+        $this->widget = new UserStatusWidget($this->l10n, $this->dateTimeFormatter, $this->urlGenerator, $this->initialState, $this->userManager, $this->userSession, $this->service);
44
+    }
45 45
 
46
-	public function testGetId(): void {
47
-		$this->assertEquals('user_status', $this->widget->getId());
48
-	}
46
+    public function testGetId(): void {
47
+        $this->assertEquals('user_status', $this->widget->getId());
48
+    }
49 49
 
50
-	public function testGetTitle(): void {
51
-		$this->l10n->expects($this->exactly(1))
52
-			->method('t')
53
-			->willReturnArgument(0);
50
+    public function testGetTitle(): void {
51
+        $this->l10n->expects($this->exactly(1))
52
+            ->method('t')
53
+            ->willReturnArgument(0);
54 54
 
55
-		$this->assertEquals('Recent statuses', $this->widget->getTitle());
56
-	}
55
+        $this->assertEquals('Recent statuses', $this->widget->getTitle());
56
+    }
57 57
 
58
-	public function testGetOrder(): void {
59
-		$this->assertEquals(5, $this->widget->getOrder());
60
-	}
58
+    public function testGetOrder(): void {
59
+        $this->assertEquals(5, $this->widget->getOrder());
60
+    }
61 61
 
62
-	public function testGetIconClass(): void {
63
-		$this->assertEquals('icon-user-status-dark', $this->widget->getIconClass());
64
-	}
62
+    public function testGetIconClass(): void {
63
+        $this->assertEquals('icon-user-status-dark', $this->widget->getIconClass());
64
+    }
65 65
 
66
-	public function testGetUrl(): void {
67
-		$this->assertNull($this->widget->getUrl());
68
-	}
66
+    public function testGetUrl(): void {
67
+        $this->assertNull($this->widget->getUrl());
68
+    }
69 69
 }
Please login to merge, or discard this patch.
apps/user_status/tests/Unit/Listener/UserDeletedListenerTest.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -17,35 +17,35 @@
 block discarded – undo
17 17
 use Test\TestCase;
18 18
 
19 19
 class UserDeletedListenerTest extends TestCase {
20
-	private StatusService&MockObject $service;
21
-	private UserDeletedListener $listener;
20
+    private StatusService&MockObject $service;
21
+    private UserDeletedListener $listener;
22 22
 
23
-	protected function setUp(): void {
24
-		parent::setUp();
23
+    protected function setUp(): void {
24
+        parent::setUp();
25 25
 
26
-		$this->service = $this->createMock(StatusService::class);
27
-		$this->listener = new UserDeletedListener($this->service);
28
-	}
26
+        $this->service = $this->createMock(StatusService::class);
27
+        $this->listener = new UserDeletedListener($this->service);
28
+    }
29 29
 
30
-	public function testHandleWithCorrectEvent(): void {
31
-		$user = $this->createMock(IUser::class);
32
-		$user->expects($this->once())
33
-			->method('getUID')
34
-			->willReturn('john.doe');
30
+    public function testHandleWithCorrectEvent(): void {
31
+        $user = $this->createMock(IUser::class);
32
+        $user->expects($this->once())
33
+            ->method('getUID')
34
+            ->willReturn('john.doe');
35 35
 
36
-		$this->service->expects($this->once())
37
-			->method('removeUserStatus')
38
-			->with('john.doe');
36
+        $this->service->expects($this->once())
37
+            ->method('removeUserStatus')
38
+            ->with('john.doe');
39 39
 
40
-		$event = new UserDeletedEvent($user);
41
-		$this->listener->handle($event);
42
-	}
40
+        $event = new UserDeletedEvent($user);
41
+        $this->listener->handle($event);
42
+    }
43 43
 
44
-	public function testHandleWithWrongEvent(): void {
45
-		$this->service->expects($this->never())
46
-			->method('removeUserStatus');
44
+    public function testHandleWithWrongEvent(): void {
45
+        $this->service->expects($this->never())
46
+            ->method('removeUserStatus');
47 47
 
48
-		$event = new GenericEvent();
49
-		$this->listener->handle($event);
50
-	}
48
+        $event = new GenericEvent();
49
+        $this->listener->handle($event);
50
+    }
51 51
 }
Please login to merge, or discard this patch.
apps/user_status/tests/Unit/Listener/UserLiveStatusListenerTest.php 2 patches
Indentation   +125 added lines, -125 removed lines patch added patch discarded remove patch
@@ -23,129 +23,129 @@
 block discarded – undo
23 23
 use Test\TestCase;
24 24
 
25 25
 class UserLiveStatusListenerTest extends TestCase {
26
-	private UserStatusMapper&MockObject $mapper;
27
-	private StatusService&MockObject $statusService;
28
-	private ITimeFactory&MockObject $timeFactory;
29
-	private CalendarStatusService&MockObject $calendarStatusService;
30
-
31
-	private LoggerInterface&MockObject $logger;
32
-	private UserLiveStatusListener $listener;
33
-
34
-	protected function setUp(): void {
35
-		parent::setUp();
36
-
37
-		$this->mapper = $this->createMock(UserStatusMapper::class);
38
-		$this->statusService = $this->createMock(StatusService::class);
39
-		$this->timeFactory = $this->createMock(ITimeFactory::class);
40
-		$this->calendarStatusService = $this->createMock(CalendarStatusService::class);
41
-		$this->logger = $this->createMock(LoggerInterface::class);
42
-
43
-		$this->listener = new UserLiveStatusListener(
44
-			$this->mapper,
45
-			$this->statusService,
46
-			$this->timeFactory,
47
-			$this->calendarStatusService,
48
-			$this->logger,
49
-		);
50
-	}
51
-
52
-	/**
53
-	 * @dataProvider handleEventWithCorrectEventDataProvider
54
-	 */
55
-	public function testHandleWithCorrectEvent(
56
-		string $userId,
57
-		string $previousStatus,
58
-		int $previousTimestamp,
59
-		bool $previousIsUserDefined,
60
-		string $eventStatus,
61
-		int $eventTimestamp,
62
-		bool $expectExisting,
63
-		bool $expectUpdate,
64
-	): void {
65
-		$userStatus = new UserStatus();
66
-
67
-		if ($expectExisting) {
68
-			$userStatus->setId(42);
69
-			$userStatus->setUserId($userId);
70
-			$userStatus->setStatus($previousStatus);
71
-			$userStatus->setStatusTimestamp($previousTimestamp);
72
-			$userStatus->setIsUserDefined($previousIsUserDefined);
73
-
74
-			$this->statusService->expects($this->once())
75
-				->method('findByUserId')
76
-				->with($userId)
77
-				->willReturn($userStatus);
78
-		} else {
79
-			$this->statusService->expects($this->once())
80
-				->method('findByUserId')
81
-				->with($userId)
82
-				->willThrowException(new DoesNotExistException(''));
83
-		}
84
-
85
-		$user = $this->createMock(IUser::class);
86
-		$user->method('getUID')->willReturn($userId);
87
-		$event = new UserLiveStatusEvent($user, $eventStatus, $eventTimestamp);
88
-
89
-		$this->timeFactory->expects($this->atMost(1))
90
-			->method('getTime')
91
-			->willReturn(5000);
92
-
93
-		if ($expectUpdate) {
94
-			if ($expectExisting) {
95
-				$this->mapper->expects($this->never())
96
-					->method('insert');
97
-				$this->mapper->expects($this->once())
98
-					->method('update')
99
-					->with($this->callback(function ($userStatus) use ($eventStatus, $eventTimestamp) {
100
-						$this->assertEquals($eventStatus, $userStatus->getStatus());
101
-						$this->assertEquals($eventTimestamp, $userStatus->getStatusTimestamp());
102
-						$this->assertFalse($userStatus->getIsUserDefined());
103
-
104
-						return true;
105
-					}));
106
-			} else {
107
-				$this->mapper->expects($this->once())
108
-					->method('insert')
109
-					->with($this->callback(function ($userStatus) use ($eventStatus, $eventTimestamp) {
110
-						$this->assertEquals($eventStatus, $userStatus->getStatus());
111
-						$this->assertEquals($eventTimestamp, $userStatus->getStatusTimestamp());
112
-						$this->assertFalse($userStatus->getIsUserDefined());
113
-
114
-						return true;
115
-					}));
116
-				$this->mapper->expects($this->never())
117
-					->method('update');
118
-			}
119
-
120
-			$this->listener->handle($event);
121
-		} else {
122
-			$this->mapper->expects($this->never())
123
-				->method('insert');
124
-			$this->mapper->expects($this->never())
125
-				->method('update');
126
-
127
-			$this->listener->handle($event);
128
-		}
129
-	}
130
-
131
-	public static function handleEventWithCorrectEventDataProvider(): array {
132
-		return [
133
-			['john.doe', 'offline', 0, false, 'online', 5000, true, true],
134
-			['john.doe', 'offline', 0, false, 'online', 5000, false, true],
135
-			['john.doe', 'online', 5000, false, 'online', 5000, true, false],
136
-			['john.doe', 'online', 5000, false, 'online', 5000, false, true],
137
-			['john.doe', 'away', 5000, false, 'online', 5000, true, true],
138
-			['john.doe', 'online', 5000, false, 'away', 5000, true, false],
139
-			['john.doe', 'away', 5000, true, 'online', 5000, true, false],
140
-			['john.doe', 'online', 5000, true, 'away', 5000, true, false],
141
-		];
142
-	}
143
-
144
-	public function testHandleWithWrongEvent(): void {
145
-		$this->mapper->expects($this->never())
146
-			->method('insertOrUpdate');
147
-
148
-		$event = new GenericEvent();
149
-		$this->listener->handle($event);
150
-	}
26
+    private UserStatusMapper&MockObject $mapper;
27
+    private StatusService&MockObject $statusService;
28
+    private ITimeFactory&MockObject $timeFactory;
29
+    private CalendarStatusService&MockObject $calendarStatusService;
30
+
31
+    private LoggerInterface&MockObject $logger;
32
+    private UserLiveStatusListener $listener;
33
+
34
+    protected function setUp(): void {
35
+        parent::setUp();
36
+
37
+        $this->mapper = $this->createMock(UserStatusMapper::class);
38
+        $this->statusService = $this->createMock(StatusService::class);
39
+        $this->timeFactory = $this->createMock(ITimeFactory::class);
40
+        $this->calendarStatusService = $this->createMock(CalendarStatusService::class);
41
+        $this->logger = $this->createMock(LoggerInterface::class);
42
+
43
+        $this->listener = new UserLiveStatusListener(
44
+            $this->mapper,
45
+            $this->statusService,
46
+            $this->timeFactory,
47
+            $this->calendarStatusService,
48
+            $this->logger,
49
+        );
50
+    }
51
+
52
+    /**
53
+     * @dataProvider handleEventWithCorrectEventDataProvider
54
+     */
55
+    public function testHandleWithCorrectEvent(
56
+        string $userId,
57
+        string $previousStatus,
58
+        int $previousTimestamp,
59
+        bool $previousIsUserDefined,
60
+        string $eventStatus,
61
+        int $eventTimestamp,
62
+        bool $expectExisting,
63
+        bool $expectUpdate,
64
+    ): void {
65
+        $userStatus = new UserStatus();
66
+
67
+        if ($expectExisting) {
68
+            $userStatus->setId(42);
69
+            $userStatus->setUserId($userId);
70
+            $userStatus->setStatus($previousStatus);
71
+            $userStatus->setStatusTimestamp($previousTimestamp);
72
+            $userStatus->setIsUserDefined($previousIsUserDefined);
73
+
74
+            $this->statusService->expects($this->once())
75
+                ->method('findByUserId')
76
+                ->with($userId)
77
+                ->willReturn($userStatus);
78
+        } else {
79
+            $this->statusService->expects($this->once())
80
+                ->method('findByUserId')
81
+                ->with($userId)
82
+                ->willThrowException(new DoesNotExistException(''));
83
+        }
84
+
85
+        $user = $this->createMock(IUser::class);
86
+        $user->method('getUID')->willReturn($userId);
87
+        $event = new UserLiveStatusEvent($user, $eventStatus, $eventTimestamp);
88
+
89
+        $this->timeFactory->expects($this->atMost(1))
90
+            ->method('getTime')
91
+            ->willReturn(5000);
92
+
93
+        if ($expectUpdate) {
94
+            if ($expectExisting) {
95
+                $this->mapper->expects($this->never())
96
+                    ->method('insert');
97
+                $this->mapper->expects($this->once())
98
+                    ->method('update')
99
+                    ->with($this->callback(function ($userStatus) use ($eventStatus, $eventTimestamp) {
100
+                        $this->assertEquals($eventStatus, $userStatus->getStatus());
101
+                        $this->assertEquals($eventTimestamp, $userStatus->getStatusTimestamp());
102
+                        $this->assertFalse($userStatus->getIsUserDefined());
103
+
104
+                        return true;
105
+                    }));
106
+            } else {
107
+                $this->mapper->expects($this->once())
108
+                    ->method('insert')
109
+                    ->with($this->callback(function ($userStatus) use ($eventStatus, $eventTimestamp) {
110
+                        $this->assertEquals($eventStatus, $userStatus->getStatus());
111
+                        $this->assertEquals($eventTimestamp, $userStatus->getStatusTimestamp());
112
+                        $this->assertFalse($userStatus->getIsUserDefined());
113
+
114
+                        return true;
115
+                    }));
116
+                $this->mapper->expects($this->never())
117
+                    ->method('update');
118
+            }
119
+
120
+            $this->listener->handle($event);
121
+        } else {
122
+            $this->mapper->expects($this->never())
123
+                ->method('insert');
124
+            $this->mapper->expects($this->never())
125
+                ->method('update');
126
+
127
+            $this->listener->handle($event);
128
+        }
129
+    }
130
+
131
+    public static function handleEventWithCorrectEventDataProvider(): array {
132
+        return [
133
+            ['john.doe', 'offline', 0, false, 'online', 5000, true, true],
134
+            ['john.doe', 'offline', 0, false, 'online', 5000, false, true],
135
+            ['john.doe', 'online', 5000, false, 'online', 5000, true, false],
136
+            ['john.doe', 'online', 5000, false, 'online', 5000, false, true],
137
+            ['john.doe', 'away', 5000, false, 'online', 5000, true, true],
138
+            ['john.doe', 'online', 5000, false, 'away', 5000, true, false],
139
+            ['john.doe', 'away', 5000, true, 'online', 5000, true, false],
140
+            ['john.doe', 'online', 5000, true, 'away', 5000, true, false],
141
+        ];
142
+    }
143
+
144
+    public function testHandleWithWrongEvent(): void {
145
+        $this->mapper->expects($this->never())
146
+            ->method('insertOrUpdate');
147
+
148
+        $event = new GenericEvent();
149
+        $this->listener->handle($event);
150
+    }
151 151
 }
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 					->method('insert');
97 97
 				$this->mapper->expects($this->once())
98 98
 					->method('update')
99
-					->with($this->callback(function ($userStatus) use ($eventStatus, $eventTimestamp) {
99
+					->with($this->callback(function($userStatus) use ($eventStatus, $eventTimestamp) {
100 100
 						$this->assertEquals($eventStatus, $userStatus->getStatus());
101 101
 						$this->assertEquals($eventTimestamp, $userStatus->getStatusTimestamp());
102 102
 						$this->assertFalse($userStatus->getIsUserDefined());
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 			} else {
107 107
 				$this->mapper->expects($this->once())
108 108
 					->method('insert')
109
-					->with($this->callback(function ($userStatus) use ($eventStatus, $eventTimestamp) {
109
+					->with($this->callback(function($userStatus) use ($eventStatus, $eventTimestamp) {
110 110
 						$this->assertEquals($eventStatus, $userStatus->getStatus());
111 111
 						$this->assertEquals($eventTimestamp, $userStatus->getStatusTimestamp());
112 112
 						$this->assertFalse($userStatus->getIsUserDefined());
Please login to merge, or discard this patch.
user_status/tests/Unit/BackgroundJob/ClearOldStatusesBackgroundJobTest.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -15,30 +15,30 @@
 block discarded – undo
15 15
 use Test\TestCase;
16 16
 
17 17
 class ClearOldStatusesBackgroundJobTest extends TestCase {
18
-	private ITimeFactory&MockObject $time;
19
-	private UserStatusMapper&MockObject $mapper;
20
-	private ClearOldStatusesBackgroundJob $job;
18
+    private ITimeFactory&MockObject $time;
19
+    private UserStatusMapper&MockObject $mapper;
20
+    private ClearOldStatusesBackgroundJob $job;
21 21
 
22
-	protected function setUp(): void {
23
-		parent::setUp();
22
+    protected function setUp(): void {
23
+        parent::setUp();
24 24
 
25
-		$this->time = $this->createMock(ITimeFactory::class);
26
-		$this->mapper = $this->createMock(UserStatusMapper::class);
25
+        $this->time = $this->createMock(ITimeFactory::class);
26
+        $this->mapper = $this->createMock(UserStatusMapper::class);
27 27
 
28
-		$this->job = new ClearOldStatusesBackgroundJob($this->time, $this->mapper);
29
-	}
28
+        $this->job = new ClearOldStatusesBackgroundJob($this->time, $this->mapper);
29
+    }
30 30
 
31
-	public function testRun(): void {
32
-		$this->mapper->expects($this->once())
33
-			->method('clearOlderThanClearAt')
34
-			->with(1337);
35
-		$this->mapper->expects($this->once())
36
-			->method('clearStatusesOlderThan')
37
-			->with(437, 1337);
31
+    public function testRun(): void {
32
+        $this->mapper->expects($this->once())
33
+            ->method('clearOlderThanClearAt')
34
+            ->with(1337);
35
+        $this->mapper->expects($this->once())
36
+            ->method('clearStatusesOlderThan')
37
+            ->with(437, 1337);
38 38
 
39
-		$this->time->method('getTime')
40
-			->willReturn(1337);
39
+        $this->time->method('getTime')
40
+            ->willReturn(1337);
41 41
 
42
-		self::invokePrivate($this->job, 'run', [[]]);
43
-	}
42
+        self::invokePrivate($this->job, 'run', [[]]);
43
+    }
44 44
 }
Please login to merge, or discard this patch.
apps/user_status/tests/Unit/CapabilitiesTest.php 1 patch
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -14,37 +14,37 @@
 block discarded – undo
14 14
 use Test\TestCase;
15 15
 
16 16
 class CapabilitiesTest extends TestCase {
17
-	private IEmojiHelper&MockObject $emojiHelper;
18
-	private Capabilities $capabilities;
19
-
20
-	protected function setUp(): void {
21
-		parent::setUp();
22
-
23
-		$this->emojiHelper = $this->createMock(IEmojiHelper::class);
24
-		$this->capabilities = new Capabilities($this->emojiHelper);
25
-	}
26
-
27
-	/**
28
-	 * @dataProvider getCapabilitiesDataProvider
29
-	 */
30
-	public function testGetCapabilities(bool $supportsEmojis): void {
31
-		$this->emojiHelper->expects($this->once())
32
-			->method('doesPlatformSupportEmoji')
33
-			->willReturn($supportsEmojis);
34
-
35
-		$this->assertEquals([
36
-			'user_status' => [
37
-				'enabled' => true,
38
-				'restore' => true,
39
-				'supports_emoji' => $supportsEmojis,
40
-			]
41
-		], $this->capabilities->getCapabilities());
42
-	}
43
-
44
-	public static function getCapabilitiesDataProvider(): array {
45
-		return [
46
-			[true],
47
-			[false],
48
-		];
49
-	}
17
+    private IEmojiHelper&MockObject $emojiHelper;
18
+    private Capabilities $capabilities;
19
+
20
+    protected function setUp(): void {
21
+        parent::setUp();
22
+
23
+        $this->emojiHelper = $this->createMock(IEmojiHelper::class);
24
+        $this->capabilities = new Capabilities($this->emojiHelper);
25
+    }
26
+
27
+    /**
28
+     * @dataProvider getCapabilitiesDataProvider
29
+     */
30
+    public function testGetCapabilities(bool $supportsEmojis): void {
31
+        $this->emojiHelper->expects($this->once())
32
+            ->method('doesPlatformSupportEmoji')
33
+            ->willReturn($supportsEmojis);
34
+
35
+        $this->assertEquals([
36
+            'user_status' => [
37
+                'enabled' => true,
38
+                'restore' => true,
39
+                'supports_emoji' => $supportsEmojis,
40
+            ]
41
+        ], $this->capabilities->getCapabilities());
42
+    }
43
+
44
+    public static function getCapabilitiesDataProvider(): array {
45
+        return [
46
+            [true],
47
+            [false],
48
+        ];
49
+    }
50 50
 }
Please login to merge, or discard this patch.
apps/files_external/tests/Storage/SmbTest.php 1 patch
Indentation   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -20,155 +20,155 @@
 block discarded – undo
20 20
  * @package OCA\Files_External\Tests\Storage
21 21
  */
22 22
 class SmbTest extends \Test\Files\Storage\Storage {
23
-	/**
24
-	 * @var SMB instance
25
-	 */
26
-	protected $instance;
27
-
28
-	protected function setUp(): void {
29
-		parent::setUp();
30
-
31
-		$id = $this->getUniqueID();
32
-		$config = include('files_external/tests/config.smb.php');
33
-		if (!is_array($config) or !$config['run']) {
34
-			$this->markTestSkipped('Samba backend not configured');
35
-		}
36
-		if (substr($config['root'], -1, 1) != '/') {
37
-			$config['root'] .= '/';
38
-		}
39
-		$config['root'] .= $id; //make sure we have an new empty folder to work in
40
-		$this->instance = new SMB($config);
41
-		$this->instance->mkdir('/');
42
-	}
43
-
44
-	protected function tearDown(): void {
45
-		if ($this->instance) {
46
-			$this->instance->rmdir('');
47
-		}
48
-
49
-		parent::tearDown();
50
-	}
51
-
52
-	public static function directoryProvider(): array {
53
-		// doesn't support leading/trailing spaces
54
-		return [['folder']];
55
-	}
56
-
57
-	public function testRenameWithSpaces(): void {
58
-		$this->instance->mkdir('with spaces');
59
-		$result = $this->instance->rename('with spaces', 'foo bar');
60
-		$this->assertTrue($result);
61
-		$this->assertTrue($this->instance->is_dir('foo bar'));
62
-	}
63
-
64
-	public function testStorageId(): void {
65
-		$this->instance = new SMB([
66
-			'host' => 'testhost',
67
-			'user' => 'testuser',
68
-			'password' => 'somepass',
69
-			'share' => 'someshare',
70
-			'root' => 'someroot',
71
-		]);
72
-		$this->assertEquals('smb::testuser@testhost//someshare//someroot/', $this->instance->getId());
73
-		$this->instance = null;
74
-	}
75
-
76
-	public function testNotifyGetChanges(): void {
77
-		$lastError = null;
78
-		for ($i = 0; $i < 5; $i++) {
79
-			try {
80
-				$this->tryTestNotifyGetChanges();
81
-				return;
82
-			} catch (ExpectationFailedException $e) {
83
-				$lastError = $e;
84
-				$this->tearDown();
85
-				$this->setUp();
86
-				sleep(1);
87
-			}
88
-		}
89
-		throw $lastError;
90
-	}
91
-
92
-	private function tryTestNotifyGetChanges(): void {
93
-		$notifyHandler = $this->instance->notify('');
94
-		sleep(1); //give time for the notify to start
95
-		$this->instance->file_put_contents('/newfile.txt', 'test content');
96
-		sleep(1);
97
-		$this->instance->rename('/newfile.txt', 'renamed.txt');
98
-		sleep(1);
99
-		$this->instance->unlink('/renamed.txt');
100
-		sleep(1); //time for all changes to be processed
101
-
102
-		/** @var IChange[] $changes */
103
-		$changes = [];
104
-		$count = 0;
105
-		// wait up to 10 seconds for incoming changes
106
-		while (count($changes) < 3 && $count < 10) {
107
-			$changes = array_merge($changes, $notifyHandler->getChanges());
108
-			$count++;
109
-			sleep(1);
110
-		}
111
-		$notifyHandler->stop();
112
-
113
-		// depending on the server environment, the initial create might be detected as a change instead
114
-		if ($changes[0]->getType() === IChange::MODIFIED) {
115
-			$expected = [
116
-				new Change(IChange::MODIFIED, 'newfile.txt'),
117
-				new RenameChange(IChange::RENAMED, 'newfile.txt', 'renamed.txt'),
118
-				new Change(IChange::REMOVED, 'renamed.txt')
119
-			];
120
-		} else {
121
-			$expected = [
122
-				new Change(IChange::ADDED, 'newfile.txt'),
123
-				new RenameChange(IChange::RENAMED, 'newfile.txt', 'renamed.txt'),
124
-				new Change(IChange::REMOVED, 'renamed.txt')
125
-			];
126
-		}
127
-
128
-		foreach ($expected as $expectedChange) {
129
-			$this->assertTrue(in_array($expectedChange, $changes), "Expected changes are:\n" . print_r($expected, true) . PHP_EOL . 'Expected to find: ' . PHP_EOL . print_r($expectedChange, true) . "\nGot:\n" . print_r($changes, true));
130
-		}
131
-	}
132
-
133
-	public function testNotifyListen(): void {
134
-		$notifyHandler = $this->instance->notify('');
135
-		usleep(100 * 1000); //give time for the notify to start
136
-		$this->instance->file_put_contents('/newfile.txt', 'test content');
137
-		$this->instance->unlink('/newfile.txt');
138
-		usleep(100 * 1000); //time for all changes to be processed
139
-
140
-		$result = null;
141
-
142
-		// since the notify handler buffers until we start listening we will get the above changes
143
-		$notifyHandler->listen(function (IChange $change) use (&$result) {
144
-			$result = $change;
145
-			return false;//stop listening
146
-		});
147
-
148
-		// depending on the server environment, the initial create might be detected as a change instead
149
-		if ($result->getType() === IChange::ADDED) {
150
-			$this->assertEquals(new Change(IChange::ADDED, 'newfile.txt'), $result);
151
-		} else {
152
-			$this->assertEquals(new Change(IChange::MODIFIED, 'newfile.txt'), $result);
153
-		}
154
-	}
155
-
156
-	public function testRenameRoot(): void {
157
-		// root can't be renamed
158
-		$this->assertFalse($this->instance->rename('', 'foo1'));
159
-
160
-		$this->instance->mkdir('foo2');
161
-		$this->assertFalse($this->instance->rename('foo2', ''));
162
-		$this->instance->rmdir('foo2');
163
-	}
164
-
165
-	public function testUnlinkRoot(): void {
166
-		// root can't be deleted
167
-		$this->assertFalse($this->instance->unlink(''));
168
-	}
169
-
170
-	public function testRmdirRoot(): void {
171
-		// root can't be deleted
172
-		$this->assertFalse($this->instance->rmdir(''));
173
-	}
23
+    /**
24
+     * @var SMB instance
25
+     */
26
+    protected $instance;
27
+
28
+    protected function setUp(): void {
29
+        parent::setUp();
30
+
31
+        $id = $this->getUniqueID();
32
+        $config = include('files_external/tests/config.smb.php');
33
+        if (!is_array($config) or !$config['run']) {
34
+            $this->markTestSkipped('Samba backend not configured');
35
+        }
36
+        if (substr($config['root'], -1, 1) != '/') {
37
+            $config['root'] .= '/';
38
+        }
39
+        $config['root'] .= $id; //make sure we have an new empty folder to work in
40
+        $this->instance = new SMB($config);
41
+        $this->instance->mkdir('/');
42
+    }
43
+
44
+    protected function tearDown(): void {
45
+        if ($this->instance) {
46
+            $this->instance->rmdir('');
47
+        }
48
+
49
+        parent::tearDown();
50
+    }
51
+
52
+    public static function directoryProvider(): array {
53
+        // doesn't support leading/trailing spaces
54
+        return [['folder']];
55
+    }
56
+
57
+    public function testRenameWithSpaces(): void {
58
+        $this->instance->mkdir('with spaces');
59
+        $result = $this->instance->rename('with spaces', 'foo bar');
60
+        $this->assertTrue($result);
61
+        $this->assertTrue($this->instance->is_dir('foo bar'));
62
+    }
63
+
64
+    public function testStorageId(): void {
65
+        $this->instance = new SMB([
66
+            'host' => 'testhost',
67
+            'user' => 'testuser',
68
+            'password' => 'somepass',
69
+            'share' => 'someshare',
70
+            'root' => 'someroot',
71
+        ]);
72
+        $this->assertEquals('smb::testuser@testhost//someshare//someroot/', $this->instance->getId());
73
+        $this->instance = null;
74
+    }
75
+
76
+    public function testNotifyGetChanges(): void {
77
+        $lastError = null;
78
+        for ($i = 0; $i < 5; $i++) {
79
+            try {
80
+                $this->tryTestNotifyGetChanges();
81
+                return;
82
+            } catch (ExpectationFailedException $e) {
83
+                $lastError = $e;
84
+                $this->tearDown();
85
+                $this->setUp();
86
+                sleep(1);
87
+            }
88
+        }
89
+        throw $lastError;
90
+    }
91
+
92
+    private function tryTestNotifyGetChanges(): void {
93
+        $notifyHandler = $this->instance->notify('');
94
+        sleep(1); //give time for the notify to start
95
+        $this->instance->file_put_contents('/newfile.txt', 'test content');
96
+        sleep(1);
97
+        $this->instance->rename('/newfile.txt', 'renamed.txt');
98
+        sleep(1);
99
+        $this->instance->unlink('/renamed.txt');
100
+        sleep(1); //time for all changes to be processed
101
+
102
+        /** @var IChange[] $changes */
103
+        $changes = [];
104
+        $count = 0;
105
+        // wait up to 10 seconds for incoming changes
106
+        while (count($changes) < 3 && $count < 10) {
107
+            $changes = array_merge($changes, $notifyHandler->getChanges());
108
+            $count++;
109
+            sleep(1);
110
+        }
111
+        $notifyHandler->stop();
112
+
113
+        // depending on the server environment, the initial create might be detected as a change instead
114
+        if ($changes[0]->getType() === IChange::MODIFIED) {
115
+            $expected = [
116
+                new Change(IChange::MODIFIED, 'newfile.txt'),
117
+                new RenameChange(IChange::RENAMED, 'newfile.txt', 'renamed.txt'),
118
+                new Change(IChange::REMOVED, 'renamed.txt')
119
+            ];
120
+        } else {
121
+            $expected = [
122
+                new Change(IChange::ADDED, 'newfile.txt'),
123
+                new RenameChange(IChange::RENAMED, 'newfile.txt', 'renamed.txt'),
124
+                new Change(IChange::REMOVED, 'renamed.txt')
125
+            ];
126
+        }
127
+
128
+        foreach ($expected as $expectedChange) {
129
+            $this->assertTrue(in_array($expectedChange, $changes), "Expected changes are:\n" . print_r($expected, true) . PHP_EOL . 'Expected to find: ' . PHP_EOL . print_r($expectedChange, true) . "\nGot:\n" . print_r($changes, true));
130
+        }
131
+    }
132
+
133
+    public function testNotifyListen(): void {
134
+        $notifyHandler = $this->instance->notify('');
135
+        usleep(100 * 1000); //give time for the notify to start
136
+        $this->instance->file_put_contents('/newfile.txt', 'test content');
137
+        $this->instance->unlink('/newfile.txt');
138
+        usleep(100 * 1000); //time for all changes to be processed
139
+
140
+        $result = null;
141
+
142
+        // since the notify handler buffers until we start listening we will get the above changes
143
+        $notifyHandler->listen(function (IChange $change) use (&$result) {
144
+            $result = $change;
145
+            return false;//stop listening
146
+        });
147
+
148
+        // depending on the server environment, the initial create might be detected as a change instead
149
+        if ($result->getType() === IChange::ADDED) {
150
+            $this->assertEquals(new Change(IChange::ADDED, 'newfile.txt'), $result);
151
+        } else {
152
+            $this->assertEquals(new Change(IChange::MODIFIED, 'newfile.txt'), $result);
153
+        }
154
+    }
155
+
156
+    public function testRenameRoot(): void {
157
+        // root can't be renamed
158
+        $this->assertFalse($this->instance->rename('', 'foo1'));
159
+
160
+        $this->instance->mkdir('foo2');
161
+        $this->assertFalse($this->instance->rename('foo2', ''));
162
+        $this->instance->rmdir('foo2');
163
+    }
164
+
165
+    public function testUnlinkRoot(): void {
166
+        // root can't be deleted
167
+        $this->assertFalse($this->instance->unlink(''));
168
+    }
169
+
170
+    public function testRmdirRoot(): void {
171
+        // root can't be deleted
172
+        $this->assertFalse($this->instance->rmdir(''));
173
+    }
174 174
 }
Please login to merge, or discard this patch.
apps/files_external/tests/Storage/FtpTest.php 2 patches
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -16,73 +16,73 @@
 block discarded – undo
16 16
  * @package OCA\Files_External\Tests\Storage
17 17
  */
18 18
 class FtpTest extends \Test\Files\Storage\Storage {
19
-	private $config;
19
+    private $config;
20 20
 
21
-	protected function setUp(): void {
22
-		parent::setUp();
21
+    protected function setUp(): void {
22
+        parent::setUp();
23 23
 
24
-		$id = $this->getUniqueID();
25
-		$this->config = include('files_external/tests/config.ftp.php');
26
-		if (! is_array($this->config) or ! $this->config['run']) {
27
-			$this->markTestSkipped('FTP backend not configured');
28
-		}
29
-		$rootInstance = new FTP($this->config);
30
-		$rootInstance->mkdir($id);
24
+        $id = $this->getUniqueID();
25
+        $this->config = include('files_external/tests/config.ftp.php');
26
+        if (! is_array($this->config) or ! $this->config['run']) {
27
+            $this->markTestSkipped('FTP backend not configured');
28
+        }
29
+        $rootInstance = new FTP($this->config);
30
+        $rootInstance->mkdir($id);
31 31
 
32
-		$this->config['root'] .= '/' . $id; //make sure we have an new empty folder to work in
33
-		$this->instance = new FTP($this->config);
34
-	}
32
+        $this->config['root'] .= '/' . $id; //make sure we have an new empty folder to work in
33
+        $this->instance = new FTP($this->config);
34
+    }
35 35
 
36
-	protected function tearDown(): void {
37
-		if ($this->instance) {
38
-			$this->instance->rmdir('');
39
-		}
40
-		$this->instance = null;
36
+    protected function tearDown(): void {
37
+        if ($this->instance) {
38
+            $this->instance->rmdir('');
39
+        }
40
+        $this->instance = null;
41 41
 
42
-		parent::tearDown();
43
-	}
42
+        parent::tearDown();
43
+    }
44 44
 
45
-	/**
46
-	 * ftp has no proper way to handle spaces at the end of file names
47
-	 */
48
-	public static function directoryProvider(): array {
49
-		return array_filter(parent::directoryProvider(), function ($item) {
50
-			return substr($item[0], -1) !== ' ';
51
-		});
52
-	}
45
+    /**
46
+     * ftp has no proper way to handle spaces at the end of file names
47
+     */
48
+    public static function directoryProvider(): array {
49
+        return array_filter(parent::directoryProvider(), function ($item) {
50
+            return substr($item[0], -1) !== ' ';
51
+        });
52
+    }
53 53
 
54 54
 
55
-	/**
56
-	 * mtime for folders is only with a minute resolution
57
-	 */
58
-	public function testStat(): void {
59
-		$textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
60
-		$ctimeStart = time();
61
-		$this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile));
62
-		$this->assertTrue($this->instance->isReadable('/lorem.txt'));
63
-		$ctimeEnd = time();
64
-		$mTime = $this->instance->filemtime('/lorem.txt');
65
-		$this->assertTrue($this->instance->hasUpdated('/lorem.txt', $ctimeStart - 5));
66
-		$this->assertTrue($this->instance->hasUpdated('/', $ctimeStart - 61));
55
+    /**
56
+     * mtime for folders is only with a minute resolution
57
+     */
58
+    public function testStat(): void {
59
+        $textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
60
+        $ctimeStart = time();
61
+        $this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile));
62
+        $this->assertTrue($this->instance->isReadable('/lorem.txt'));
63
+        $ctimeEnd = time();
64
+        $mTime = $this->instance->filemtime('/lorem.txt');
65
+        $this->assertTrue($this->instance->hasUpdated('/lorem.txt', $ctimeStart - 5));
66
+        $this->assertTrue($this->instance->hasUpdated('/', $ctimeStart - 61));
67 67
 
68
-		// check that ($ctimeStart - 5) <= $mTime <= ($ctimeEnd + 1)
69
-		$this->assertGreaterThanOrEqual(($ctimeStart - 5), $mTime);
70
-		$this->assertLessThanOrEqual(($ctimeEnd + 1), $mTime);
71
-		$this->assertEquals(filesize($textFile), $this->instance->filesize('/lorem.txt'));
68
+        // check that ($ctimeStart - 5) <= $mTime <= ($ctimeEnd + 1)
69
+        $this->assertGreaterThanOrEqual(($ctimeStart - 5), $mTime);
70
+        $this->assertLessThanOrEqual(($ctimeEnd + 1), $mTime);
71
+        $this->assertEquals(filesize($textFile), $this->instance->filesize('/lorem.txt'));
72 72
 
73
-		$stat = $this->instance->stat('/lorem.txt');
74
-		//only size and mtime are required in the result
75
-		$this->assertEquals($stat['size'], $this->instance->filesize('/lorem.txt'));
76
-		$this->assertEquals($stat['mtime'], $mTime);
73
+        $stat = $this->instance->stat('/lorem.txt');
74
+        //only size and mtime are required in the result
75
+        $this->assertEquals($stat['size'], $this->instance->filesize('/lorem.txt'));
76
+        $this->assertEquals($stat['mtime'], $mTime);
77 77
 
78
-		if ($this->instance->touch('/lorem.txt', 100) !== false) {
79
-			$mTime = $this->instance->filemtime('/lorem.txt');
80
-			$this->assertEquals($mTime, 100);
81
-		}
78
+        if ($this->instance->touch('/lorem.txt', 100) !== false) {
79
+            $mTime = $this->instance->filemtime('/lorem.txt');
80
+            $this->assertEquals($mTime, 100);
81
+        }
82 82
 
83
-		$mtimeStart = time();
83
+        $mtimeStart = time();
84 84
 
85
-		$this->instance->unlink('/lorem.txt');
86
-		$this->assertTrue($this->instance->hasUpdated('/', $mtimeStart - 61));
87
-	}
85
+        $this->instance->unlink('/lorem.txt');
86
+        $this->assertTrue($this->instance->hasUpdated('/', $mtimeStart - 61));
87
+    }
88 88
 }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -23,13 +23,13 @@  discard block
 block discarded – undo
23 23
 
24 24
 		$id = $this->getUniqueID();
25 25
 		$this->config = include('files_external/tests/config.ftp.php');
26
-		if (! is_array($this->config) or ! $this->config['run']) {
26
+		if (!is_array($this->config) or !$this->config['run']) {
27 27
 			$this->markTestSkipped('FTP backend not configured');
28 28
 		}
29 29
 		$rootInstance = new FTP($this->config);
30 30
 		$rootInstance->mkdir($id);
31 31
 
32
-		$this->config['root'] .= '/' . $id; //make sure we have an new empty folder to work in
32
+		$this->config['root'] .= '/'.$id; //make sure we have an new empty folder to work in
33 33
 		$this->instance = new FTP($this->config);
34 34
 	}
35 35
 
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 	 * ftp has no proper way to handle spaces at the end of file names
47 47
 	 */
48 48
 	public static function directoryProvider(): array {
49
-		return array_filter(parent::directoryProvider(), function ($item) {
49
+		return array_filter(parent::directoryProvider(), function($item) {
50 50
 			return substr($item[0], -1) !== ' ';
51 51
 		});
52 52
 	}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * mtime for folders is only with a minute resolution
57 57
 	 */
58 58
 	public function testStat(): void {
59
-		$textFile = \OC::$SERVERROOT . '/tests/data/lorem.txt';
59
+		$textFile = \OC::$SERVERROOT.'/tests/data/lorem.txt';
60 60
 		$ctimeStart = time();
61 61
 		$this->instance->file_put_contents('/lorem.txt', file_get_contents($textFile));
62 62
 		$this->assertTrue($this->instance->isReadable('/lorem.txt'));
Please login to merge, or discard this patch.
tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php 1 patch
Indentation   +59 added lines, -59 removed lines patch added patch discarded remove patch
@@ -10,71 +10,71 @@
 block discarded – undo
10 10
 use Test\TestCase;
11 11
 
12 12
 class ExcludeFileByNameFilterIteratorTest extends TestCase {
13
-	/** @var ExcludeFileByNameFilterIterator|\PHPUnit\Framework\MockObject\MockObject */
14
-	protected $filter;
13
+    /** @var ExcludeFileByNameFilterIterator|\PHPUnit\Framework\MockObject\MockObject */
14
+    protected $filter;
15 15
 
16
-	protected function setUp(): void {
17
-		parent::setUp();
18
-		$this->filter = $this->getMockBuilder(ExcludeFileByNameFilterIterator::class)
19
-			->disableOriginalConstructor()
20
-			->onlyMethods(['current'])
21
-			->getMock();
22
-	}
16
+    protected function setUp(): void {
17
+        parent::setUp();
18
+        $this->filter = $this->getMockBuilder(ExcludeFileByNameFilterIterator::class)
19
+            ->disableOriginalConstructor()
20
+            ->onlyMethods(['current'])
21
+            ->getMock();
22
+    }
23 23
 
24
-	public static function fileNameProvider(): array {
25
-		return [
26
-			['a file', true],
27
-			['Thumbs.db', false],
28
-			['another file', true],
29
-			['.directory', false],
30
-			['.webapp-nextcloud-15.0.2', false],
31
-			['.webapp-nextcloud-14.0.5-r3', false],
32
-			['wx.webapp-nextcloud-obee', true],
33
-			['.rnd', false],
34
-		];
35
-	}
24
+    public static function fileNameProvider(): array {
25
+        return [
26
+            ['a file', true],
27
+            ['Thumbs.db', false],
28
+            ['another file', true],
29
+            ['.directory', false],
30
+            ['.webapp-nextcloud-15.0.2', false],
31
+            ['.webapp-nextcloud-14.0.5-r3', false],
32
+            ['wx.webapp-nextcloud-obee', true],
33
+            ['.rnd', false],
34
+        ];
35
+    }
36 36
 
37
-	/**
38
-	 * @dataProvider fileNameProvider
39
-	 * @param string $fileName
40
-	 * @param bool $expectedResult
41
-	 */
42
-	public function testAcceptForFiles($fileName, $expectedResult): void {
43
-		$iteratorMock = $this->getMockBuilder(\RecursiveDirectoryIterator::class)
44
-			->disableOriginalConstructor()
45
-			->onlyMethods(['getFilename', 'isDir'])
46
-			->getMock();
37
+    /**
38
+     * @dataProvider fileNameProvider
39
+     * @param string $fileName
40
+     * @param bool $expectedResult
41
+     */
42
+    public function testAcceptForFiles($fileName, $expectedResult): void {
43
+        $iteratorMock = $this->getMockBuilder(\RecursiveDirectoryIterator::class)
44
+            ->disableOriginalConstructor()
45
+            ->onlyMethods(['getFilename', 'isDir'])
46
+            ->getMock();
47 47
 
48
-		$iteratorMock->method('getFilename')
49
-			->willReturn($fileName);
50
-		$iteratorMock->method('isDir')
51
-			->willReturn(false);
52
-		$this->filter->method('current')
53
-			->willReturn($iteratorMock);
48
+        $iteratorMock->method('getFilename')
49
+            ->willReturn($fileName);
50
+        $iteratorMock->method('isDir')
51
+            ->willReturn(false);
52
+        $this->filter->method('current')
53
+            ->willReturn($iteratorMock);
54 54
 
55
-		$actualResult = $this->filter->accept();
56
-		$this->assertEquals($expectedResult, $actualResult);
57
-	}
55
+        $actualResult = $this->filter->accept();
56
+        $this->assertEquals($expectedResult, $actualResult);
57
+    }
58 58
 
59
-	/**
60
-	 * @dataProvider fileNameProvider
61
-	 * @param string $fileName
62
-	 * @param bool $expectedResult
63
-	 */
64
-	public function testAcceptForDirs($fileName, $expectedResult): void {
65
-		$iteratorMock = $this->getMockBuilder(\RecursiveDirectoryIterator::class)
66
-			->disableOriginalConstructor()
67
-			->onlyMethods(['getFilename', 'isDir'])
68
-			->getMock();
59
+    /**
60
+     * @dataProvider fileNameProvider
61
+     * @param string $fileName
62
+     * @param bool $expectedResult
63
+     */
64
+    public function testAcceptForDirs($fileName, $expectedResult): void {
65
+        $iteratorMock = $this->getMockBuilder(\RecursiveDirectoryIterator::class)
66
+            ->disableOriginalConstructor()
67
+            ->onlyMethods(['getFilename', 'isDir'])
68
+            ->getMock();
69 69
 
70
-		$iteratorMock->method('getFilename')
71
-			->willReturn($fileName);
72
-		$iteratorMock->method('isDir')
73
-			->willReturn(true);
74
-		$this->filter->method('current')
75
-			->willReturn($iteratorMock);
70
+        $iteratorMock->method('getFilename')
71
+            ->willReturn($fileName);
72
+        $iteratorMock->method('isDir')
73
+            ->willReturn(true);
74
+        $this->filter->method('current')
75
+            ->willReturn($iteratorMock);
76 76
 
77
-		$actualResult = $this->filter->accept();
78
-		$this->assertTrue($actualResult);
79
-	}
77
+        $actualResult = $this->filter->accept();
78
+        $this->assertTrue($actualResult);
79
+    }
80 80
 }
Please login to merge, or discard this patch.