2011-01-03 21:36:49 +00:00
|
|
|
<?php
|
|
|
|
|
|
2011-07-01 16:34:02 +00:00
|
|
|
abstract class ApiFormatTestBase extends ApiTestCase {
|
2013-10-23 15:10:02 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $format
|
|
|
|
|
* @param array $params
|
2014-04-17 18:43:42 +00:00
|
|
|
* @param array $data
|
2013-10-23 15:10:02 +00:00
|
|
|
*
|
|
|
|
|
* @return string
|
|
|
|
|
*/
|
2011-01-03 21:36:49 +00:00
|
|
|
protected function apiRequest( $format, $params, $data = null ) {
|
|
|
|
|
$data = parent::doApiRequest( $params, $data, true );
|
2011-07-01 16:34:02 +00:00
|
|
|
|
2013-10-23 15:10:02 +00:00
|
|
|
/** @var ApiMain $module */
|
2011-01-03 21:36:49 +00:00
|
|
|
$module = $data[3];
|
2013-02-14 13:10:38 +00:00
|
|
|
|
2011-01-03 21:36:49 +00:00
|
|
|
$printer = $module->createPrinterByName( $format );
|
|
|
|
|
|
|
|
|
|
ob_start();
|
2014-09-17 19:43:31 +00:00
|
|
|
$printer->initPrinter( false );
|
2011-01-03 21:36:49 +00:00
|
|
|
$printer->execute();
|
|
|
|
|
$printer->closePrinter();
|
2014-09-17 19:43:31 +00:00
|
|
|
$out = ob_get_clean();
|
2011-01-03 21:36:49 +00:00
|
|
|
|
|
|
|
|
return $out;
|
|
|
|
|
}
|
2013-10-23 15:10:02 +00:00
|
|
|
|
2011-01-03 21:36:49 +00:00
|
|
|
}
|