/** @var DerivativeContext */
private $mContext;
- private $mOldGetPreferencesHooks;
-
private static $Success = array( 'options' => 'success' );
protected function setUp() {
$this->mTested = new ApiOptions( $main, 'options' );
- global $wgHooks;
- if ( !isset( $wgHooks['GetPreferences'] ) ) {
- $wgHooks['GetPreferences'] = array();
- }
- $this->mOldGetPreferencesHooks = $wgHooks['GetPreferences'];
- $wgHooks['GetPreferences'][] = array( $this, 'hookGetPreferences' );
- }
-
- protected function tearDown() {
- global $wgHooks;
-
- $wgHooks['GetPreferences'] = $this->mOldGetPreferencesHooks;
- $this->mOldGetPreferencesHooks = false;
-
- parent::tearDown();
+ $this->mergeMwGlobalArrayValue( 'wgHooks', array(
+ 'GetPreferences' => array(
+ array( $this, 'hookGetPreferences' )
+ )
+ ) );
}
public function hookGetPreferences( $user, &$preferences ) {
$this->mContext->setRequest( new FauxRequest( $request, true, $this->mSession ) );
$this->mTested->execute();
- return $this->mTested->getResult()->getData();
+ return $this->mTested->getResult()->getResultData( null, array( 'Strip' => 'all' ) );
}
/**
'options' => 'success',
'warnings' => array(
'options' => array(
- '*' => "Validation error for 'special': cannot be set by this module"
+ 'warnings' => "Validation error for 'special': cannot be set by this module"
)
)
), $response );
'options' => 'success',
'warnings' => array(
'options' => array(
- '*' => "Validation error for 'unknownOption': not a valid preference"
+ 'warnings' => "Validation error for 'unknownOption': not a valid preference"
)
)
), $response );