mirror of
https://github.com/nextcloud/server.git
synced 2025-02-26 01:40:18 +00:00
test: Fix IStorage return types
Signed-off-by: provokateurin <kate@provokateurin.de>
This commit is contained in:
parent
1302b48ca2
commit
256a8d8903
7 changed files with 48 additions and 14 deletions
apps
tests/lib
Files
Lockdown/Filesystem
|
@ -283,8 +283,8 @@ class DirectoryTest extends \Test\TestCase {
|
|||
$storage->expects($this->any())
|
||||
->method('instanceOfStorage')
|
||||
->willReturnMap([
|
||||
'\OCA\Files_Sharing\SharedStorage' => false,
|
||||
'\OC\Files\Storage\Wrapper\Quota' => false,
|
||||
['\OCA\Files_Sharing\SharedStorage', false],
|
||||
['\OC\Files\Storage\Wrapper\Quota', false],
|
||||
]);
|
||||
|
||||
$storage->expects($this->once())
|
||||
|
|
|
@ -16,7 +16,7 @@ use OCP\IRequest;
|
|||
use Test\TestCase;
|
||||
|
||||
class TemporaryNoLocal extends Temporary {
|
||||
public function instanceOfStorage($className) {
|
||||
public function instanceOfStorage($className): bool {
|
||||
if ($className === '\OC\Files\Storage\Local') {
|
||||
return false;
|
||||
} else {
|
||||
|
|
|
@ -17,7 +17,7 @@ use OCP\IDBConnection;
|
|||
use OCP\IUser;
|
||||
|
||||
class LongId extends \OC\Files\Storage\Temporary {
|
||||
public function getId() {
|
||||
public function getId(): string {
|
||||
return 'long:' . str_repeat('foo', 50) . parent::getId();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ use OC\Files\SetupManagerFactory;
|
|||
use OC\Files\Storage\Temporary;
|
||||
|
||||
class LongId extends Temporary {
|
||||
public function getId() {
|
||||
public function getId(): string {
|
||||
return 'long:' . str_repeat('foo', 50) . parent::getId();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace Test\Files\Storage;
|
|||
use OC\Files\Storage\Temporary;
|
||||
|
||||
class StorageNoRecursiveCopy extends Temporary {
|
||||
public function copy($path1, $path2) {
|
||||
public function copy($path1, $path2): bool {
|
||||
if ($this->is_dir($path1)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -37,23 +37,23 @@ use Test\TestMoveableMountPoint;
|
|||
use Test\Traits\UserTrait;
|
||||
|
||||
class TemporaryNoTouch extends Temporary {
|
||||
public function touch($path, $mtime = null) {
|
||||
public function touch($path, $mtime = null): bool {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class TemporaryNoCross extends Temporary {
|
||||
public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = null) {
|
||||
public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = null): bool {
|
||||
return Common::copyFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime);
|
||||
}
|
||||
|
||||
public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) {
|
||||
public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath): bool {
|
||||
return Common::moveFromStorage($sourceStorage, $sourceInternalPath, $targetInternalPath);
|
||||
}
|
||||
}
|
||||
|
||||
class TemporaryNoLocal extends Temporary {
|
||||
public function instanceOfStorage($className) {
|
||||
public function instanceOfStorage($className): bool {
|
||||
if ($className === '\OC\Files\Storage\Local') {
|
||||
return false;
|
||||
} else {
|
||||
|
@ -1752,6 +1752,8 @@ class ViewTest extends \Test\TestCase {
|
|||
ILockingProvider::LOCK_SHARED,
|
||||
ILockingProvider::LOCK_EXCLUSIVE,
|
||||
ILockingProvider::LOCK_SHARED,
|
||||
null,
|
||||
0,
|
||||
],
|
||||
|
||||
// ---- delete hook ----
|
||||
|
@ -1783,6 +1785,8 @@ class ViewTest extends \Test\TestCase {
|
|||
ILockingProvider::LOCK_SHARED,
|
||||
ILockingProvider::LOCK_SHARED,
|
||||
null,
|
||||
null,
|
||||
false,
|
||||
],
|
||||
[
|
||||
'fopen',
|
||||
|
@ -1809,8 +1813,28 @@ class ViewTest extends \Test\TestCase {
|
|||
// ---- no hooks, no locks ---
|
||||
['is_dir', ['dir'], 'dir', null],
|
||||
['is_file', ['dir'], 'dir', null],
|
||||
['stat', ['dir'], 'dir', null],
|
||||
['filetype', ['dir'], 'dir', null],
|
||||
[
|
||||
'stat',
|
||||
['dir'],
|
||||
'dir',
|
||||
null,
|
||||
ILockingProvider::LOCK_SHARED,
|
||||
ILockingProvider::LOCK_SHARED,
|
||||
ILockingProvider::LOCK_SHARED,
|
||||
null,
|
||||
false,
|
||||
],
|
||||
[
|
||||
'filetype',
|
||||
['dir'],
|
||||
'dir',
|
||||
null,
|
||||
ILockingProvider::LOCK_SHARED,
|
||||
ILockingProvider::LOCK_SHARED,
|
||||
ILockingProvider::LOCK_SHARED,
|
||||
null,
|
||||
false,
|
||||
],
|
||||
[
|
||||
'filesize',
|
||||
['dir'],
|
||||
|
@ -1829,7 +1853,17 @@ class ViewTest extends \Test\TestCase {
|
|||
['isDeletable', ['dir'], 'dir', null],
|
||||
['isSharable', ['dir'], 'dir', null],
|
||||
['file_exists', ['dir'], 'dir', null],
|
||||
['filemtime', ['dir'], 'dir', null],
|
||||
[
|
||||
'filemtime',
|
||||
['dir'],
|
||||
'dir',
|
||||
null,
|
||||
ILockingProvider::LOCK_SHARED,
|
||||
ILockingProvider::LOCK_SHARED,
|
||||
ILockingProvider::LOCK_SHARED,
|
||||
null,
|
||||
false,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ class NullStorageTest extends TestCase {
|
|||
}
|
||||
|
||||
public function testGetPermissions(): void {
|
||||
$this->assertNull($this->storage->getPermissions('foo'));
|
||||
$this->assertEquals(0, $this->storage->getPermissions('foo'));
|
||||
}
|
||||
|
||||
public function testFile_exists(): void {
|
||||
|
|
Loading…
Reference in a new issue