2017-11-13 16:36:11 +00:00
|
|
|
<?php
|
|
|
|
|
2018-01-24 00:31:53 +00:00
|
|
|
/**
|
|
|
|
* @covers EchoHooks
|
|
|
|
*/
|
2017-11-13 16:36:11 +00:00
|
|
|
class EchoHooksTest extends MediaWikiTestCase {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the UserSaveOptions hook implementation.
|
|
|
|
*/
|
|
|
|
public function testOnUserSaveOptions() {
|
|
|
|
$options['echo-notifications-blacklist'] = [
|
|
|
|
'',
|
|
|
|
'0',
|
|
|
|
'abcdef',
|
|
|
|
'12345',
|
|
|
|
'54321',
|
|
|
|
];
|
|
|
|
|
|
|
|
EchoHooks::onUserSaveOptions( new User(), $options );
|
|
|
|
|
|
|
|
$this->assertSame( "12345\n54321", $options['echo-notifications-blacklist'] );
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Test the UserLoadOptions hook implementation.
|
|
|
|
*/
|
|
|
|
public function testOnUserLoadOptions() {
|
|
|
|
$options['echo-notifications-blacklist'] = "12345\n54321";
|
|
|
|
|
|
|
|
EchoHooks::onUserLoadOptions( new User(), $options );
|
|
|
|
|
|
|
|
$this->assertSame( [ 12345, 54321 ], $options['echo-notifications-blacklist'] );
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|