4 * Base class for testing special pages.
8 * @license GPL-2.0-or-later
9 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
10 * @author Daniel Kinzler
12 * @author Thiemo Kreuz
14 abstract class SpecialPageTestBase
extends MediaWikiTestCase
{
18 protected function setUp() {
21 $this->obLevel
= ob_get_level();
24 protected function tearDown() {
25 $obLevel = ob_get_level();
27 while ( ob_get_level() > $this->obLevel
) {
32 if ( $obLevel !== $this->obLevel
) {
34 "Test changed output buffer level: was {$this->obLevel} before test, but $obLevel after test."
43 * Returns a new instance of the special page under test.
47 abstract protected function newSpecialPage();
50 * @param string $subPage The subpage parameter to call the page with
51 * @param WebRequest|null $request Web request that may contain URL parameters, etc
52 * @param Language|string|null $language The language which should be used in the context
53 * @param User|null $user The user which should be used in the context of this special page
56 * @return array [ string, WebResponse ] A two-elements array containing the HTML output
57 * generated by the special page as well as the response object.
59 protected function executeSpecialPage(
61 WebRequest
$request = null,
65 return ( new SpecialPageExecutor() )->executeSpecialPage(
66 $this->newSpecialPage(),