summaryrefslogtreecommitdiffstats
path: root/tests/php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-12-08 16:25:52 +0100
committerJoas Schilling <coding@schilljs.com>2020-12-10 11:47:05 +0100
commit50da7dac82b1171a5a8343b1d27642af3cebb675 (patch)
treeff639b692411f6f2325b02ff7a3779af31fecfe2 /tests/php
parent076f4261596f293f7c53dba86329ba0e354834a0 (diff)
Add a capability for the chat-read-status and the user setting
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'tests/php')
-rw-r--r--tests/php/CapabilitiesTest.php19
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/php/CapabilitiesTest.php b/tests/php/CapabilitiesTest.php
index 8a9913a6c..0299868b7 100644
--- a/tests/php/CapabilitiesTest.php
+++ b/tests/php/CapabilitiesTest.php
@@ -27,6 +27,7 @@ namespace OCA\Talk\Tests\Unit;
use OCA\Talk\Capabilities;
use OCA\Talk\Config;
+use OCA\Talk\Participant;
use OCP\Capabilities\IPublicCapability;
use OCP\IConfig;
use OCP\IUser;
@@ -100,6 +101,7 @@ class CapabilitiesTest extends TestCase {
'circles-support',
'force-mute',
'sip-support',
+ 'chat-read-status',
],
'config' => [
'attachments' => [
@@ -107,6 +109,7 @@ class CapabilitiesTest extends TestCase {
],
'chat' => [
'max-length' => 32000,
+ 'read-privacy' => 0,
],
'conversations' => [
'can-create' => false,
@@ -121,8 +124,8 @@ class CapabilitiesTest extends TestCase {
public function dataGetCapabilitiesUserAllowed(): array {
return [
- [true, false],
- [false, true],
+ [true, false, Participant::PRIVACY_PRIVATE],
+ [false, true, Participant::PRIVACY_PUBLIC],
];
}
@@ -130,8 +133,9 @@ class CapabilitiesTest extends TestCase {
* @dataProvider dataGetCapabilitiesUserAllowed
* @param bool $isNotAllowed
* @param bool $canCreate
+ * @param int $readPrivacy
*/
- public function testGetCapabilitiesUserAllowed(bool $isNotAllowed, bool $canCreate): void {
+ public function testGetCapabilitiesUserAllowed(bool $isNotAllowed, bool $canCreate, int $readPrivacy): void {
$capabilities = new Capabilities(
$this->serverConfig,
$this->talkConfig,
@@ -139,7 +143,7 @@ class CapabilitiesTest extends TestCase {
);
$user = $this->createMock(IUser::class);
- $user->expects($this->once())
+ $user->expects($this->atLeastOnce())
->method('getUID')
->willReturn('uid');
$this->userSession->expects($this->once())
@@ -161,6 +165,11 @@ class CapabilitiesTest extends TestCase {
->with($user)
->willReturn($isNotAllowed);
+ $this->talkConfig->expects($this->once())
+ ->method('getUserReadPrivacy')
+ ->with('uid')
+ ->willReturn($readPrivacy);
+
$this->serverConfig->expects($this->any())
->method('getAppValue')
->willReturnMap([
@@ -197,6 +206,7 @@ class CapabilitiesTest extends TestCase {
'circles-support',
'force-mute',
'sip-support',
+ 'chat-read-status',
'chat-reference-id',
],
'config' => [
@@ -206,6 +216,7 @@ class CapabilitiesTest extends TestCase {
],
'chat' => [
'max-length' => 32000,
+ 'read-privacy' => $readPrivacy,
],
'conversations' => [
'can-create' => $canCreate,