summaryrefslogtreecommitdiff
path: root/tests/phpunit/includes/api/format/ApiFormatTestBase.php
blob: a0b7b0206547a4df4b50ea0a1bb2e534b8a78311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php

abstract class ApiFormatTestBase extends ApiTestCase {
	protected function apiRequest( $format, $params, $data = null ) {
		$data = parent::doApiRequest( $params, $data, true );

		$module = $data[3];
		
		$printer = $module->createPrinterByName( $format );
		$printer->setUnescapeAmps( false );

		$printer->initPrinter( false );

		ob_start();
		$printer->execute();
		$out = ob_get_clean();
		
		$printer->closePrinter();

		return $out;
	}
}