diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2023-04-18 14:04:58 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-18 14:04:58 +0200 |
commit | 989eed795d5bce593e3845f2c0539169a61e6db9 (patch) | |
tree | e51726d6859d1d6363ac72e182916313ce5d2081 /tests/php | |
parent | 90f058a3ddc207a81d26e1c7ebd686fab9dfab2e (diff) | |
parent | 1e4ce5e7a74d321192d9173a4b6eeb027ed205a7 (diff) |
Merge pull request #9329 from nextcloud/feat/9270/video-background-capabilities
feat(virtual-background): Add capabilities for predefined virtual bac…
Diffstat (limited to 'tests/php')
-rw-r--r-- | tests/php/CapabilitiesTest.php | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/tests/php/CapabilitiesTest.php b/tests/php/CapabilitiesTest.php index e264d3452..ebff099bb 100644 --- a/tests/php/CapabilitiesTest.php +++ b/tests/php/CapabilitiesTest.php @@ -32,6 +32,8 @@ use OCA\Talk\Participant; use OCA\Talk\Room; use OCP\App\IAppManager; use OCP\Capabilities\IPublicCapability; +use OCP\ICache; +use OCP\ICacheFactory; use OCP\IConfig; use OCP\IUser; use OCP\IUserSession; @@ -47,6 +49,8 @@ class CapabilitiesTest extends TestCase { protected IUserSession|MockObject $userSession; protected IAppManager|MockObject $appManager; protected ITranslationManager|MockObject $translationManager; + protected ICacheFactory|MockObject $cacheFactory; + protected ICache|MockObject $talkCache; protected ?array $baseFeatures = null; public function setUp(): void { @@ -57,6 +61,12 @@ class CapabilitiesTest extends TestCase { $this->userSession = $this->createMock(IUserSession::class); $this->appManager = $this->createMock(IAppManager::class); $this->translationManager = $this->createMock(ITranslationManager::class); + $this->cacheFactory = $this->createMock(ICacheFactory::class); + $this->talkCache = $this->createMock(ICache::class); + + $this->cacheFactory->method('createLocal') + ->with('talk::') + ->willReturn($this->talkCache); $this->commentsManager->expects($this->any()) ->method('supportReactions') @@ -139,6 +149,7 @@ class CapabilitiesTest extends TestCase { $this->userSession, $this->appManager, $this->translationManager, + $this->cacheFactory, ); $this->userSession->expects($this->once()) @@ -174,6 +185,15 @@ class CapabilitiesTest extends TestCase { 'enabled' => true, 'breakout-rooms' => false, 'recording' => false, + 'predefined-backgrounds' => [ + '1.jpg', + '2.jpg', + '3.jpg', + '4.jpg', + '5.jpg', + '6.jpg', + ], + 'can-upload-background' => false, ], 'chat' => [ 'max-length' => 32000, @@ -197,8 +217,9 @@ class CapabilitiesTest extends TestCase { public function dataGetCapabilitiesUserAllowed(): array { return [ - [true, false, Participant::PRIVACY_PRIVATE], - [false, true, Participant::PRIVACY_PUBLIC], + [true, false, 'none', true, Participant::PRIVACY_PRIVATE], + [false, true, '1 MB', true, Participant::PRIVACY_PUBLIC], + [false, true, '0 B', false, Participant::PRIVACY_PUBLIC], ]; } @@ -206,9 +227,11 @@ class CapabilitiesTest extends TestCase { * @dataProvider dataGetCapabilitiesUserAllowed * @param bool $isNotAllowed * @param bool $canCreate + * @param string $quota + * @param bool $canUpload * @param int $readPrivacy */ - public function testGetCapabilitiesUserAllowed(bool $isNotAllowed, bool $canCreate, int $readPrivacy): void { + public function testGetCapabilitiesUserAllowed(bool $isNotAllowed, bool $canCreate, string $quota, bool $canUpload, int $readPrivacy): void { $capabilities = new Capabilities( $this->serverConfig, $this->talkConfig, @@ -216,6 +239,7 @@ class CapabilitiesTest extends TestCase { $this->userSession, $this->appManager, $this->translationManager, + $this->cacheFactory, ); $user = $this->createMock(IUser::class); @@ -250,6 +274,9 @@ class CapabilitiesTest extends TestCase { ->with('uid') ->willReturn($readPrivacy); + $user->method('getQuota') + ->willReturn($quota); + $this->serverConfig->expects($this->any()) ->method('getAppValue') ->willReturnMap([ @@ -278,6 +305,15 @@ class CapabilitiesTest extends TestCase { 'enabled' => false, 'breakout-rooms' => true, 'recording' => false, + 'predefined-backgrounds' => [ + '1.jpg', + '2.jpg', + '3.jpg', + '4.jpg', + '5.jpg', + '6.jpg', + ], + 'can-upload-background' => $canUpload, ], 'chat' => [ 'max-length' => 32000, @@ -322,6 +358,7 @@ class CapabilitiesTest extends TestCase { $this->userSession, $this->appManager, $this->translationManager, + $this->cacheFactory, ); $user = $this->createMock(IUser::class); @@ -346,6 +383,7 @@ class CapabilitiesTest extends TestCase { $this->userSession, $this->appManager, $this->translationManager, + $this->cacheFactory, ); $this->talkConfig->expects($this->once()) @@ -367,6 +405,7 @@ class CapabilitiesTest extends TestCase { $this->userSession, $this->appManager, $this->translationManager, + $this->cacheFactory, ); $this->talkConfig->expects($this->once()) @@ -392,6 +431,7 @@ class CapabilitiesTest extends TestCase { $this->userSession, $this->appManager, $this->translationManager, + $this->cacheFactory, ); $translations = []; |