/** * Tests max Result life cycle. */ public function testBackupMaximalAllOk() { $conf = new Configuration('/tmp/foo.xml'); $backup = new Configuration\Backup('test-backup', false); $check = new Configuration\Backup\Check('sizemin', '10M'); $crypt = new Configuration\Backup\Crypt('mcrypt', false); $sync = new Configuration\Backup\Sync('rsync', false); $cleanup = new Configuration\Backup\Cleanup('capacity', false); $result = new Result(); $result->phpbuStart($conf); $result->backupStart($backup); $result->checkStart($check); $result->checkEnd($check); $result->cryptStart($crypt); $result->cryptEnd($crypt); $result->syncStart($sync); $result->syncEnd($sync); $result->cleanupStart($cleanup); $result->cleanupEnd($cleanup); $result->backupEnd($backup); $result->phpbuEnd(); $this->assertTrue($result->wasSuccessful(), 'should be successful'); $this->assertTrue($result->allOk(), 'should be ok'); $this->assertFalse($result->backupOkButSkipsOrFails(), 'nothing should be skipped'); $this->assertEquals(0, $result->backupsFailedCount()); $this->assertEquals(0, $result->checksFailedCount()); $this->assertEquals(0, $result->syncsFailedCount()); $this->assertEquals(0, $result->syncsSkippedCount()); $this->assertEquals(0, $result->cleanupsFailedCount()); $this->assertEquals(0, $result->cleanupsSkippedCount()); $this->assertEquals(0, $result->errorCount()); $this->assertEquals(0, count($result->getErrors())); $this->assertEquals(1, count($result->getBackups())); }