diff options
author | Wandji69 <collinschuwa@gmail.com> | 2024-06-13 17:53:25 +0100 |
---|---|---|
committer | Wandji69 <collinschuwa@gmail.com> | 2024-06-23 23:47:56 +0100 |
commit | c257e2276c8bbd57c85a516722eb047b3af2ebb9 (patch) | |
tree | bfa24e0f5f4d522744616c9c61979e00d96ac429 /tests/phpunit/includes/page | |
parent | ed919c186be3598edf7df9f0adfe971f76f88908 (diff) | |
download | mediawikicore-c257e2276c8bbd57c85a516722eb047b3af2ebb9.tar.gz mediawikicore-c257e2276c8bbd57c85a516722eb047b3af2ebb9.zip |
Replace db with getDb for Tests
Bug: T316841
Change-Id: I29e535e8ee9b5641a4546d53b98cd5060d39681d
Diffstat (limited to 'tests/phpunit/includes/page')
-rw-r--r-- | tests/phpunit/includes/page/MovePageTest.php | 2 | ||||
-rw-r--r-- | tests/phpunit/includes/page/PageArchiveTest.php | 6 | ||||
-rw-r--r-- | tests/phpunit/includes/page/PageStoreTest.php | 4 | ||||
-rw-r--r-- | tests/phpunit/includes/page/WikiPageDbTest.php | 8 |
4 files changed, 10 insertions, 10 deletions
diff --git a/tests/phpunit/includes/page/MovePageTest.php b/tests/phpunit/includes/page/MovePageTest.php index 574ceb5a49f2..895d0ee9bfe2 100644 --- a/tests/phpunit/includes/page/MovePageTest.php +++ b/tests/phpunit/includes/page/MovePageTest.php @@ -548,7 +548,7 @@ class MovePageTest extends MediaWikiIntegrationTestCase { // do a cross-namespace move $new = Title::makeTitle( NS_PROJECT, __METHOD__ ); - $obj = $this->newMovePageWithMocks( $old, $new, [ 'db' => $this->db ] ); + $obj = $this->newMovePageWithMocks( $old, $new, [ 'db' => $this->getDb() ] ); $status = $obj->move( $this->getTestUser()->getUser() ); // sanity checks diff --git a/tests/phpunit/includes/page/PageArchiveTest.php b/tests/phpunit/includes/page/PageArchiveTest.php index 11fefe6ca7bf..024538e285a9 100644 --- a/tests/phpunit/includes/page/PageArchiveTest.php +++ b/tests/phpunit/includes/page/PageArchiveTest.php @@ -142,11 +142,11 @@ class PageArchiveTest extends MediaWikiIntegrationTestCase { 'ar_user' => null, 'ar_user_text' => $this->ipEditor, 'ar_actor' => (string)$this->getServiceContainer()->getActorNormalization() - ->acquireActorId( new UserIdentityValue( 0, $this->ipEditor ), $this->db ), + ->acquireActorId( new UserIdentityValue( 0, $this->ipEditor ), $this->getDb() ), 'ar_len' => '11', 'ar_deleted' => '0', 'ar_rev_id' => strval( $this->ipRev->getId() ), - 'ar_timestamp' => $this->db->timestamp( $this->ipRev->getTimestamp() ), + 'ar_timestamp' => $this->getDb()->timestamp( $this->ipRev->getTimestamp() ), 'ar_sha1' => '0qdrpxl537ivfnx4gcpnzz0285yxryy', 'ar_page_id' => strval( $this->ipRev->getPageId() ), 'ar_comment_text' => 'just a test', @@ -166,7 +166,7 @@ class PageArchiveTest extends MediaWikiIntegrationTestCase { 'ar_len' => '7', 'ar_deleted' => '0', 'ar_rev_id' => strval( $this->firstRev->getId() ), - 'ar_timestamp' => $this->db->timestamp( $this->firstRev->getTimestamp() ), + 'ar_timestamp' => $this->getDb()->timestamp( $this->firstRev->getTimestamp() ), 'ar_sha1' => 'pr0s8e18148pxhgjfa0gjrvpy8fiyxc', 'ar_page_id' => strval( $this->firstRev->getPageId() ), 'ar_comment_text' => 'testing', diff --git a/tests/phpunit/includes/page/PageStoreTest.php b/tests/phpunit/includes/page/PageStoreTest.php index a327700e51ba..2ba4d15bc1bc 100644 --- a/tests/phpunit/includes/page/PageStoreTest.php +++ b/tests/phpunit/includes/page/PageStoreTest.php @@ -131,7 +131,7 @@ class PageStoreTest extends MediaWikiIntegrationTestCase { * @covers \MediaWiki\Page\PageStore::getPageForLink */ public function testGetPageForLink_crossWiki() { - $wikiId = $this->db->getDomainID(); // pretend sister site + $wikiId = $this->getDb()->getDomainID(); // pretend sister site $nonexistingPage = $this->getNonexistingTestPage(); $pageStore = $this->getPageStore( [], [ 'wikiId' => $wikiId, 'linkCache' => null ] ); @@ -663,7 +663,7 @@ class PageStoreTest extends MediaWikiIntegrationTestCase { $existingPage = $this->getExistingTestPage(); $pageStore = $this->getPageStore(); - $row = $this->db->newSelectQueryBuilder() + $row = $this->getDb()->newSelectQueryBuilder() ->select( $pageStore->getSelectFields() ) ->from( 'page' ) ->where( [ 'page_id' => $existingPage->getId() ] ) diff --git a/tests/phpunit/includes/page/WikiPageDbTest.php b/tests/phpunit/includes/page/WikiPageDbTest.php index f9ef7c6be00b..ce4b21f15b6d 100644 --- a/tests/phpunit/includes/page/WikiPageDbTest.php +++ b/tests/phpunit/includes/page/WikiPageDbTest.php @@ -391,7 +391,7 @@ class WikiPageDbTest extends MediaWikiLangTestCase { // as long as no garbage is written to the database. } - $row = $this->db->newSelectQueryBuilder() + $row = $this->getDb()->newSelectQueryBuilder() ->select( '*' ) ->from( 'page' ) ->where( [ 'page_namespace' => $title->getNamespace(), 'page_title' => $title->getDBkey() ] ) @@ -1406,7 +1406,7 @@ more stuff ] ] ); // Check the page_random field has been filled - $pageRandom = $this->db->newSelectQueryBuilder() + $pageRandom = $this->getDb()->newSelectQueryBuilder() ->select( 'page_random' ) ->from( 'page' ) ->where( $condition ) @@ -1414,7 +1414,7 @@ more stuff $this->assertTrue( (float)$pageRandom < 1 && (float)$pageRandom > 0 ); // Assert the touched timestamp in the DB is roughly when we inserted the page - $pageTouched = $this->db->newSelectQueryBuilder() + $pageTouched = $this->getDb()->newSelectQueryBuilder() ->select( 'page_touched' ) ->from( 'page' ) ->where( $condition ) @@ -1853,7 +1853,7 @@ more stuff public function testGetTouched() { $page = $this->createPage( __METHOD__, 'whatever' ); - $touched = $this->db->newSelectQueryBuilder() + $touched = $this->getDb()->newSelectQueryBuilder() ->select( 'page_touched' ) ->from( 'page' ) ->where( [ 'page_id' => $page->getId() ] ) |