X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiOptionsTest.php;h=e031ce3337299eec5ecf587e230e9ab9f7e1cc60;hb=ea5f351fb149b7a5c15e88965c5909cb24634acc;hp=6659414cb51efe45f032c61f53a220f5a6775a86;hpb=93131fcd385cdae84ecb7ccb6faa1c7340214211;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/api/ApiOptionsTest.php b/tests/phpunit/includes/api/ApiOptionsTest.php index 6659414cb5..e031ce3337 100644 --- a/tests/phpunit/includes/api/ApiOptionsTest.php +++ b/tests/phpunit/includes/api/ApiOptionsTest.php @@ -116,6 +116,7 @@ class ApiOptionsTest extends MediaWikiLangTestCase { 'testmultiselect-opt2' => 'registered-multiselect', 'testmultiselect-opt3' => 'registered-multiselect', 'testmultiselect-opt4' => 'registered-multiselect', + 'special' => 'special', ); if ( $options === null ) { @@ -317,7 +318,9 @@ class ApiOptionsTest extends MediaWikiLangTestCase { $this->mUserMock->expects( $this->once() ) ->method( 'saveSettings' ); - $request = $this->getSampleRequest( array( 'change' => 'willBeNull|willBeEmpty=|willBeHappy=Happy' ) ); + $request = $this->getSampleRequest( array( + 'change' => 'willBeNull|willBeEmpty=|willBeHappy=Happy' + ) ); $response = $this->executeQuery( $request ); @@ -381,7 +384,8 @@ class ApiOptionsTest extends MediaWikiLangTestCase { ->method( 'saveSettings' ); $request = $this->getSampleRequest( array( - 'change' => 'testmultiselect-opt1=1|testmultiselect-opt2|testmultiselect-opt3=|testmultiselect-opt4=0' + 'change' => 'testmultiselect-opt1=1|testmultiselect-opt2|' + . 'testmultiselect-opt3=|testmultiselect-opt4=0' ) ); $response = $this->executeQuery( $request ); @@ -389,6 +393,29 @@ class ApiOptionsTest extends MediaWikiLangTestCase { $this->assertEquals( self::$Success, $response ); } + public function testSpecialOption() { + $this->mUserMock->expects( $this->never() ) + ->method( 'resetOptions' ); + + $this->mUserMock->expects( $this->never() ) + ->method( 'saveSettings' ); + + $request = $this->getSampleRequest( array( + 'change' => 'special=1' + ) ); + + $response = $this->executeQuery( $request ); + + $this->assertEquals( array( + 'options' => 'success', + 'warnings' => array( + 'options' => array( + '*' => "Validation error for 'special': cannot be set by this module" + ) + ) + ), $response ); + } + public function testUnknownOption() { $this->mUserMock->expects( $this->never() ) ->method( 'resetOptions' );