aboutsummaryrefslogtreecommitdiffstats
path: root/tests/lib/Lockdown
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2024-09-15 22:32:31 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2024-09-15 22:32:31 +0200
commit49dd79eabb2b8902559a7a4e8f8fcad54f46b604 (patch)
tree2af18db46ba463368dc4461d7436fb69577923de /tests/lib/Lockdown
parent4281ce6fa1bb8235426099d720734d2394bec203 (diff)
downloadnextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.tar.gz
nextcloud-server-49dd79eabb2b8902559a7a4e8f8fcad54f46b604.zip
refactor: Add void return type to PHPUnit test methods
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'tests/lib/Lockdown')
-rw-r--r--tests/lib/Lockdown/Filesystem/NoFSTest.php2
-rw-r--r--tests/lib/Lockdown/Filesystem/NullCacheTest.php40
-rw-r--r--tests/lib/Lockdown/Filesystem/NullStorageTest.php72
-rw-r--r--tests/lib/Lockdown/LockdownManagerTest.php6
4 files changed, 60 insertions, 60 deletions
diff --git a/tests/lib/Lockdown/Filesystem/NoFSTest.php b/tests/lib/Lockdown/Filesystem/NoFSTest.php
index 7a636fbaaaa..dedcf580992 100644
--- a/tests/lib/Lockdown/Filesystem/NoFSTest.php
+++ b/tests/lib/Lockdown/Filesystem/NoFSTest.php
@@ -38,7 +38,7 @@ class NoFSTest extends \Test\TestCase {
$this->createUser('foo', 'var');
}
- public function testSetupFS() {
+ public function testSetupFS(): void {
\OC_Util::tearDownFS();
\OC_Util::setupFS('foo');
diff --git a/tests/lib/Lockdown/Filesystem/NullCacheTest.php b/tests/lib/Lockdown/Filesystem/NullCacheTest.php
index eda4e10b1a6..5e120e9bdc7 100644
--- a/tests/lib/Lockdown/Filesystem/NullCacheTest.php
+++ b/tests/lib/Lockdown/Filesystem/NullCacheTest.php
@@ -22,15 +22,15 @@ class NulLCacheTest extends \Test\TestCase {
$this->cache = new NullCache();
}
- public function testGetNumericStorageId() {
+ public function testGetNumericStorageId(): void {
$this->assertSame(-1, $this->cache->getNumericStorageId());
}
- public function testGetEmpty() {
+ public function testGetEmpty(): void {
$this->assertNull($this->cache->get('foo'));
}
- public function testGet() {
+ public function testGet(): void {
$data = $this->cache->get('');
$this->assertEquals(-1, $data['fileid']);
@@ -44,63 +44,63 @@ class NulLCacheTest extends \Test\TestCase {
$this->assertEquals(Constants::PERMISSION_READ, $data['permissions']);
}
- public function testGetFolderContents() {
+ public function testGetFolderContents(): void {
$this->assertSame([], $this->cache->getFolderContents('foo'));
}
- public function testGetFolderContentsById() {
+ public function testGetFolderContentsById(): void {
$this->assertSame([], $this->cache->getFolderContentsById(42));
}
- public function testPut() {
+ public function testPut(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->cache->put('foo', ['size' => 100]);
}
- public function testInsert() {
+ public function testInsert(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->cache->insert('foo', ['size' => 100]);
}
- public function testUpdate() {
+ public function testUpdate(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->cache->update('foo', ['size' => 100]);
}
- public function testGetId() {
+ public function testGetId(): void {
$this->assertSame(-1, $this->cache->getId('foo'));
}
- public function testGetParentId() {
+ public function testGetParentId(): void {
$this->assertSame(-1, $this->cache->getParentId('foo'));
}
- public function testInCache() {
+ public function testInCache(): void {
$this->assertTrue($this->cache->inCache(''));
$this->assertFalse($this->cache->inCache('foo'));
}
- public function testRemove() {
+ public function testRemove(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->cache->remove('foo');
}
- public function testMove() {
+ public function testMove(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->cache->move('foo', 'bar');
}
- public function testMoveFromCache() {
+ public function testMoveFromCache(): void {
$sourceCache = $this->createMock(ICache::class);
$this->expectException(ForbiddenException::class);
@@ -109,27 +109,27 @@ class NulLCacheTest extends \Test\TestCase {
$this->cache->moveFromCache($sourceCache, 'foo', 'bar');
}
- public function testGetStatus() {
+ public function testGetStatus(): void {
$this->assertSame(ICache::COMPLETE, $this->cache->getStatus('foo'));
}
- public function testSearch() {
+ public function testSearch(): void {
$this->assertSame([], $this->cache->search('foo'));
}
- public function testSearchByMime() {
+ public function testSearchByMime(): void {
$this->assertSame([], $this->cache->searchByMime('foo'));
}
- public function testGetIncomplete() {
+ public function testGetIncomplete(): void {
$this->assertSame([], $this->cache->getIncomplete());
}
- public function testGetPathById() {
+ public function testGetPathById(): void {
$this->assertSame('', $this->cache->getPathById(42));
}
- public function testNormalize() {
+ public function testNormalize(): void {
$this->assertSame('foo/ bar /', $this->cache->normalize('foo/ bar /'));
}
}
diff --git a/tests/lib/Lockdown/Filesystem/NullStorageTest.php b/tests/lib/Lockdown/Filesystem/NullStorageTest.php
index 727ccb83e21..331adeb8a54 100644
--- a/tests/lib/Lockdown/Filesystem/NullStorageTest.php
+++ b/tests/lib/Lockdown/Filesystem/NullStorageTest.php
@@ -24,178 +24,178 @@ class NullStorageTest extends TestCase {
$this->storage = new NullStorage([]);
}
- public function testGetId() {
+ public function testGetId(): void {
$this->assertSame('null', $this->storage->getId());
}
- public function testMkdir() {
+ public function testMkdir(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->mkdir('foo');
}
- public function testRmdir() {
+ public function testRmdir(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->rmdir('foo');
}
- public function testOpendir() {
+ public function testOpendir(): void {
$this->assertInstanceOf(IteratorDirectory::class, $this->storage->opendir('foo'));
}
- public function testIs_dir() {
+ public function testIs_dir(): void {
$this->assertTrue($this->storage->is_dir(''));
$this->assertFalse($this->storage->is_dir('foo'));
}
- public function testIs_file() {
+ public function testIs_file(): void {
$this->assertFalse($this->storage->is_file('foo'));
}
- public function testStat() {
+ public function testStat(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->stat('foo');
}
- public function testFiletype() {
+ public function testFiletype(): void {
$this->assertSame('dir', $this->storage->filetype(''));
$this->assertFalse($this->storage->filetype('foo'));
}
- public function testFilesize() {
+ public function testFilesize(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->filesize('foo');
}
- public function testIsCreatable() {
+ public function testIsCreatable(): void {
$this->assertFalse($this->storage->isCreatable('foo'));
}
- public function testIsReadable() {
+ public function testIsReadable(): void {
$this->assertTrue($this->storage->isReadable(''));
$this->assertFalse($this->storage->isReadable('foo'));
}
- public function testIsUpdatable() {
+ public function testIsUpdatable(): void {
$this->assertFalse($this->storage->isUpdatable('foo'));
}
- public function testIsDeletable() {
+ public function testIsDeletable(): void {
$this->assertFalse($this->storage->isDeletable('foo'));
}
- public function testIsSharable() {
+ public function testIsSharable(): void {
$this->assertFalse($this->storage->isSharable('foo'));
}
- public function testGetPermissions() {
+ public function testGetPermissions(): void {
$this->assertNull($this->storage->getPermissions('foo'));
}
- public function testFile_exists() {
+ public function testFile_exists(): void {
$this->assertTrue($this->storage->file_exists(''));
$this->assertFalse($this->storage->file_exists('foo'));
}
- public function testFilemtime() {
+ public function testFilemtime(): void {
$this->assertFalse($this->storage->filemtime('foo'));
}
- public function testFile_get_contents() {
+ public function testFile_get_contents(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->file_get_contents('foo');
}
- public function testFile_put_contents() {
+ public function testFile_put_contents(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->file_put_contents('foo', 'bar');
}
- public function testUnlink() {
+ public function testUnlink(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->unlink('foo');
}
- public function testRename() {
+ public function testRename(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->rename('foo', 'bar');
}
- public function testCopy() {
+ public function testCopy(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->copy('foo', 'bar');
}
- public function testFopen() {
+ public function testFopen(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->fopen('foo', 'R');
}
- public function testGetMimeType() {
+ public function testGetMimeType(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->getMimeType('foo');
}
- public function testHash() {
+ public function testHash(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->hash('md5', 'foo', true);
}
- public function testFree_space() {
+ public function testFree_space(): void {
$this->assertSame(FileInfo::SPACE_UNKNOWN, $this->storage->free_space('foo'));
}
- public function testTouch() {
+ public function testTouch(): void {
$this->expectException(ForbiddenException::class);
$this->expectExceptionMessage('This request is not allowed to access the filesystem');
$this->storage->touch('foo');
}
- public function testGetLocalFile() {
+ public function testGetLocalFile(): void {
$this->assertFalse($this->storage->getLocalFile('foo'));
}
- public function testHasUpdated() {
+ public function testHasUpdated(): void {
$this->assertFalse($this->storage->hasUpdated('foo', 42));
}
- public function testGetETag() {
+ public function testGetETag(): void {
$this->assertSame('', $this->storage->getETag('foo'));
}
- public function testIsLocal() {
+ public function testIsLocal(): void {
$this->assertFalse($this->storage->isLocal());
}
- public function testGetDirectDownload() {
+ public function testGetDirectDownload(): void {
$this->assertFalse($this->storage->getDirectDownload('foo'));
}
- public function testCopyFromStorage() {
+ public function testCopyFromStorage(): void {
$sourceStorage = $this->createMock(Storage::class);
$this->expectException(ForbiddenException::class);
@@ -204,7 +204,7 @@ class NullStorageTest extends TestCase {
$this->storage->copyFromStorage($sourceStorage, 'foo', 'bar');
}
- public function testMoveFromStorage() {
+ public function testMoveFromStorage(): void {
$sourceStorage = $this->createMock(Storage::class);
$this->expectException(ForbiddenException::class);
@@ -218,11 +218,11 @@ class NullStorageTest extends TestCase {
return true;
}
- public function testGetOwner() {
+ public function testGetOwner(): void {
$this->assertNull($this->storage->getOwner('foo'));
}
- public function testGetCache() {
+ public function testGetCache(): void {
$this->assertInstanceOf(NullCache::class, $this->storage->getCache('foo'));
}
}
diff --git a/tests/lib/Lockdown/LockdownManagerTest.php b/tests/lib/Lockdown/LockdownManagerTest.php
index bb71a6e63de..1f747378c02 100644
--- a/tests/lib/Lockdown/LockdownManagerTest.php
+++ b/tests/lib/Lockdown/LockdownManagerTest.php
@@ -23,12 +23,12 @@ class LockdownManagerTest extends TestCase {
};
}
- public function testCanAccessFilesystemDisabled() {
+ public function testCanAccessFilesystemDisabled(): void {
$manager = new LockdownManager($this->sessionCallback);
$this->assertTrue($manager->canAccessFilesystem());
}
- public function testCanAccessFilesystemAllowed() {
+ public function testCanAccessFilesystemAllowed(): void {
$token = new PublicKeyToken();
$token->setScope([IToken::SCOPE_FILESYSTEM => true]);
$manager = new LockdownManager($this->sessionCallback);
@@ -36,7 +36,7 @@ class LockdownManagerTest extends TestCase {
$this->assertTrue($manager->canAccessFilesystem());
}
- public function testCanAccessFilesystemNotAllowed() {
+ public function testCanAccessFilesystemNotAllowed(): void {
$token = new PublicKeyToken();
$token->setScope([IToken::SCOPE_FILESYSTEM => false]);
$manager = new LockdownManager($this->sessionCallback);