Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ftp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
tools: phpunit:9
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/performance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
tools: phpunit:9
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/s3-external.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
tools: phpunit:9
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -95,7 +95,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
tools: phpunit:9
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/s3-primary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
tools: phpunit
tools: phpunit:9
extensions: mbstring, fileinfo, intl, sqlite, pdo_sqlite, zip, gd
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
41 changes: 0 additions & 41 deletions tests/lib/Encryption/UtilTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

use OC\Encryption\Util;
use OC\Files\View;
use OCA\Files_External\Lib\StorageConfig;
use OCA\Files_External\Service\GlobalStoragesService;
use OCP\Encryption\IEncryptionModule;
use OCP\IConfig;
use OCP\IGroupManager;
Expand Down Expand Up @@ -181,43 +179,4 @@ public function dataTestStripPartialFileExtension() {
['/foo/test.txt.ocTransferId7567.part', '/foo/test.txt'],
];
}

public function dataTestIsSystemWideMountPoint() {
return [
[false, 'non-matching mount point name', [], [], '/mp_another'],
[true, 'applicable to all', [], []],
[true, 'applicable to user directly', ['user1'], []],
[true, 'applicable to group directly', [], ['group1']],
[false, 'non-applicable to current user', ['user2'], []],
[false, 'non-applicable to current user\'s group', [], ['group2']],
[true, 'mount point without leading slash', [], [], 'mp'],
];
}

/**
* @dataProvider dataTestIsSystemWideMountPoint
*/
public function testIsSystemWideMountPoint($expectedResult, $expectationText, $applicableUsers, $applicableGroups, $mountPointName = '/mp') {
$this->groupManager->method('isInGroup')
->will($this->returnValueMap([
['user1', 'group1', true], // user is only in group1
['user1', 'group2', false],
]));

$storages = [];

$storageConfig = $this->createMock(StorageConfig::class);
$storageConfig->method('getMountPoint')->willReturn($mountPointName);
$storageConfig->method('getApplicableUsers')->willReturn($applicableUsers);
$storageConfig->method('getApplicableGroups')->willReturn($applicableGroups);
$storages[] = $storageConfig;

$storagesServiceMock = $this->createMock(GlobalStoragesService::class);
$storagesServiceMock->expects($this->atLeastOnce())->method('getAllStorages')
->willReturn($storages);

$this->overwriteService(GlobalStoragesService::class, $storagesServiceMock);

$this->assertEquals($expectedResult, $this->util->isSystemWideMountPoint('/files/mp', 'user1'), 'Test case: ' . $expectationText);
}
}