summaryrefslogtreecommitdiff
blob: d1f2ac56ddedbd640b23cc175f9c06faab4171d3 (plain)
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
<?php

class EchoHooksTest extends MediaWikiTestCase {
	/**
	 * @covers \EchoHooks::onUserGetDefaultOptions()
	 */
	public function testOnUserGetDefaultOptions() {
		$this->setMwGlobals( [
			'wgEchoNotificationCategories' => [
				'emailuser' => [
					'priority' => 9,
					'tooltip' => 'echo-pref-tooltip-emailuser',
				],
				'mention' => [
					'priority' => 4,
					'tooltip' => 'echo-pref-tooltip-mention',
				],
				'system' => [
					'priority' => 9,
					'no-dismiss' => [
						'all'
					],
				],
				'some-custom-category' => [
					'priority' => 9001,
				],
			],
			'wgAllowHTMLEmail' => true,
		] );

		$defaults = [
			'something' => 'unrelated',
			// T174220: don't overwrite defaults set elsewhere
			'echo-subscriptions-web-mention' => false,
		];
		EchoHooks::onUserGetDefaultOptions( $defaults );
		self::assertEquals(
			[
				'something' => 'unrelated',
				'echo-email-format' => 'html',
				'echo-subscriptions-email-mention' => false,
				'echo-subscriptions-web-mention' => false,
				'echo-subscriptions-email-emailuser' => false,
				'echo-subscriptions-web-emailuser' => true,
				'echo-subscriptions-email-system' => true,
				'echo-subscriptions-web-system' => true,
				'echo-subscriptions-email-some-custom-category' => false,
				'echo-subscriptions-web-some-custom-category' => true,
			],
			$defaults
		);
	}
}