3 use MediaWiki\MainConfigNames
;
4 use MediaWiki\Request\FauxRequest
;
5 use MediaWiki\Utils\UrlUtils
;
8 * @group GlobalFunctions
9 * @covers ::wfExpandUrl
11 class WfExpandUrlTest
extends MediaWikiIntegrationTestCase
{
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
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 ) );