Merge "Improve 1-letter variable names in MutableContext and implementations"
[lhc/web/wiklou.git] / tests / phpunit / includes / api / ApiWatchTest.php
index 19afc14..b663dc7 100644 (file)
@@ -5,6 +5,8 @@
  * @group Database
  * @group medium
  * @todo This test suite is severly broken and need a full review
+ *
+ * @covers ApiWatch
  */
 class ApiWatchTest extends ApiTestCase {
        protected function setUp() {
@@ -16,8 +18,6 @@ class ApiWatchTest extends ApiTestCase {
                return $this->getTokenList( self::$users['sysop'] );
        }
 
-       /**
-        */
        public function testWatchEdit() {
                $tokens = $this->getTokens();
 
@@ -74,8 +74,6 @@ class ApiWatchTest extends ApiTestCase {
                return $data;
        }
 
-       /**
-        */
        public function testWatchProtect() {
                $tokens = $this->getTokens();
 
@@ -92,8 +90,6 @@ class ApiWatchTest extends ApiTestCase {
                $this->assertArrayHasKey( 'edit', $data[0]['protect']['protections'][0] );
        }
 
-       /**
-        */
        public function testGetRollbackToken() {
                $this->getTokens();
 
@@ -146,11 +142,11 @@ class ApiWatchTest extends ApiTestCase {
 
                        $this->assertArrayHasKey( 'rollback', $data[0] );
                        $this->assertArrayHasKey( 'title', $data[0]['rollback'] );
-               } catch ( UsageException $ue ) {
-                       if ( $ue->getCodeString() == 'onlyauthor' ) {
+               } catch ( ApiUsageException $ue ) {
+                       if ( self::apiExceptionHasCode( $ue, 'onlyauthor' ) ) {
                                $this->markTestIncomplete( "Only one author to 'Help:UTPage', cannot test rollback" );
                        } else {
-                               $this->fail( "Received error '" . $ue->getCodeString() . "'" );
+                               $this->fail( "Received error '" . $ue->getMessage() . "'" );
                        }
                }
        }