MediaWiki  master
ApiFormatTestBase Class Reference
Inheritance diagram for ApiFormatTestBase:
Collaboration diagram for ApiFormatTestBase:

Public Member Functions

 testGeneralEncoding (array $data, $expect, array $params=[], array $options=[])
 provideGeneralEncoding More...
 

Static Public Member Functions

static provideGeneralEncoding ()
 Return general data to be encoded for testing. More...
 

Protected Member Functions

 encodeData (array $params, array $data, $options=[])
 Get the formatter output for the given input data. More...
 

Protected Attributes

string $printerName
 Name of the formatter being tested. More...
 

Detailed Description

Definition at line 3 of file ApiFormatTestBase.php.

Member Function Documentation

◆ encodeData()

ApiFormatTestBase::encodeData ( array  $params,
array  $data,
  $options = [] 
)
protected

Get the formatter output for the given input data.

Parameters
array$paramsQuery parameters
array$dataData to encode
array$optionsOptions. If passed a string, the string is treated as the 'class' option.
  • name: Format name, rather than $this->printerName
  • class: If set, register 'name' with this class (and 'factory', if that's set)
  • factory: Used with 'class' to register at runtime
  • returnPrinter: Return the printer object
callable | null$factoryFactory to use instead of the normal one
Returns
string|array The string if $options['returnPrinter'] isn't set, or an array if it is:
Exceptions
Exception

Definition at line 36 of file ApiFormatTestBase.php.

References $context, $options, $printerName, $ret, as, and null.

Referenced by testGeneralEncoding().

◆ provideGeneralEncoding()

static ApiFormatTestBase::provideGeneralEncoding ( )
static

Return general data to be encoded for testing.

Returns
array See self::testGeneralEncoding
Exceptions
BadMethodCallException

Definition at line 16 of file ApiFormatTestBase.php.

References class.

◆ testGeneralEncoding()

ApiFormatTestBase::testGeneralEncoding ( array  $data,
  $expect,
array  $params = [],
array  $options = [] 
)

provideGeneralEncoding

Parameters
array$dataData to be encoded
string | Exception$expectString to expect, or exception expected to be thrown
array$paramsQuery parameters to set in the FauxRequest
array$optionsOptions to pass to self::encodeData()

Definition at line 83 of file ApiFormatTestBase.php.

References $options, $params, and encodeData().

Referenced by ApiFormatRawTest\testFailWithHTTPError().

Member Data Documentation

◆ $printerName

string ApiFormatTestBase::$printerName
protected

Name of the formatter being tested.

Definition at line 9 of file ApiFormatTestBase.php.

Referenced by encodeData().


The documentation for this class was generated from the following file: