2022-07-21 15:47:52 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace MediaWiki\Extension\Math\Tests;
|
|
|
|
|
|
|
|
use Generator;
|
|
|
|
use MediaWikiUnitTestCase;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @coversNothing
|
|
|
|
*/
|
|
|
|
class ServiceWiringTest extends MediaWikiUnitTestCase {
|
|
|
|
private const EXTENSION_PREFIX = 'Math.';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @dataProvider provideWiring
|
|
|
|
*/
|
|
|
|
public function testAllWiringsAreProperlyShaped( $name, $definition ): void {
|
|
|
|
$this->assertStringStartsWith( self::EXTENSION_PREFIX, $name );
|
|
|
|
$this->assertIsCallable( $definition );
|
|
|
|
}
|
|
|
|
|
2023-05-20 22:26:33 +00:00
|
|
|
public static function provideWiring(): Generator {
|
2022-07-21 15:47:52 +00:00
|
|
|
$wiring = require __DIR__ . '/../../../ServiceWiring.php';
|
|
|
|
|
|
|
|
foreach ( $wiring as $name => $definition ) {
|
|
|
|
yield $name => [ $name, $definition ];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|