mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Echo
synced 2024-12-20 19:53:09 +00:00
291ea47dd3
This might make dependencies easier to find. Change-Id: I158fd9f63f18a2b8da0368ac95d5fb5aa9bca3ff
45 lines
1.1 KiB
PHP
45 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\Notifications\Test;
|
|
|
|
use MediaWikiIntegrationTestCase;
|
|
|
|
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;
|
|
}
|
|
}
|