File tree Expand file tree Collapse file tree 2 files changed +19
-7
lines changed
tests/phpbu/Backup/Source Expand file tree Collapse file tree 2 files changed +19
-7
lines changed Original file line number Diff line number Diff line change @@ -226,13 +226,8 @@ protected function createStatus(Target $target) : Status
226226 */
227227 public function restore (Target $ target , Plan $ plan ): Status
228228 {
229- $ plan ->addRestoreCommand (
230- sprintf (
231- 'cp %s %s ' ,
232- $ target ->getPathnamePlain (),
233- $ this ->pathToRedisData
234- )
235- );
229+ $ cmd = sprintf ('cp %s %s ' , $ target ->getPathnamePlain (), $ this ->pathToRedisData );
230+ $ plan ->addRestoreCommand ($ cmd );
236231
237232 return Status::create ()->uncompressedFile ($ target ->getPathnamePlain ());
238233 }
Original file line number Diff line number Diff line change 22namespace phpbu \App \Backup \Source ;
33
44use phpbu \App \Backup \CliMockery ;
5+ use phpbu \App \Backup \Restore \Plan ;
56use phpbu \App \BaseMockery ;
67use PHPUnit \Framework \TestCase ;
78
@@ -166,4 +167,20 @@ public function testBackupSaveFail()
166167
167168 $ redis ->backup ($ target , $ appResult );
168169 }
170+
171+ /**
172+ * Tests Redis::restore
173+ */
174+ public function testRestore ()
175+ {
176+ $ plan = new Plan ();
177+ $ target = $ this ->createTargetMock ('/tmp/backup.redis ' );
178+ $ rdbPath = PHPBU_TEST_FILES . '/misc/dump.rdb ' ;
179+
180+ $ redis = new Redis ();
181+ $ redis ->setup (['pathToRedisData ' => $ rdbPath , 'pathToRedisCli ' => PHPBU_TEST_BIN ]);
182+ $ redis ->restore ($ target , $ plan );
183+
184+ $ this ->assertCount (1 , $ plan ->getRestoreCommands ());
185+ }
169186}
You can’t perform that action at this time.
0 commit comments