tests: Add ActionFactoryIntegrationTest
Test all action specs to be valid, avoid T326275 Change-Id: I72555f892861f38b61e4ddb2e8b338c62d24f041
This commit is contained in:
parent
4c54ef2c4a
commit
4d8cc1bfff
2 changed files with 28 additions and 0 deletions
|
|
@ -132,6 +132,7 @@ class ActionFactory {
|
|||
'mcrundo' => [
|
||||
'class' => McrUndoAction::class,
|
||||
'services' => [
|
||||
// Same as for McrRestoreAction
|
||||
'ReadOnlyMode',
|
||||
'RevisionLookup',
|
||||
'RevisionRenderer',
|
||||
|
|
@ -142,6 +143,7 @@ class ActionFactory {
|
|||
'mcrrestore' => [
|
||||
'class' => McrRestoreAction::class,
|
||||
'services' => [
|
||||
// Same as for McrUndoAction
|
||||
'ReadOnlyMode',
|
||||
'RevisionLookup',
|
||||
'RevisionRenderer',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
use MediaWiki\Actions\ActionFactory;
|
||||
use MediaWiki\MediaWikiServices;
|
||||
|
||||
/**
|
||||
* Test that runs against all core actions to make sure that
|
||||
* creating an instance of the action works
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
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 ) );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue