123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293 |
- <?php
- namespace OCA\ShareByMail\Tests;
- use OCA\ShareByMail\Capabilities;
- use OCA\ShareByMail\Settings\SettingsManager;
- use OCP\App\IAppManager;
- use OCP\Share\IManager;
- use Test\TestCase;
- class CapabilitiesTest extends TestCase {
-
- private $capabilities;
-
- private $manager;
-
- private $settingsManager;
-
- private $appManager;
- protected function setUp(): void {
- parent::setUp();
- $this->manager = $this::createMock(IManager::class);
- $this->settingsManager = $this::createMock(SettingsManager::class);
- $this->appManager = $this::createMock(IAppManager::class);
- $this->capabilities = new Capabilities($this->manager, $this->settingsManager, $this->appManager);
- }
- public function testGetCapabilities() {
- $this->manager->method('shareApiAllowLinks')
- ->willReturn(true);
- $this->manager->method('shareApiLinkEnforcePassword')
- ->willReturn(false);
- $this->manager->method('shareApiLinkDefaultExpireDateEnforced')
- ->willReturn(false);
- $this->settingsManager->method('sendPasswordByMail')
- ->willReturn(true);
- $this->appManager->method('isEnabledForUser')
- ->willReturn(true);
- $capabilities = [
- 'files_sharing' =>
- [
- 'sharebymail' =>
- [
- 'enabled' => true,
- 'send_password_by_mail' => true,
- 'upload_files_drop' => [
- 'enabled' => true,
- ],
- 'password' => [
- 'enabled' => true,
- 'enforced' => false,
- ],
- 'expire_date' => [
- 'enabled' => true,
- 'enforced' => false,
- ],
- ]
- ]
- ];
- $this->assertSame($capabilities, $this->capabilities->getCapabilities());
- }
- }
|