aboutsummaryrefslogtreecommitdiffstats
path: root/tests/phpunit/includes/cache
diff options
context:
space:
mode:
authorAmir Sarabadani <ladsgroup@gmail.com>2022-05-30 14:23:30 +0200
committerAmir Sarabadani <ladsgroup@gmail.com>2022-07-12 14:46:54 +0200
commit692dde00df1a513691a64e5a3cf77c67836fa8fc (patch)
treec55b3e185c03099bada6e1a685a260b53a168255 /tests/phpunit/includes/cache
parent0b804b56f568ae90c4cf2a04e0cc93fce831f730 (diff)
downloadmediawikicore-692dde00df1a513691a64e5a3cf77c67836fa8fc.tar.gz
mediawikicore-692dde00df1a513691a64e5a3cf77c67836fa8fc.zip
Add support for write new for templatelinks migration
- schema change to allow tl_namespace and tl_title being empty This is done by removing them from primary key. They don't need to be nullable as they have default value. - Make sure with WRITE_NEW, updater avoids writing to the old columns Bug: T306674 Change-Id: I2b8a29043e952060e7a79b6a7a3d647d48cd16fb
Diffstat (limited to 'tests/phpunit/includes/cache')
-rw-r--r--tests/phpunit/includes/cache/BacklinkCacheTest.php19
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/phpunit/includes/cache/BacklinkCacheTest.php b/tests/phpunit/includes/cache/BacklinkCacheTest.php
index 7687d2337a71..5c7b153bba2d 100644
--- a/tests/phpunit/includes/cache/BacklinkCacheTest.php
+++ b/tests/phpunit/includes/cache/BacklinkCacheTest.php
@@ -140,12 +140,21 @@ class BacklinkCacheTest extends MediaWikiIntegrationTestCase {
* @covers BacklinkCache::partition
*/
public function testPartition() {
+ $targetId = $this->getServiceContainer()->getLinkTargetLookup()->acquireLinkTargetId(
+ Title::newFromText( 'BLCTest1234' ),
+ $this->db
+ );
+ $targetRow = [
+ 'tl_target_id' => $targetId,
+ 'tl_namespace' => 0,
+ 'tl_title' => 'BLCTest1234',
+ ];
$this->db->insert( 'templatelinks', [
- [ 'tl_from' => 56890, 'tl_from_namespace' => 0, 'tl_namespace' => 0, 'tl_title' => 'BLCTest1234' ],
- [ 'tl_from' => 56891, 'tl_from_namespace' => 0, 'tl_namespace' => 0, 'tl_title' => 'BLCTest1234' ],
- [ 'tl_from' => 56892, 'tl_from_namespace' => 0, 'tl_namespace' => 0, 'tl_title' => 'BLCTest1234' ],
- [ 'tl_from' => 56893, 'tl_from_namespace' => 0, 'tl_namespace' => 0, 'tl_title' => 'BLCTest1234' ],
- [ 'tl_from' => 56894, 'tl_from_namespace' => 0, 'tl_namespace' => 0, 'tl_title' => 'BLCTest1234' ],
+ [ 'tl_from' => 56890, 'tl_from_namespace' => 0 ] + $targetRow,
+ [ 'tl_from' => 56891, 'tl_from_namespace' => 0 ] + $targetRow,
+ [ 'tl_from' => 56892, 'tl_from_namespace' => 0 ] + $targetRow,
+ [ 'tl_from' => 56893, 'tl_from_namespace' => 0 ] + $targetRow,
+ [ 'tl_from' => 56894, 'tl_from_namespace' => 0 ] + $targetRow,
] );
$blcFactory = $this->getServiceContainer()->getBacklinkCacheFactory();
$backlinkCache = $blcFactory->getBacklinkCache( Title::newFromText( 'BLCTest1234' ) );