wiki.techinc.nl/tests/phpunit/includes/actions/ActionFactoryIntegrationTest.php
James D. Forrester 4bae64d1c7 Namespace includes/context
Bug: T353458
Change-Id: I4dbef138fd0110c14c70214282519189d70c94fb
2024-02-08 11:07:01 -05:00

29 lines
934 B
PHP

<?php
use MediaWiki\Actions\ActionFactory;
use MediaWiki\Context\RequestContext;
use MediaWiki\MediaWikiServices;
use MediaWiki\Title\Title;
/**
* Test that runs against all core actions to make sure that
* creating an instance of the action works
*
* @coversNothing
* @group Database
*/
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 ) );
}
}
}