/**
* Tests for log dumps of BackupDumper
*
+ * Some of these tests use the old constuctor for TextPassDumper
+ * and the dump() function, while others use the new loadWithArgv( $args )
+ * function and execute(). This is to ensure both the old and new methods
+ * work properly.
+ *
* @group Database
* @group Dump
* @covers BackupDumper
$this->logId3 = $this->addLogEntry( 'move', 'delete',
$user2, NS_MAIN, "PageA", "SomeOtherComment",
- array( 'key1' => 1, 3 => 'value3' ) );
+ [ 'key1' => 1, 3 => 'value3' ] );
$this->assertGreaterThan( 0, $this->logId3 );
} catch ( Exception $e ) {
// We'd love to pass $e directly. However, ... see
* @param array $parameters (optional) unserialized data accompanying the log entry
*/
private function assertLogItem( $id, $user_name, $user_id, $comment, $type,
- $subtype, $title, $parameters = array()
+ $subtype, $title, $parameters = []
) {
$this->assertNodeStart( "logitem" );
// Preparing the dump
$fname = $this->getNewTempFile();
- $dumper = new BackupDumper( array( "--output=file:" . $fname ) );
+
+ $dumper = new DumpBackup( [ '--output=file:' . $fname ] );
$dumper->startId = $this->logId1;
$dumper->endId = $this->logId3 + 1;
$dumper->reporting = false;
- $dumper->setDb( $this->db );
+ $dumper->setDB( $this->db );
// Performing the dump
$dumper->dump( WikiExporter::LOGS, WikiExporter::TEXT );
$this->assertLogItem( $this->logId3, "BackupDumperLogUserB",
$this->userId2, "SomeOtherComment", "move", "delete",
- "PageA", array( 'key1' => 1, 3 => 'value3' ) );
+ "PageA", [ 'key1' => 1, 3 => 'value3' ] );
$this->assertDumpEnd();
}
// Preparing the dump
$fname = $this->getNewTempFile();
- $dumper = new BackupDumper( array( "--output=gzip:" . $fname,
- "--reporting=2" ) );
+
+ $dumper = new DumpBackup();
+ $dumper->loadWithArgv( [ '--logs', '--output=gzip:' . $fname,
+ '--reporting=2' ] );
$dumper->startId = $this->logId1;
$dumper->endId = $this->logId3 + 1;
- $dumper->setDb( $this->db );
+ $dumper->setDB( $this->db );
// xmldumps-backup demands reporting, although this is currently not
// implemented in BackupDumper, when dumping logging data. We
}
// Performing the dump
- $dumper->dump( WikiExporter::LOGS, WikiExporter::TEXT );
+ $dumper->execute();
$this->assertTrue( fclose( $dumper->stderr ), "Closing stderr handle" );
$this->assertLogItem( $this->logId3, "BackupDumperLogUserB",
$this->userId2, "SomeOtherComment", "move", "delete",
- "PageA", array( 'key1' => 1, 3 => 'value3' ) );
+ "PageA", [ 'key1' => 1, 3 => 'value3' ] );
$this->assertDumpEnd();