function it_can_create_backups_for_local(Manager $manager, BackupProcedure $procedure) { $file = date('Y-m-d-H-i-s') . '_backup.sql'; $manager->makeBackup()->willReturn($procedure); $procedure->run('mysql', 'local', $file, 'gzip')->shouldBeCalled(); $this->beConstructedWith($manager, 'mysql', 'local'); $this->create()->shouldReturn($file . '.gz'); }
/** * Execute the console command. * * @return mixed */ public function fire() { $destination = 'db/' . date('d-m-Y') . '-' . time(); $this->manager->makeBackup()->run('mysql', 'dropbox', $destination, 'gzip'); }
/** * Creates a new database backup * * @param string $file Optional filename for the backup file * @return string */ public function create($file = null) { $file = $file ?: date('Y-m-d-H-i-s') . '_backup.sql'; $this->manager->makeBackup()->run($this->database, $this->destination, $file, 'gzip'); return $file . '.gz'; }