public function BackupMigrateDestinationFake::list_files in Backup and migrate prune 7
Same name and namespace in other branches
- 7.2 backup_migrate_prune.test \BackupMigrateDestinationFake::list_files()
Overwrites list_files to return a fake list of files
File
- ./
backup_migrate_prune.test, line 131 - Test implementation file
Class
- BackupMigrateDestinationFake
- Fake destination for test purposes
Code
public function list_files() {
$files = array();
$datetime = new \DateTime(BackupMigratePruneTestCase::DATEINIT, new \DateTimeZone('Europe/Berlin'));
$datetime_end = new \DateTime(BackupMigratePruneTestCase::DATEEND, new \DateTimeZone('Europe/Berlin'));
$interval = new \DateInterval(BackupMigratePruneTestCase::TIMEINTERVAL);
do {
$timestamp = $datetime
->getTimestamp();
$filename = "BackupMigratePruneTest-" . $datetime
->format("Y-m-d\\TH-i-s") . '.mysql.gz';
global $base_url;
$file_info = array(
'filename' => $filename,
'description' => '',
'datestamp' => $timestamp,
'generator' => 'BackupMigrateDestinationFake',
'generatorversion' => '7.x-1.x',
'sites' => array(
array(
'version' => VERSION,
'name' => 'BackupMigrateDestinationTest',
'url' => $base_url,
),
),
'filesize' => mt_rand(1024, 4096),
'filetime' => $timestamp,
);
$file = new BackupFileFake();
$file
->set_file_info($file_info);
$files[$filename] = $file;
$datetime
->add($interval);
} while ($datetime < $datetime_end);
return $files;
}