Skip to content

Commit

Permalink
Fezfez patch 1 (#36)
Browse files Browse the repository at this point in the history
* Update Restore.php

* fix ci

* fix ci

* merge master
  • Loading branch information
fezfez authored Jan 6, 2023
1 parent 1576807 commit 09dd831
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/BackupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@ public function backup(
LocalFilesystemAdapter $localFileSystem,
Database $database,
array $destinations,
string $localTmpPath,
Compressor ...$compression,
): void {
$this->backupProcedure->__invoke($localFileSystem, $database, $destinations, $localTmpPath, ...$compression);
$this->backupProcedure->__invoke($localFileSystem, $database, $destinations, ...$compression);
}

public function restore(
Expand Down
1 change: 0 additions & 1 deletion src/BackupManagerContract.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public function backup(
LocalFilesystemAdapter $localFileSystem,
Database $database,
array $destinations,
string $localTmpPath,
Compressor ...$compression,
): void;

Expand Down
3 changes: 1 addition & 2 deletions src/Procedures/Backup.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@ public function __invoke(
LocalFilesystemAdapter $localFileSystem,
Database $database,
array $destinations,
string $localTmpPath,
Compressor ...$compressorList,
): void {
$tmpPath = sprintf('%s/%s', $localTmpPath, uniqid());
$tmpPath = sprintf('%s/%s', $localFileSystem->getRootPath(), uniqid());

$this->shellProcessor->__invoke(Process::fromShellCommandline($database->getDumpCommandLine($tmpPath)));

Expand Down
1 change: 0 additions & 1 deletion src/Procedures/BackupProcedure.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public function __invoke(
LocalFilesystemAdapter $localFileSystem,
Database $database,
array $destinations,
string $localTmpPath,
Compressor ...$compressor,
): void;
}
2 changes: 1 addition & 1 deletion src/Procedures/Restore.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function __invoke(
Compressor ...$compressorList,
): void {
// begin the life of a new working file
$workingFile = sprintf('%s/%s', basename($sourcePath), uniqid());
$workingFile = sprintf('%s/%s', $localFileSystem->getRootPath(), uniqid()) . '.gz';

// download or retrieve the archived backup file

Expand Down
4 changes: 2 additions & 2 deletions tests/BackupManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public function testCreateABackupProcedure(): void

$sUT = new BackupManager($backupProcedure, $restoreProcedure);

$backupProcedure->expects(self::once())->method('__invoke')->with($local, $database, [$destination], 'tutu', $compressor);
$backupProcedure->expects(self::once())->method('__invoke')->with($local, $database, [$destination], $compressor);
$restoreProcedure->expects(self::once())->method('__invoke')->with($local, $to, 'toto', $database, $compressor);

$sUT->backup($local, $database, [$destination], 'tutu', $compressor);
$sUT->backup($local, $database, [$destination], $compressor);
$sUT->restore($local, $to, 'toto', $database, $compressor);
}
}
2 changes: 1 addition & 1 deletion tests/Procedures/BackupTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,6 @@ public function testOk(): void
$local->expects(self::once())->method('readStream')->with('my compressd path')->willReturn($ressource);
$local->expects(self::once())->method('delete')->with('my compressd path');

$sUT->__invoke($local, $database, [$destination], 'my tmp path', $compressor);
$sUT->__invoke($local, $database, [$destination], $compressor);
}
}

0 comments on commit 09dd831

Please sign in to comment.