You are here

public function BackupMigratePruneTestCase::testPrune in Backup and migrate prune 7.2

Same name and namespace in other branches
  1. 7 backup_migrate_prune.test \BackupMigratePruneTestCase::testPrune()

Test Gardener::save() method

See also

Gardener::save()

File

./backup_migrate_prune.test, line 83
Test implementation file

Class

BackupMigratePruneTestCase
BackupMigratePruneTestCase class for unit testing

Code

public function testPrune() {
  $gardener = new GardenerFake();
  $gardener
    ->setDateReference(BackupMigratePruneTestCase::DATEEND);
  $deleted = $gardener
    ->prune();

  // The fixture should contains 1522 files
  // We will keep:
  //   - 1 from today
  //   - 6 from this week
  //   - 4 from this month (Oct has 5 weeks)
  //   - 11 from this year
  //   - 2 from past years
  // This sums up 24 files to be kept
  $this
    ->assertEqual($deleted, 1498, '1498 files should be deleted.');
}