| 1 |
<?php |
| 2 |
|
| 3 |
use MediaWiki\MediaWikiServices; |
| 4 |
use MediaWiki\Permissions\UltimateAuthority; |
| 5 |
use MediaWiki\User\UserIdentityValue; |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
class SpecialPageFatalTest extends MediaWikiIntegrationTestCase { |
| 20 |
|
| 21 |
protected function setUp(): void { |
| 22 |
parent::setUp(); |
| 23 |
|
| 24 |
|
| 25 |
$this->filterDeprecated( '//' ); |
| 26 |
} |
| 27 |
|
| 28 |
public static function provideSpecialPageDoesNotFatal() { |
| 29 |
$spf = MediaWikiServices::getInstance()->getSpecialPageFactory(); |
| 30 |
foreach ( $spf->getNames() as $name ) { |
| 31 |
yield $name => [ $name ]; |
| 32 |
} |
| 33 |
} |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
public function testSpecialPageDoesNotFatal( string $name ) { |
| 39 |
$spf = $this->getServiceContainer()->getSpecialPageFactory(); |
| 40 |
|
| 41 |
$page = $spf->getPage( $name ); |
| 42 |
if ( !$page ) { |
| 43 |
$this->markTestSkipped( "Could not create special page $name" ); |
| 44 |
} |
| 45 |
|
| 46 |
$executor = new SpecialPageExecutor(); |
| 47 |
$authority = new UltimateAuthority( new UserIdentityValue( 42, 'SpecialPageTester' ) ); |
| 48 |
|
| 49 |
try { |
| 50 |
$executor->executeSpecialPage( $page, '', null, 'qqx', $authority ); |
| 51 |
} catch ( \PHPUnit\Framework\Error\Error $error ) { |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
|
| 57 |
throw $error; |
| 58 |
} catch ( Exception $e ) { |
| 59 |
|
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
$this->addToAssertionCount( 1 ); |
| 64 |
} |
| 65 |
|
| 66 |
} |