wiki.techinc.nl/tests/phpunit/integration/includes/parser/Parsoid/Config/SiteConfigTest.php
Umherirrender f27c2433bb tests: Use namespaced classes (2)
Changes to the use statements done automatically via script
Addition of missing use statement done manually

Change-Id: I4ff4d0c10820dc2a3b8419b4115fadf81a76f7a2
2024-06-13 23:21:02 +02:00

36 lines
1.1 KiB
PHP

<?php
namespace MediaWiki\Tests\Parser\Parsoid\Config;
use MediaWiki\Content\TextContentHandler;
use MediaWikiIntegrationTestCase;
/**
* @covers \MediaWiki\Parser\Parsoid\Config\SiteConfig
*/
class SiteConfigTest extends MediaWikiIntegrationTestCase {
public static function provideSupportsContentModels() {
yield [ CONTENT_MODEL_WIKITEXT, true ];
yield [ CONTENT_MODEL_JSON, true ];
yield [ CONTENT_MODEL_JAVASCRIPT, false ];
yield [ 'with-text', true ];
yield [ 'xyzzy', false ];
}
/**
* @dataProvider provideSupportsContentModels
*/
public function testSupportsContentModel( $model, $expected ) {
$contentHandlers = $this->getConfVar( 'ContentHandlers' );
$this->overrideConfigValue( 'ContentHandlers', [
'with-text' => [ 'factory' => static function () {
return new TextContentHandler( 'with-text', [ CONTENT_FORMAT_WIKITEXT, 'plain/test' ] );
} ],
] + $contentHandlers );
$this->resetServices();
$siteConfig = $this->getServiceContainer()->getParsoidSiteConfig();
$this->assertSame( $expected, $siteConfig->supportsContentModel( $model ) );
}
}