Merge "Revert "Log the reason why revision->getContent() returns null""
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiOptionsTest.php
index ef70626..c0fecf0 100644 (file)
@@ -22,7 +22,7 @@ class ApiOptionsTest extends MediaWikiLangTestCase {
        protected function setUp() {
                parent::setUp();
 
-               $this->mUserMock = $this->getMockBuilder( 'User' )
+               $this->mUserMock = $this->getMockBuilder( User::class )
                        ->disableOriginalConstructor()
                        ->getMock();
 
@@ -278,26 +278,13 @@ class ApiOptionsTest extends MediaWikiLangTestCase {
                $this->mUserMock->expects( $this->never() )
                        ->method( 'resetOptions' );
 
-               $this->mUserMock->expects( $this->at( 2 ) )
-                       ->method( 'getOptions' );
-
-               $this->mUserMock->expects( $this->at( 5 ) )
+               $this->mUserMock->expects( $this->exactly( 3 ) )
                        ->method( 'setOption' )
-                       ->with( $this->equalTo( 'willBeNull' ), $this->identicalTo( null ) );
-
-               $this->mUserMock->expects( $this->at( 6 ) )
-                       ->method( 'getOptions' );
-
-               $this->mUserMock->expects( $this->at( 7 ) )
-                       ->method( 'setOption' )
-                       ->with( $this->equalTo( 'willBeEmpty' ), $this->equalTo( '' ) );
-
-               $this->mUserMock->expects( $this->at( 8 ) )
-                       ->method( 'getOptions' );
-
-               $this->mUserMock->expects( $this->at( 9 ) )
-                       ->method( 'setOption' )
-                       ->with( $this->equalTo( 'willBeHappy' ), $this->equalTo( 'Happy' ) );
+                       ->withConsecutive(
+                               [ $this->equalTo( 'willBeNull' ), $this->identicalTo( null ) ],
+                               [ $this->equalTo( 'willBeEmpty' ), $this->equalTo( '' ) ],
+                               [ $this->equalTo( 'willBeHappy' ), $this->equalTo( 'Happy' ) ]
+                       );
 
                $this->mUserMock->expects( $this->once() )
                        ->method( 'saveSettings' );
@@ -315,19 +302,12 @@ class ApiOptionsTest extends MediaWikiLangTestCase {
                $this->mUserMock->expects( $this->once() )
                        ->method( 'resetOptions' );
 
-               $this->mUserMock->expects( $this->at( 5 ) )
-                       ->method( 'getOptions' );
-
-               $this->mUserMock->expects( $this->at( 6 ) )
-                       ->method( 'setOption' )
-                       ->with( $this->equalTo( 'willBeHappy' ), $this->equalTo( 'Happy' ) );
-
-               $this->mUserMock->expects( $this->at( 7 ) )
-                       ->method( 'getOptions' );
-
-               $this->mUserMock->expects( $this->at( 8 ) )
+               $this->mUserMock->expects( $this->exactly( 2 ) )
                        ->method( 'setOption' )
-                       ->with( $this->equalTo( 'name' ), $this->equalTo( 'value' ) );
+                       ->withConsecutive(
+                               [ $this->equalTo( 'willBeHappy' ), $this->equalTo( 'Happy' ) ],
+                               [ $this->equalTo( 'name' ), $this->equalTo( 'value' ) ]
+                       );
 
                $this->mUserMock->expects( $this->once() )
                        ->method( 'saveSettings' );
@@ -348,21 +328,14 @@ class ApiOptionsTest extends MediaWikiLangTestCase {
                $this->mUserMock->expects( $this->never() )
                        ->method( 'resetOptions' );
 
-               $this->mUserMock->expects( $this->at( 4 ) )
-                       ->method( 'setOption' )
-                       ->with( $this->equalTo( 'testmultiselect-opt1' ), $this->identicalTo( true ) );
-
-               $this->mUserMock->expects( $this->at( 5 ) )
-                       ->method( 'setOption' )
-                       ->with( $this->equalTo( 'testmultiselect-opt2' ), $this->identicalTo( null ) );
-
-               $this->mUserMock->expects( $this->at( 6 ) )
-                       ->method( 'setOption' )
-                       ->with( $this->equalTo( 'testmultiselect-opt3' ), $this->identicalTo( false ) );
-
-               $this->mUserMock->expects( $this->at( 7 ) )
+               $this->mUserMock->expects( $this->exactly( 4 ) )
                        ->method( 'setOption' )
-                       ->with( $this->equalTo( 'testmultiselect-opt4' ), $this->identicalTo( false ) );
+                       ->withConsecutive(
+                               [ $this->equalTo( 'testmultiselect-opt1' ), $this->identicalTo( true ) ],
+                               [ $this->equalTo( 'testmultiselect-opt2' ), $this->identicalTo( null ) ],
+                               [ $this->equalTo( 'testmultiselect-opt3' ), $this->identicalTo( false ) ],
+                               [ $this->equalTo( 'testmultiselect-opt4' ), $this->identicalTo( false ) ]
+                       );
 
                $this->mUserMock->expects( $this->once() )
                        ->method( 'saveSettings' );