Some non-database tests are currently accessing the database. Fixing them means either avoiding the DB access if it's possible and makes sense for the test, or adding the `Database` group otherwise. In particular: - Replace global/static functions with services in a couple places to make testing easier. - RevisionRendererTest needs to be in the Database group due to heavy global state usage (including DB) by Parser - ActionFactoryIntegrationTest and SpecialPageFatalTest should be in the database group because they test many different classes, and some of which may use the database in the tested methods. - SpecialUserLogoutTest must be in the database group because of User. - Some pager tests are using wfGetDB directly. Change-Id: I96eb2acf9a2cbfd17e81225db2773d5e8e30260b
28 lines
896 B
PHP
28 lines
896 B
PHP
<?php
|
|
|
|
use MediaWiki\Actions\ActionFactory;
|
|
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 ) );
|
|
}
|
|
}
|
|
|
|
}
|