| 1 |
<?php |
| 2 |
|
| 3 |
use MediaWiki\MainConfigNames; |
| 4 |
use MediaWiki\Request\FauxRequest; |
| 5 |
use MediaWiki\Utils\UrlUtils; |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
class WfExpandUrlTest extends MediaWikiIntegrationTestCase { |
| 12 |
|
| 13 |
|
| 14 |
|
| 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 |
} |