diff --git a/tests/phpunit/AbuseFilterConsequencesTest.php b/tests/phpunit/AbuseFilterConsequencesTest.php index 378dfd4e1..ceffa0477 100644 --- a/tests/phpunit/AbuseFilterConsequencesTest.php +++ b/tests/phpunit/AbuseFilterConsequencesTest.php @@ -473,8 +473,7 @@ class AbuseFilterConsequencesTest extends MediaWikiIntegrationTestCase { $status = $this->editPage( $page, $oldText, - __METHOD__ . ' page creation', - $title->getNamespace() + __METHOD__ . ' page creation' ); if ( !$status->isGood() ) { throw new Exception( "Could not create test page. $status" ); @@ -517,7 +516,7 @@ class AbuseFilterConsequencesTest extends MediaWikiIntegrationTestCase { $page, $newText, $summary, - $title->getNamespace(), + NS_MAIN, $this->user ); } @@ -1566,7 +1565,7 @@ class AbuseFilterConsequencesTest extends MediaWikiIntegrationTestCase { // Filter 24 has no actions and always matches $this->createFilters( [ 24 ] ); - $targetTitle = Title::newFromText( 'TestRevIdSet' ); + $targetTitle = Title::makeTitle( NS_MAIN, 'TestRevIdSet' ); $startingRevId = $targetTitle->getLatestRevID( Title::READ_LATEST ); $this->doEdit( $targetTitle, 'Old text', 'New text', 'Summary' ); diff --git a/tests/phpunit/LazyVariableComputerDBTest.php b/tests/phpunit/LazyVariableComputerDBTest.php index f65583320..425a292ed 100644 --- a/tests/phpunit/LazyVariableComputerDBTest.php +++ b/tests/phpunit/LazyVariableComputerDBTest.php @@ -32,12 +32,11 @@ class LazyVariableComputerDBTest extends MediaWikiIntegrationTestCase { * @dataProvider provideEditRelatedVars */ public function testEditRelatedVars( $oldText, $newText, $summary, array $expected ) { - $pageName = __METHOD__; - $title = Title::makeTitle( 0, $pageName ); + $title = Title::makeTitle( NS_MAIN, 'TestEditRelatedVars' ); $page = $this->getServiceContainer()->getWikiPageFactory()->newFromTitle( $title ); - $this->editPage( $pageName, $oldText, 'Creating the test page' ); - $this->editPage( $pageName, $newText, $summary ); + $this->editPage( $page, $oldText, 'Creating the test page' ); + $this->editPage( $page, $newText, $summary ); $baseVars = VariableHolder::newFromArray( [ 'old_wikitext' => $oldText, @@ -155,19 +154,19 @@ class LazyVariableComputerDBTest extends MediaWikiIntegrationTestCase { $user = $this->getMutableTestUser()->getUser(); // Create the page and make a couple of edits from different users $this->editPage( - $title->getText(), + $title, 'AbuseFilter test for title variables', '', - $title->getNamespace(), + NS_MAIN, $user ); $mockContributors = [ 'X>Alice', 'X>Bob', 'X>Charlie' ]; foreach ( $mockContributors as $contributor ) { $this->editPage( - $title->getText(), + $title, "page revision by $contributor", '', - $title->getNamespace(), + NS_MAIN, User::newFromName( $contributor, false ) ); } @@ -182,8 +181,7 @@ class LazyVariableComputerDBTest extends MediaWikiIntegrationTestCase { */ public function testRecentContributors() { $varName = "page_recent_contributors"; - $pageName = "Page to test $varName"; - $title = Title::newFromText( $pageName ); + $title = Title::makeTitle( NS_MAIN, "Page to test $varName" ); $expected = $this->computeRecentContributors( $title ); $computer = AbuseFilterServices::getLazyVariableComputer();