2012-04-16 20:02:34 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @group API
|
2012-12-03 03:40:55 +00:00
|
|
|
* @group Database
|
2012-12-28 17:23:02 +00:00
|
|
|
* @group medium
|
2012-04-16 20:02:34 +00:00
|
|
|
*/
|
|
|
|
|
class ApiOptionsTest extends MediaWikiLangTestCase {
|
|
|
|
|
|
2012-09-19 10:07:48 +00:00
|
|
|
private $mTested, $mUserMock, $mContext, $mSession;
|
2012-04-16 20:02:34 +00:00
|
|
|
|
2012-12-03 03:40:55 +00:00
|
|
|
private $mOldGetPreferencesHooks = false;
|
|
|
|
|
|
2012-04-16 20:02:34 +00:00
|
|
|
private static $Success = array( 'options' => 'success' );
|
|
|
|
|
|
2012-10-08 10:56:20 +00:00
|
|
|
protected function setUp() {
|
2012-04-16 20:02:34 +00:00
|
|
|
parent::setUp();
|
|
|
|
|
|
|
|
|
|
$this->mUserMock = $this->getMockBuilder( 'User' )
|
|
|
|
|
->disableOriginalConstructor()
|
|
|
|
|
->getMock();
|
|
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
// Set up groups and rights
|
2012-12-03 03:40:55 +00:00
|
|
|
$this->mUserMock->expects( $this->any() )
|
2012-12-07 21:10:12 +00:00
|
|
|
->method( 'getEffectiveGroups' )->will( $this->returnValue( array( '*', 'user' ) ) );
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->any() )
|
|
|
|
|
->method( 'isAllowed' )->will( $this->returnValue( true ) );
|
2012-12-07 21:10:12 +00:00
|
|
|
|
|
|
|
|
// Set up callback for User::getOptionKinds
|
|
|
|
|
$this->mUserMock->expects( $this->any() )
|
|
|
|
|
->method( 'getOptionKinds' )->will( $this->returnCallback( array( $this, 'getOptionKinds' ) ) );
|
2012-12-03 03:40:55 +00:00
|
|
|
|
2012-04-16 20:02:34 +00:00
|
|
|
// Create a new context
|
|
|
|
|
$this->mContext = new DerivativeContext( new RequestContext() );
|
2012-12-03 03:40:55 +00:00
|
|
|
$this->mContext->getContext()->setTitle( Title::newFromText( 'Test' ) );
|
2012-04-16 20:02:34 +00:00
|
|
|
$this->mContext->setUser( $this->mUserMock );
|
|
|
|
|
|
2012-09-19 10:07:48 +00:00
|
|
|
$main = new ApiMain( $this->mContext );
|
2012-04-16 20:02:34 +00:00
|
|
|
|
|
|
|
|
// Empty session
|
|
|
|
|
$this->mSession = array();
|
|
|
|
|
|
2012-09-19 10:07:48 +00:00
|
|
|
$this->mTested = new ApiOptions( $main, 'options' );
|
2012-12-03 03:40:55 +00:00
|
|
|
|
|
|
|
|
global $wgHooks;
|
|
|
|
|
if ( !isset( $wgHooks['GetPreferences'] ) ) {
|
|
|
|
|
$wgHooks['GetPreferences'] = array();
|
|
|
|
|
}
|
|
|
|
|
$this->mOldGetPreferencesHooks = $wgHooks['GetPreferences'];
|
|
|
|
|
$wgHooks['GetPreferences'][] = array( $this, 'hookGetPreferences' );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected function tearDown() {
|
|
|
|
|
global $wgHooks;
|
|
|
|
|
|
|
|
|
|
if ( $this->mOldGetPreferencesHooks !== false ) {
|
|
|
|
|
$wgHooks['GetPreferences'] = $this->mOldGetPreferencesHooks;
|
|
|
|
|
$this->mOldGetPreferencesHooks = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parent::tearDown();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function hookGetPreferences( $user, &$preferences ) {
|
2012-12-07 21:10:12 +00:00
|
|
|
$preferences = array();
|
|
|
|
|
|
2012-12-03 03:40:55 +00:00
|
|
|
foreach ( array( 'name', 'willBeNull', 'willBeEmpty', 'willBeHappy' ) as $k ) {
|
|
|
|
|
$preferences[$k] = array(
|
|
|
|
|
'type' => 'text',
|
|
|
|
|
'section' => 'test',
|
|
|
|
|
'label' => ' ',
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2012-12-03 03:48:57 +00:00
|
|
|
$preferences['testmultiselect'] = array(
|
|
|
|
|
'type' => 'multiselect',
|
|
|
|
|
'options' => array(
|
|
|
|
|
'Test' => array(
|
|
|
|
|
'<span dir="auto">Some HTML here for option 1</span>' => 'opt1',
|
|
|
|
|
'<span dir="auto">Some HTML here for option 2</span>' => 'opt2',
|
|
|
|
|
'<span dir="auto">Some HTML here for option 3</span>' => 'opt3',
|
|
|
|
|
'<span dir="auto">Some HTML here for option 4</span>' => 'opt4',
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
'section' => 'test',
|
|
|
|
|
'label' => ' ',
|
|
|
|
|
'prefix' => 'testmultiselect-',
|
|
|
|
|
'default' => array(),
|
|
|
|
|
);
|
|
|
|
|
|
2012-12-03 03:40:55 +00:00
|
|
|
return true;
|
2012-04-16 20:02:34 +00:00
|
|
|
}
|
|
|
|
|
|
2012-12-07 21:10:12 +00:00
|
|
|
public function getOptionKinds( IContextSource $context, $options = null ) {
|
|
|
|
|
// Match with above.
|
|
|
|
|
$kinds = array(
|
|
|
|
|
'name' => 'registered',
|
|
|
|
|
'willBeNull' => 'registered',
|
|
|
|
|
'willBeEmpty' => 'registered',
|
|
|
|
|
'willBeHappy' => 'registered',
|
|
|
|
|
'testmultiselect-opt1' => 'registered-multiselect',
|
|
|
|
|
'testmultiselect-opt2' => 'registered-multiselect',
|
|
|
|
|
'testmultiselect-opt3' => 'registered-multiselect',
|
|
|
|
|
'testmultiselect-opt4' => 'registered-multiselect',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if ( $options === null ) {
|
|
|
|
|
return $kinds;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$mapping = array();
|
|
|
|
|
foreach ( $options as $key => $value ) {
|
|
|
|
|
if ( isset( $kinds[$key] ) ) {
|
|
|
|
|
$mapping[$key] = $kinds[$key];
|
|
|
|
|
} elseif ( substr( $key, 0, 7 ) === 'userjs-' ) {
|
|
|
|
|
$mapping[$key] = 'userjs';
|
|
|
|
|
} else {
|
|
|
|
|
$mapping[$key] = 'unused';
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-04-26 12:00:22 +00:00
|
|
|
|
2012-12-07 21:10:12 +00:00
|
|
|
return $mapping;
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-16 20:02:34 +00:00
|
|
|
private function getSampleRequest( $custom = array() ) {
|
|
|
|
|
$request = array(
|
|
|
|
|
'token' => '123ABC',
|
|
|
|
|
'change' => null,
|
|
|
|
|
'optionname' => null,
|
|
|
|
|
'optionvalue' => null,
|
|
|
|
|
);
|
2013-04-26 12:00:22 +00:00
|
|
|
|
2012-04-16 20:02:34 +00:00
|
|
|
return array_merge( $request, $custom );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function executeQuery( $request ) {
|
|
|
|
|
$this->mContext->setRequest( new FauxRequest( $request, true, $this->mSession ) );
|
|
|
|
|
$this->mTested->execute();
|
2013-04-26 12:00:22 +00:00
|
|
|
|
2012-04-16 20:02:34 +00:00
|
|
|
return $this->mTested->getResult()->getData();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @expectedException UsageException
|
|
|
|
|
*/
|
|
|
|
|
public function testNoToken() {
|
|
|
|
|
$request = $this->getSampleRequest( array( 'token' => null ) );
|
|
|
|
|
|
|
|
|
|
$this->executeQuery( $request );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testAnon() {
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'isAnon' )
|
|
|
|
|
->will( $this->returnValue( true ) );
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$request = $this->getSampleRequest();
|
|
|
|
|
|
|
|
|
|
$this->executeQuery( $request );
|
|
|
|
|
} catch ( UsageException $e ) {
|
|
|
|
|
$this->assertEquals( 'notloggedin', $e->getCodeString() );
|
|
|
|
|
$this->assertEquals( 'Anonymous users cannot change preferences', $e->getMessage() );
|
2013-04-26 12:00:22 +00:00
|
|
|
|
2012-04-16 20:02:34 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$this->fail( "UsageException was not thrown" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testNoOptionname() {
|
|
|
|
|
try {
|
|
|
|
|
$request = $this->getSampleRequest( array( 'optionvalue' => '1' ) );
|
|
|
|
|
|
|
|
|
|
$this->executeQuery( $request );
|
|
|
|
|
} catch ( UsageException $e ) {
|
|
|
|
|
$this->assertEquals( 'nooptionname', $e->getCodeString() );
|
|
|
|
|
$this->assertEquals( 'The optionname parameter must be set', $e->getMessage() );
|
2013-04-26 12:00:22 +00:00
|
|
|
|
2012-04-16 20:02:34 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$this->fail( "UsageException was not thrown" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testNoChanges() {
|
|
|
|
|
$this->mUserMock->expects( $this->never() )
|
|
|
|
|
->method( 'resetOptions' );
|
|
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->never() )
|
|
|
|
|
->method( 'setOption' );
|
|
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->never() )
|
|
|
|
|
->method( 'saveSettings' );
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
$request = $this->getSampleRequest();
|
|
|
|
|
|
|
|
|
|
$this->executeQuery( $request );
|
|
|
|
|
} catch ( UsageException $e ) {
|
|
|
|
|
$this->assertEquals( 'nochanges', $e->getCodeString() );
|
|
|
|
|
$this->assertEquals( 'No changes were requested', $e->getMessage() );
|
2013-04-26 12:00:22 +00:00
|
|
|
|
2012-04-16 20:02:34 +00:00
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
$this->fail( "UsageException was not thrown" );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testReset() {
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
2013-01-15 01:45:01 +00:00
|
|
|
->method( 'resetOptions' )
|
|
|
|
|
->with( $this->equalTo( array( 'all' ) ) );
|
2012-04-16 20:02:34 +00:00
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->never() )
|
|
|
|
|
->method( 'setOption' );
|
|
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'saveSettings' );
|
|
|
|
|
|
|
|
|
|
$request = $this->getSampleRequest( array( 'reset' => '' ) );
|
|
|
|
|
|
|
|
|
|
$response = $this->executeQuery( $request );
|
|
|
|
|
|
|
|
|
|
$this->assertEquals( self::$Success, $response );
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-15 01:45:01 +00:00
|
|
|
public function testResetKinds() {
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'resetOptions' )
|
|
|
|
|
->with( $this->equalTo( array( 'registered' ) ) );
|
|
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->never() )
|
|
|
|
|
->method( 'setOption' );
|
|
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'saveSettings' );
|
|
|
|
|
|
|
|
|
|
$request = $this->getSampleRequest( array( 'reset' => '', 'resetkinds' => 'registered' ) );
|
|
|
|
|
|
|
|
|
|
$response = $this->executeQuery( $request );
|
|
|
|
|
|
|
|
|
|
$this->assertEquals( self::$Success, $response );
|
|
|
|
|
}
|
|
|
|
|
|
2012-04-16 20:02:34 +00:00
|
|
|
public function testOptionWithValue() {
|
|
|
|
|
$this->mUserMock->expects( $this->never() )
|
|
|
|
|
->method( 'resetOptions' );
|
|
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'setOption' )
|
|
|
|
|
->with( $this->equalTo( 'name' ), $this->equalTo( 'value' ) );
|
|
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'saveSettings' );
|
|
|
|
|
|
|
|
|
|
$request = $this->getSampleRequest( array( 'optionname' => 'name', 'optionvalue' => 'value' ) );
|
|
|
|
|
|
|
|
|
|
$response = $this->executeQuery( $request );
|
|
|
|
|
|
|
|
|
|
$this->assertEquals( self::$Success, $response );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testOptionResetValue() {
|
|
|
|
|
$this->mUserMock->expects( $this->never() )
|
|
|
|
|
->method( 'resetOptions' );
|
|
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'setOption' )
|
2013-01-15 01:45:01 +00:00
|
|
|
->with( $this->equalTo( 'name' ), $this->identicalTo( null ) );
|
2012-04-16 20:02:34 +00:00
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'saveSettings' );
|
|
|
|
|
|
|
|
|
|
$request = $this->getSampleRequest( array( 'optionname' => 'name' ) );
|
|
|
|
|
$response = $this->executeQuery( $request );
|
|
|
|
|
|
|
|
|
|
$this->assertEquals( self::$Success, $response );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testChange() {
|
|
|
|
|
$this->mUserMock->expects( $this->never() )
|
|
|
|
|
->method( 'resetOptions' );
|
|
|
|
|
|
2012-12-07 21:10:12 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 2 ) )
|
2012-12-03 03:40:55 +00:00
|
|
|
->method( 'getOptions' );
|
|
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 4 ) )
|
2012-04-16 20:02:34 +00:00
|
|
|
->method( 'setOption' )
|
2013-01-15 01:45:01 +00:00
|
|
|
->with( $this->equalTo( 'willBeNull' ), $this->identicalTo( null ) );
|
2012-04-16 20:02:34 +00:00
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 5 ) )
|
2012-12-03 03:40:55 +00:00
|
|
|
->method( 'getOptions' );
|
|
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 6 ) )
|
2012-04-16 20:02:34 +00:00
|
|
|
->method( 'setOption' )
|
|
|
|
|
->with( $this->equalTo( 'willBeEmpty' ), $this->equalTo( '' ) );
|
|
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 7 ) )
|
2012-12-03 03:40:55 +00:00
|
|
|
->method( 'getOptions' );
|
|
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 8 ) )
|
2012-04-16 20:02:34 +00:00
|
|
|
->method( 'setOption' )
|
|
|
|
|
->with( $this->equalTo( 'willBeHappy' ), $this->equalTo( 'Happy' ) );
|
|
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'saveSettings' );
|
|
|
|
|
|
|
|
|
|
$request = $this->getSampleRequest( array( 'change' => 'willBeNull|willBeEmpty=|willBeHappy=Happy' ) );
|
|
|
|
|
|
|
|
|
|
$response = $this->executeQuery( $request );
|
|
|
|
|
|
|
|
|
|
$this->assertEquals( self::$Success, $response );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testResetChangeOption() {
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'resetOptions' );
|
|
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 4 ) )
|
2012-12-03 03:40:55 +00:00
|
|
|
->method( 'getOptions' );
|
|
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 5 ) )
|
2012-04-16 20:02:34 +00:00
|
|
|
->method( 'setOption' )
|
|
|
|
|
->with( $this->equalTo( 'willBeHappy' ), $this->equalTo( 'Happy' ) );
|
|
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 6 ) )
|
2012-12-03 03:40:55 +00:00
|
|
|
->method( 'getOptions' );
|
|
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 7 ) )
|
2012-04-16 20:02:34 +00:00
|
|
|
->method( 'setOption' )
|
|
|
|
|
->with( $this->equalTo( 'name' ), $this->equalTo( 'value' ) );
|
|
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'saveSettings' );
|
|
|
|
|
|
|
|
|
|
$args = array(
|
|
|
|
|
'reset' => '',
|
|
|
|
|
'change' => 'willBeHappy=Happy',
|
|
|
|
|
'optionname' => 'name',
|
|
|
|
|
'optionvalue' => 'value'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$response = $this->executeQuery( $this->getSampleRequest( $args ) );
|
|
|
|
|
|
|
|
|
|
$this->assertEquals( self::$Success, $response );
|
|
|
|
|
}
|
2012-12-03 03:48:57 +00:00
|
|
|
|
|
|
|
|
public function testMultiSelect() {
|
|
|
|
|
$this->mUserMock->expects( $this->never() )
|
|
|
|
|
->method( 'resetOptions' );
|
|
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 3 ) )
|
2012-12-03 03:48:57 +00:00
|
|
|
->method( 'setOption' )
|
2013-01-15 01:45:01 +00:00
|
|
|
->with( $this->equalTo( 'testmultiselect-opt1' ), $this->identicalTo( true ) );
|
2012-12-03 03:48:57 +00:00
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 4 ) )
|
2012-12-03 03:48:57 +00:00
|
|
|
->method( 'setOption' )
|
2013-01-15 01:45:01 +00:00
|
|
|
->with( $this->equalTo( 'testmultiselect-opt2' ), $this->identicalTo( null ) );
|
2012-12-03 03:48:57 +00:00
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 5 ) )
|
2012-12-03 03:48:57 +00:00
|
|
|
->method( 'setOption' )
|
2013-01-15 01:45:01 +00:00
|
|
|
->with( $this->equalTo( 'testmultiselect-opt3' ), $this->identicalTo( false ) );
|
2012-12-03 03:48:57 +00:00
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 6 ) )
|
2012-12-03 03:48:57 +00:00
|
|
|
->method( 'setOption' )
|
2013-01-15 01:45:01 +00:00
|
|
|
->with( $this->equalTo( 'testmultiselect-opt4' ), $this->identicalTo( false ) );
|
2012-12-03 03:48:57 +00:00
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'saveSettings' );
|
|
|
|
|
|
|
|
|
|
$request = $this->getSampleRequest( array(
|
|
|
|
|
'change' => 'testmultiselect-opt1=1|testmultiselect-opt2|testmultiselect-opt3=|testmultiselect-opt4=0'
|
|
|
|
|
) );
|
|
|
|
|
|
|
|
|
|
$response = $this->executeQuery( $request );
|
|
|
|
|
|
|
|
|
|
$this->assertEquals( self::$Success, $response );
|
|
|
|
|
}
|
2012-12-07 21:10:12 +00:00
|
|
|
|
|
|
|
|
public function testUnknownOption() {
|
|
|
|
|
$this->mUserMock->expects( $this->never() )
|
|
|
|
|
->method( 'resetOptions' );
|
|
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->never() )
|
|
|
|
|
->method( 'saveSettings' );
|
|
|
|
|
|
|
|
|
|
$request = $this->getSampleRequest( array(
|
|
|
|
|
'change' => 'unknownOption=1'
|
|
|
|
|
) );
|
|
|
|
|
|
|
|
|
|
$response = $this->executeQuery( $request );
|
|
|
|
|
|
|
|
|
|
$this->assertEquals( array(
|
|
|
|
|
'options' => 'success',
|
|
|
|
|
'warnings' => array(
|
|
|
|
|
'options' => array(
|
|
|
|
|
'*' => "Validation error for 'unknownOption': not a valid preference"
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
), $response );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testUserjsOption() {
|
|
|
|
|
$this->mUserMock->expects( $this->never() )
|
|
|
|
|
->method( 'resetOptions' );
|
|
|
|
|
|
2013-06-10 19:30:43 +00:00
|
|
|
$this->mUserMock->expects( $this->at( 3 ) )
|
2012-12-07 21:10:12 +00:00
|
|
|
->method( 'setOption' )
|
|
|
|
|
->with( $this->equalTo( 'userjs-option' ), $this->equalTo( '1' ) );
|
|
|
|
|
|
|
|
|
|
$this->mUserMock->expects( $this->once() )
|
|
|
|
|
->method( 'saveSettings' );
|
|
|
|
|
|
|
|
|
|
$request = $this->getSampleRequest( array(
|
|
|
|
|
'change' => 'userjs-option=1'
|
|
|
|
|
) );
|
|
|
|
|
|
|
|
|
|
$response = $this->executeQuery( $request );
|
|
|
|
|
|
|
|
|
|
$this->assertEquals( self::$Success, $response );
|
|
|
|
|
}
|
2012-04-16 20:02:34 +00:00
|
|
|
}
|