mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-11-23 23:44:53 +00:00
680e91c75c
Initally used a new sniff with autofix (T333745) Bug: T332865 Change-Id: I8b6fbfc300d62a10da770c8a1ca61756c7d7bf59
41 lines
1 KiB
PHP
41 lines
1 KiB
PHP
<?php
|
|
|
|
class NotificationStructureTest extends MediaWikiIntegrationTestCase {
|
|
/**
|
|
* @coversNothing
|
|
* @dataProvider provideNotificationTypes
|
|
*
|
|
* @param string $type
|
|
* @param array $info
|
|
*/
|
|
public function testNotificationTypes( $type, array $info ) {
|
|
if ( isset( $info['presentation-model'] ) ) {
|
|
self::assertTrue( class_exists( $info['presentation-model'] ),
|
|
"Presentation model class {$info['presentation-model']} for {$type} must exist"
|
|
);
|
|
}
|
|
|
|
if ( isset( $info['user-locators'] ) ) {
|
|
$locators = (array)$info['user-locators'];
|
|
$callable = reset( $locators );
|
|
if ( is_array( $callable ) ) {
|
|
$callable = reset( $callable );
|
|
}
|
|
self::assertTrue( is_callable( $callable ),
|
|
'User locator ' . print_r( $callable, true ) . " for {$type} must be callable"
|
|
);
|
|
}
|
|
}
|
|
|
|
public static function provideNotificationTypes() {
|
|
global $wgEchoNotifications;
|
|
|
|
$result = [];
|
|
foreach ( $wgEchoNotifications as $type => $info ) {
|
|
$result[] = [ $type, $info ];
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
}
|