4 * Test class for SpecialRedirectExternal class.
6 * @license GPL-2.0-or-later
8 class SpecialRedirectExternalTest
extends MediaWikiTestCase
{
11 * @dataProvider provideDispatch
12 * @covers SpecialRedirectExternal::dispatch
13 * @covers SpecialRedirectExternal
15 * @param $expectedStatus
17 public function testDispatch( $url, $expectedStatus ) {
18 $page = new SpecialRedirectExternal();
19 $this->assertEquals( $expectedStatus, $page->dispatch( $url )->isGood() );
24 * @expectedException HttpError
25 * @expectedExceptionMessage asdf is not a valid URL
26 * @covers SpecialRedirectExternal::execute
28 public function testExecuteInvalidUrl() {
29 $page = new SpecialRedirectExternal();
30 $page->execute( 'asdf' );
35 * @covers SpecialRedirectExternal::execute
37 public function testValidUrl() {
38 $page = new SpecialRedirectExternal();
39 $this->assertTrue( $page->execute( 'https://www.mediawiki.org' ) );
42 public static function provideDispatch() {
46 [ 'https://www.mediawiki.org?test=1', true ],