@@ -181,6 +181,7 @@ public function testMediaRollback()
181
181
public function testDbBackup ()
182
182
{
183
183
$ this ->setupDbBackupRollback ();
184
+ $ this ->database ->expects ($ this ->once ())->method ('getBackupFilename ' )->willReturn ('RollbackFile_A.gz ' );
184
185
$ this ->database ->expects ($ this ->once ())->method ('create ' );
185
186
$ this ->file ->expects ($ this ->once ())->method ('isExists ' )->willReturn (false );
186
187
$ this ->file ->expects ($ this ->once ())->method ('createDirectory ' );
@@ -190,12 +191,20 @@ public function testDbBackup()
190
191
public function testDbRollback ()
191
192
{
192
193
$ this ->setupDbBackupRollback ();
194
+
193
195
$ this ->database ->expects ($ this ->once ())->method ('rollback ' );
196
+ $ this ->database ->expects ($ this ->exactly (2 ))->method ('getBackupFilename ' )
197
+ ->willReturnOnConsecutiveCalls ('test ' , '1510140748_db_test_backup ' );
198
+ $ this ->database ->expects ($ this ->once ())->method ('getTime ' )->willReturn (1510140748 );
199
+ $ this ->database ->expects ($ this ->once ())->method ('getType ' )->willReturn ('db ' );
200
+ $ this ->database ->expects ($ this ->once ())->method ('setName ' )->with (' test backup ' );
201
+
194
202
$ this ->file ->expects ($ this ->once ())
195
203
->method ('isExists ' )
196
- ->with ($ this ->path . '/backups/12345_db .sql ' )
204
+ ->with ($ this ->path . '/backups/1510140748_db_test_backup .sql ' )
197
205
->willReturn (true );
198
- $ this ->model ->dbRollback ('12345_db.sql ' );
206
+
207
+ $ this ->model ->dbRollback ('1510140748_db_test_backup.sql ' );
199
208
}
200
209
201
210
private function setupCodeBackupRollback ()
@@ -226,9 +235,6 @@ private function setupDbBackupRollback()
226
235
->method ('setBackupExtension ' );
227
236
$ this ->database ->expects ($ this ->once ())
228
237
->method ('setTime ' );
229
- $ this ->database ->expects ($ this ->once ())
230
- ->method ('getBackupFilename ' )
231
- ->willReturn ('RollbackFile_A.gz ' );
232
238
$ this ->database ->expects ($ this ->atLeastOnce ())
233
239
->method ('getBackupPath ' )
234
240
->willReturn ('pathToFile/12345_db.sql ' );
0 commit comments