+ function tearDown() {
+ parent::tearDown();
+
+ if ( isset( $this->streamingLoadBalancer ) ) {
+ $this->streamingLoadBalancer->closeAll();
+ }
+ }
+
+ /**
+ * Returns a new database connection which is separate from the conenctions returned
+ * by the default LoadBalancer instance.
+ *
+ * @return IDatabase
+ */
+ private function newStreamingDBConnection() {
+ // Create a *new* LoadBalancer, so no connections are shared
+ if ( !$this->streamingLoadBalancer ) {
+ $lbFactory = MediaWikiServices::getInstance()->getDBLoadBalancerFactory();
+
+ $this->streamingLoadBalancer = $lbFactory->newMainLB();
+ }
+
+ $db = $this->streamingLoadBalancer->getConnection( DB_REPLICA );
+
+ // Make sure the DB connection has the fake table clones and the fake table prefix
+ MediaWikiTestCase::setupDatabaseWithTestPrefix( $db );
+
+ // Make sure the DB connection has all the test data
+ $this->copyTestData( $this->db, $db );
+
+ return $db;
+ }
+
+ /**
+ * @param array $argv
+ * @param int $startId
+ * @param int $endId
+ *
+ * @return DumpBackup
+ */
+ private function newDumpBackup( $argv, $startId, $endId ) {
+ $dumper = new DumpBackup( $argv );
+ $dumper->startId = $startId;
+ $dumper->endId = $endId;
+ $dumper->reporting = false;
+
+ // NOTE: The copyTestData() method used by newStreamingDBConnection()
+ // doesn't work with SQLite (T217607).
+ // But DatabaseSqlite doesn't support streaming anyway, so just skip that part.
+ if ( $this->db->getType() === 'sqlite' ) {
+ $dumper->setDB( $this->db );
+ } else {
+ $dumper->setDB( $this->newStreamingDBConnection() );
+ }
+
+ return $dumper;
+ }
+
+ public function schemaVersionProvider() {
+ foreach ( XmlDumpWriter::$supportedSchemas as $schemaVersion ) {
+ yield [ $schemaVersion ];
+ }
+ }
+
+ /**
+ * @dataProvider schemaVersionProvider
+ */
+ function testFullTextPlain( $schemaVersion ) {