mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-04 20:28:49 +00:00
6593a0a427
When intval() fails, the function returns a zero. We should remove the failures from the blacklist. Bug: T178512 Change-Id: I89ad680a287da16c2fbd6aa4d53a725142429144
34 lines
717 B
PHP
34 lines
717 B
PHP
<?php
|
|
|
|
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'] );
|
|
}
|
|
|
|
}
|