2023-01-04 23:06:07 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
use MediaWiki\Actions\ActionFactory;
|
2024-02-08 14:56:54 +00:00
|
|
|
use MediaWiki\Context\RequestContext;
|
2023-01-04 23:06:07 +00:00
|
|
|
use MediaWiki\MediaWikiServices;
|
2023-03-01 20:33:26 +00:00
|
|
|
use MediaWiki\Title\Title;
|
2023-01-04 23:06:07 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Test that runs against all core actions to make sure that
|
|
|
|
|
* creating an instance of the action works
|
|
|
|
|
*
|
|
|
|
|
* @coversNothing
|
2023-07-19 23:08:27 +00:00
|
|
|
* @group Database
|
2023-01-04 23:06:07 +00:00
|
|
|
*/
|
|
|
|
|
class ActionFactoryIntegrationTest extends MediaWikiIntegrationTestCase {
|
|
|
|
|
|
|
|
|
|
public function testActionFactoryServiceWiring() {
|
|
|
|
|
$services = MediaWikiServices::getInstance();
|
|
|
|
|
$actionFactory = $services->getActionFactory();
|
|
|
|
|
$context = RequestContext::getMain();
|
|
|
|
|
$article = Article::newFromTitle( Title::makeTitle( NS_MAIN, 'ActionFactoryServiceWiringTest' ), $context );
|
|
|
|
|
|
|
|
|
|
$actionSpecs = ( new ReflectionClassConstant( ActionFactory::class, 'CORE_ACTIONS' ) )->getValue();
|
|
|
|
|
foreach ( $actionSpecs as $action => $_ ) {
|
|
|
|
|
$this->assertInstanceOf( Action::class, $actionFactory->getAction( $action, $article, $context ) );
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|