/** * Tests PrinterCli::backupStart */ public function testBackupFailed() { $source = new Configuration\Backup\Source('mysqldump'); $backup = new Configuration\Backup('dummy', false); $backup->setSource($source); $printer = new PrinterCli(false, false, true); ob_start(); $printer->onBackupStart($this->getEventMock('Backup\\Start', $backup)); $printer->onBackupFailed($this->getEventMock('Backup\\Failed', $backup)); $output = ob_get_clean(); $this->assertTrue(strpos($output, 'failed') !== false); }
/** * Get the config for a single backup node. * * @param array $json * @throws \phpbu\App\Exception * @return \phpbu\App\Configuration\Backup */ private function getBackupConfig(array $json) { $name = Arr::getValue($json, 'name'); $stopOnFailure = Arr::getValue($json, 'stopOnFailure', false); $backup = new Configuration\Backup($name, $stopOnFailure); $backup->setSource($this->getSource($json)); $backup->setTarget($this->getTarget($json)); $this->setChecks($backup, $json); $this->setCrypt($backup, $json); $this->setSyncs($backup, $json); $this->setCleanup($backup, $json); return $backup; }
/** * Get the config for a single backup node. * * @param \DOMElement $backupNode * @throws \phpbu\App\Exception * @return \phpbu\App\Configuration\Backup */ private function getBackupConfig(DOMElement $backupNode) { $stopOnFailure = Str::toBoolean($backupNode->getAttribute('stopOnFailure'), false); $backupName = $backupNode->getAttribute('name'); $backup = new Configuration\Backup($backupName, $stopOnFailure); $backup->setSource($this->getSource($backupNode)); $backup->setTarget($this->getTarget($backupNode)); $this->setChecks($backup, $backupNode); $this->setCrypt($backup, $backupNode); $this->setSyncs($backup, $backupNode); $this->setCleanup($backup, $backupNode); return $backup; }