Debian Codegraph @

tests/phpunit/includes/GlobalFunctions/WfExpandUrlTest.php

raw symbols SCIP
1 <?php
2
3 use MediaWiki\MainConfigNames;
4 use MediaWiki\Request\FauxRequest;
5 use MediaWiki\Utils\UrlUtils;
6
7 /**
8 * @group GlobalFunctions
9 * @covers ::wfExpandUrl
10 */
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
15 */
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,
24 ];
25 $currentProto = $options[UrlUtils::FALLBACK_PROTOCOL];
26
27 $this->overrideConfigValues( $conf );
28 $this->setRequest( new FauxRequest( [], false, null, $currentProto ) );
29 $this->assertEquals( $expected, wfExpandUrl( $input, $defaultProto ) );
30 }
31 }