-
Notifications
You must be signed in to change notification settings - Fork 119
Expand file tree
/
Copy pathFormsActivitySettingsTest.php
More file actions
69 lines (55 loc) · 1.86 KB
/
Copy pathFormsActivitySettingsTest.php
File metadata and controls
69 lines (55 loc) · 1.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
declare(strict_types=1);
/**
* SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Forms\Tests\Unit\Activity\Settings;
use OCA\Forms\Activity\Settings\FormsActivitySettings;
use OCP\IL10N;
use PHPUnit\Framework\MockObject\MockClass;
use Test\TestCase;
class SettingsTestClass extends FormsActivitySettings {
// Two abstract methods exist, that need to be implemented to use the class.
public function getIdentifier() {
}
public function getName() {
}
}
class FormsActivitySettingsTest extends TestCase {
/** @var IL10N|MockObject */
private $l10n;
/** @var SettingsTestClass|MockClass */
private $activitySettings;
public function setUp(): void {
parent::setUp();
$this->l10n = $this->createMock(IL10N::class);
$this->activitySettings = new SettingsTestClass('forms', $this->l10n);
}
public function testGetGroupIdentifier() {
$this->assertEquals('forms', $this->activitySettings->getGroupIdentifier());
}
public function testGetGroupName() {
$this->l10n->expects($this->once())
->method('t')
->will($this->returnCallback(function ($identity) {
return $identity;
}));
$this->assertEquals('Forms', $this->activitySettings->getGroupName());
}
public function testGetPriority() {
$this->assertEquals(60, $this->activitySettings->getPriority());
}
public function testCanChangeNotification() {
$this->assertEquals(true, $this->activitySettings->canChangeNotification());
}
public function testIsDefaultEnabledNotification() {
$this->assertEquals(true, $this->activitySettings->isDefaultEnabledNotification());
}
public function testCanChangeMail() {
$this->assertEquals(true, $this->activitySettings->canChangeMail());
}
public function testIsDefaultEnabledMail() {
$this->assertEquals(false, $this->activitySettings->isDefaultEnabledMail());
}
}