Skip to content

Commit ddf1e23

Browse files
committed
chore: adjust namespaces for test code
1 parent 3bff978 commit ddf1e23

8 files changed

Lines changed: 34 additions & 23 deletions

File tree

tests/Settings/Controller/SettingsPageControllerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
*/
2121

22-
namespace Test;
22+
namespace Tests\Settings\Controller;
2323

2424
use OC\Helper\LocaleHelper;
2525
use OC\Settings\Controller\SettingsPageController;
@@ -33,6 +33,7 @@
3333
use OCP\IUserSession;
3434
use OCP\L10N\IFactory;
3535
use OCP\Settings\ISettingsManager;
36+
use Test\TestCase;
3637

3738
class SettingsPageControllerTest extends TestCase {
3839
protected $settingsManager;

tests/Settings/Panels/Personal/CorsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
* along with this program. If not, see <http://www.gnu.org/licenses/>
1919
*/
2020

21-
namespace Settings\Panels\Personal;
21+
namespace Tests\Settings\Panels\Personal;
2222

2323
use OC\Settings\Panels\Personal\Cors;
2424
use OCP\IConfig;

tests/TestHelpers/Unit/DeleteHelperTest.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
*
2121
*/
2222

23+
namespace TestHelpers\Unit;
24+
25+
use PHPUnit;
2326
use TestHelpers\DeleteHelper;
2427
use GuzzleHttp\Client;
2528
use GuzzleHttp\Handler\MockHandler;
@@ -42,7 +45,7 @@ class DeleteHelperTest extends PHPUnit\Framework\TestCase {
4245
*/
4346
public function setUp(): void {
4447
$mock = new MockHandler(
45-
[ new Response(204, [])]
48+
[new Response(204, [])]
4649
);
4750
$handler = HandlerStack::create($mock);
4851
$history = Middleware::history($this->container);
@@ -56,7 +59,7 @@ public function setUp(): void {
5659
*
5760
* @return void
5861
*/
59-
public function testDeleteHelperWithOlderDavVersion():void {
62+
public function testDeleteHelperWithOlderDavVersion(): void {
6063
DeleteHelper::delete(
6164
'http://localhost',
6265
'user',
@@ -86,7 +89,7 @@ public function testDeleteHelperWithOlderDavVersion():void {
8689
*
8790
* @return void
8891
*/
89-
public function testDeleteHelperWithNewerDavVersion():void {
92+
public function testDeleteHelperWithNewerDavVersion(): void {
9093
DeleteHelper::delete(
9194
'http://localhost',
9295
'user',
@@ -116,7 +119,7 @@ public function testDeleteHelperWithNewerDavVersion():void {
116119
*
117120
* @return void
118121
*/
119-
public function testDeleteHelperSendsWithGivenHeaders():void {
122+
public function testDeleteHelperSendsWithGivenHeaders(): void {
120123
$headers = ["Cache-Control" => "no-cache"];
121124
DeleteHelper::delete(
122125
'http://localhost',

tests/TestHelpers/Unit/WebDavHelperTest.php

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
*
2121
*/
2222

23+
namespace TestHelpers\Unit;
24+
25+
use PHPUnit;
2326
use TestHelpers\WebDavHelper;
2427
use GuzzleHttp\Client;
2528
use GuzzleHttp\Handler\MockHandler;
@@ -61,7 +64,7 @@ public function setUp(): void {
6164
* @return void
6265
* @throws \GuzzleHttp\Exception\GuzzleException
6366
*/
64-
public function testUrlIsSanitizedByMakeDavRequestForNewerDav():void {
67+
public function testUrlIsSanitizedByMakeDavRequestForNewerDav(): void {
6568
WebDavHelper::makeDavRequest(
6669
'http://own.cloud///core',
6770
'user1',
@@ -99,7 +102,7 @@ public function testUrlIsSanitizedByMakeDavRequestForNewerDav():void {
99102
* @return void
100103
* @throws \GuzzleHttp\Exception\GuzzleException
101104
*/
102-
public function testUrlIsSanitizedByMakeDavRequestForOlderDavPath():void {
105+
public function testUrlIsSanitizedByMakeDavRequestForOlderDavPath(): void {
103106
WebDavHelper::makeDavRequest(
104107
'http://own.cloud///core',
105108
'user1',
@@ -137,7 +140,7 @@ public function testUrlIsSanitizedByMakeDavRequestForOlderDavPath():void {
137140
* @return void
138141
* @throws \GuzzleHttp\Exception\GuzzleException
139142
*/
140-
public function testMakeDavRequestReplacesAsteriskAndHashesOnUrls():void {
143+
public function testMakeDavRequestReplacesAsteriskAndHashesOnUrls(): void {
141144
WebDavHelper::makeDavRequest(
142145
'http://own.cloud///core',
143146
'user1',
@@ -180,7 +183,7 @@ public function testMakeDavRequestReplacesAsteriskAndHashesOnUrls():void {
180183
* @return void
181184
* @throws \GuzzleHttp\Exception\GuzzleException
182185
*/
183-
public function testMakeDavRequestOnBearerAuthorization():void {
186+
public function testMakeDavRequestOnBearerAuthorization(): void {
184187
WebDavHelper::makeDavRequest(
185188
'http://own.cloud/core',
186189
'user1',
@@ -221,7 +224,7 @@ public function testMakeDavRequestOnBearerAuthorization():void {
221224
*
222225
* @return void
223226
*/
224-
public function testSanitizationOnDefault(?string $unsanitizedUrl, ?string $expectedUrl):void {
227+
public function testSanitizationOnDefault(?string $unsanitizedUrl, ?string $expectedUrl): void {
225228
$sanitizedUrl = WebDavHelper::sanitizeUrl($unsanitizedUrl);
226229
$this->assertEquals($expectedUrl, $sanitizedUrl);
227230
}
@@ -236,7 +239,7 @@ public function testSanitizationOnDefault(?string $unsanitizedUrl, ?string $expe
236239
*
237240
* @return void
238241
*/
239-
public function testSanitizationWhenTrailingSlashIsSetToFalse(?string $unsanitizedUrl, ?string $expectedUrl):void {
242+
public function testSanitizationWhenTrailingSlashIsSetToFalse(?string $unsanitizedUrl, ?string $expectedUrl): void {
240243
$sanitizedUrl = WebDavHelper::sanitizeUrl($unsanitizedUrl);
241244
$this->assertEquals($expectedUrl, $sanitizedUrl);
242245
}
@@ -251,7 +254,7 @@ public function testSanitizationWhenTrailingSlashIsSetToFalse(?string $unsanitiz
251254
*
252255
* @return void
253256
*/
254-
public function testSanitizationWhenTrailingSlashIsSetToTrue(?string $unsanitizedUrl, ?string $expectedUrl):void {
257+
public function testSanitizationWhenTrailingSlashIsSetToTrue(?string $unsanitizedUrl, ?string $expectedUrl): void {
255258
$sanitizedUrl = WebDavHelper::sanitizeUrl($unsanitizedUrl, true);
256259
$this->assertEquals($expectedUrl, $sanitizedUrl);
257260
}
@@ -261,7 +264,7 @@ public function testSanitizationWhenTrailingSlashIsSetToTrue(?string $unsanitize
261264
*
262265
* @return void
263266
*/
264-
public function testGetDavPathForOlderDavVersion():void {
267+
public function testGetDavPathForOlderDavVersion(): void {
265268
$davPath = WebDavHelper::getDavPath('user1', 1);
266269
$this->assertEquals('remote.php/webdav/', $davPath);
267270

@@ -279,7 +282,7 @@ public function testGetDavPathForOlderDavVersion():void {
279282
*
280283
* @return void
281284
*/
282-
public function testGetDavPathForNewerDavPath():void {
285+
public function testGetDavPathForNewerDavPath(): void {
283286
// `type` should be `files` by default.
284287
// check that both returns same thing.
285288
$davPath = WebDavHelper::getDavPath('user1', 2);
@@ -295,7 +298,7 @@ public function testGetDavPathForNewerDavPath():void {
295298
*
296299
* @return void
297300
*/
298-
public function testGetDavPathForNewerDavPathButNotForFiles():void {
301+
public function testGetDavPathForNewerDavPathButNotForFiles(): void {
299302
$davPath = WebDavHelper::getDavPath('user1', 2, null);
300303
$this->assertEquals('remote.php/dav', $davPath);
301304

@@ -309,7 +312,7 @@ public function testGetDavPathForNewerDavPathButNotForFiles():void {
309312
*
310313
* @return void
311314
*/
312-
public function testGetDavPathForInvalidVersionsShouldThrowException():void {
315+
public function testGetDavPathForInvalidVersionsShouldThrowException(): void {
313316
$this->expectException(InvalidArgumentException::class);
314317
$this->expectExceptionMessage("DAV path version 3 is unknown");
315318

@@ -322,7 +325,7 @@ public function testGetDavPathForInvalidVersionsShouldThrowException():void {
322325
*
323326
* @return array
324327
*/
325-
public function withoutTrailingSlashUrlsProvider():array {
328+
public function withoutTrailingSlashUrlsProvider(): array {
326329
return [
327330
['http://own.cloud/', 'http://own.cloud'],
328331
['http://own.cloud//index.php', 'http://own.cloud/index.php'],
@@ -344,7 +347,7 @@ public function withoutTrailingSlashUrlsProvider():array {
344347
*
345348
* @return string[][]
346349
*/
347-
public function withTrailingSlashUrlsProvider():array {
350+
public function withTrailingSlashUrlsProvider(): array {
348351
return [
349352
['http://own.cloud/', 'http://own.cloud/'],
350353
['http://own.cloud', 'http://own.cloud/'],

tests/lib/Preview/PDFTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
*/
2121

22-
namespace lib\Preview;
22+
namespace Test\Preview;
2323

2424
use OC\Preview\PDF;
2525
use OCP\Files\NotFoundException;

tests/lib/Share/GetUsersSharingFileTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace lib\Share;
3+
namespace Test\Share;
44

55
use OC;
66
use OC\Share\Constants;

tests/lib/User/Sync/BackendUsersIteratorTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@
1919
*
2020
*/
2121

22-
namespace OC\User\Sync;
22+
namespace Test\User\Sync;
2323

24+
use OC\User\Sync\BackendUsersIterator;
25+
use OC\User\Sync\UsersIterator;
2426
use OCP\UserInterface;
2527
use Test\TestCase;
2628

tests/lib/User/Sync/SeenUsersIteratorTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,11 @@
1919
*
2020
*/
2121

22-
namespace OC\User\Sync;
22+
namespace Test\User\Sync;
2323

2424
use OC\User\AccountMapper;
25+
use OC\User\Sync\SeenUsersIterator;
26+
use OC\User\Sync\UsersIterator;
2527
use Test\TestCase;
2628

2729
/**

0 commit comments

Comments
 (0)