Skip to content

Commit

Permalink
Merge pull request #3269 from nextcloud/test/psalm/fix-types
Browse files Browse the repository at this point in the history
test(psalm): Fix types
  • Loading branch information
come-nc authored Sep 23, 2024
2 parents b31c379 + aeb65d8 commit 5f952f0
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions tests/ACL/ACLScannerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public function testScanAclStorage(): void {
$cache->calculateFolderSize('foo/bar');
$cache->calculateFolderSize('foo');

/** @psalm-suppress PossiblyFalseReference */
$this->assertEquals(-1, $cache->get('foo/bar')->getSize());

$acls = $this->getAclManager([
Expand All @@ -57,8 +58,10 @@ public function testScanAclStorage(): void {
$aclCache = $aclStorage->getCache();
$scanner->scan('');

/** @psalm-suppress PossiblyFalseReference */
$this->assertEquals(0, $cache->get('foo/bar')->getSize());

/** @psalm-suppress PossiblyFalseReference */
$this->assertEquals(31, $cache->get('foo/bar')->getPermissions());
$this->assertEquals(false, $aclCache->get('foo/bar'));
}
Expand Down
1 change: 1 addition & 0 deletions tests/ACL/ACLStorageWrapperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public function testOpenDir(): void {

$dh = $this->storage->opendir('foo');
$result = [];
/** @psalm-suppress PossiblyFalseArgument */
while ($file = readdir($dh)) {
$result[] = $file;
}
Expand Down
4 changes: 3 additions & 1 deletion tests/ACL/RuleManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ protected function setUp(): void {
$this->userMappingManager = $this->createMock(IUserMappingManager::class);
$this->userMappingManager->expects($this->any())
->method('mappingFromId')
->willReturnCallback(fn (string $type, string $id): UserMapping => new UserMapping($type, $id));
->willReturnCallback(fn (string $type, string $id): UserMapping =>
/** @var 'user'|'group'|'dummy' $type */
new UserMapping($type, $id));

$this->eventDispatcher = $this->createMock(IEventDispatcher::class);
$this->ruleManager = new RuleManager(Server::get(IDBConnection::class), $this->userMappingManager, $this->eventDispatcher);
Expand Down

0 comments on commit 5f952f0

Please sign in to comment.