X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=tests%2Fphpunit%2Fincludes%2Fapi%2FApiEditPageTest.php;h=c82edf03998dd341f53e1660d7a1c74c0b2bd9f0;hb=d75a576e2606db6a719e99ca488aa700c1db487d;hp=02d0a0dc57af7c67d57810731a3e23eeb1d5151e;hpb=17914cc990c375340b688900b7782f1d7d5339fc;p=lhc%2Fweb%2Fwiklou.git diff --git a/tests/phpunit/includes/api/ApiEditPageTest.php b/tests/phpunit/includes/api/ApiEditPageTest.php index 02d0a0dc57..c82edf0399 100644 --- a/tests/phpunit/includes/api/ApiEditPageTest.php +++ b/tests/phpunit/includes/api/ApiEditPageTest.php @@ -36,14 +36,18 @@ class ApiEditPageTest extends ApiTestCase { $wgContentHandlers["testing"] = 'DummyContentHandlerForTesting'; $wgContentHandlers["testing-nontext"] = 'DummyNonTextContentHandler'; - MWNamespace::getCanonicalNamespaces( true ); # reset namespace cache + MWNamespace::clearCaches(); $wgContLang->resetNamespaces(); # reset namespace cache $this->doLogin(); } protected function tearDown() { - MWNamespace::getCanonicalNamespaces( true ); # reset namespace cache + global $wgContLang; + + MWNamespace::clearCaches(); + $wgContLang->resetNamespaces(); # reset namespace cache + parent::tearDown(); } @@ -195,16 +199,16 @@ class ApiEditPageTest extends ApiTestCase { 'section' => '9999', 'text' => 'text', ] ); - $this->fail( "Should have raised a UsageException" ); - } catch ( UsageException $e ) { - $this->assertEquals( 'nosuchsection', $e->getCodeString() ); + $this->fail( "Should have raised an ApiUsageException" ); + } catch ( ApiUsageException $e ) { + $this->assertTrue( self::apiExceptionHasCode( $e, 'nosuchsection' ) ); } } /** * Test action=edit§ion=new * Run it twice so we test adding a new section on a - * page that doesn't exist (bug 52830) and one that + * page that doesn't exist (T54830) and one that * does exist */ public function testEditNewSection() { @@ -333,8 +337,8 @@ class ApiEditPageTest extends ApiTestCase { ], null, self::$users['sysop']->getUser() ); $this->fail( 'redirect-appendonly error expected' ); - } catch ( UsageException $ex ) { - $this->assertEquals( 'redirect-appendonly', $ex->getCodeString() ); + } catch ( ApiUsageException $ex ) { + $this->assertTrue( self::apiExceptionHasCode( $ex, 'redirect-appendonly' ) ); } } @@ -369,8 +373,8 @@ class ApiEditPageTest extends ApiTestCase { ], null, self::$users['sysop']->getUser() ); $this->fail( 'edit conflict expected' ); - } catch ( UsageException $ex ) { - $this->assertEquals( 'editconflict', $ex->getCodeString() ); + } catch ( ApiUsageException $ex ) { + $this->assertTrue( self::apiExceptionHasCode( $ex, 'editconflict' ) ); } } @@ -416,7 +420,7 @@ class ApiEditPageTest extends ApiTestCase { $count++; /* - * bug 41990: if the target page has a newer revision than the redirect, then editing the + * T43990: if the target page has a newer revision than the redirect, then editing the * redirect while specifying 'redirect' and *not* specifying 'basetimestamp' erroneously * caused an edit conflict to be detected. */ @@ -474,7 +478,7 @@ class ApiEditPageTest extends ApiTestCase { public function testCheckDirectApiEditingDisallowed_forNonTextContent() { $this->setExpectedException( - 'UsageException', + 'ApiUsageException', 'Direct editing via API is not supported for content model ' . 'testing used by Dummy:ApiEditPageTest_nonTextPageEdit' );