Merge "mediawiki.api: Remove console warning for legacy token type"
[mediawiki.git] / tests / phpunit / includes / GlobalFunctions / WfExpandUrlTest.php
blob73d7a1fc38c7507809ea52337fa340a16a239728
1 <?php
3 use MediaWiki\MainConfigNames;
4 use MediaWiki\Request\FauxRequest;
5 use MediaWiki\Utils\UrlUtils;
7 /**
8 * @group GlobalFunctions
9 * @covers ::wfExpandUrl
11 class WfExpandUrlTest extends MediaWikiIntegrationTestCase {
12 /**
13 * Same tests as the UrlUtils method to ensure they don't fall out of sync
14 * @dataProvider UrlUtilsProviders::provideExpand
16 public function testWfExpandUrl( string $input, array $options,
17 $defaultProto, string $expected
18 ) {
19 $conf = [
20 MainConfigNames::Server => $options[UrlUtils::SERVER] ?? null,
21 MainConfigNames::CanonicalServer => $options[UrlUtils::CANONICAL_SERVER] ?? null,
22 MainConfigNames::InternalServer => $options[UrlUtils::INTERNAL_SERVER] ?? null,
23 MainConfigNames::HttpsPort => $options[UrlUtils::HTTPS_PORT] ?? 443,
25 $currentProto = $options[UrlUtils::FALLBACK_PROTOCOL];
27 $this->overrideConfigValues( $conf );
28 $this->setRequest( new FauxRequest( [], false, null, $currentProto ) );
29 $this->assertEquals( $expected, wfExpandUrl( $input, $defaultProto ) );