This commit is contained in:
Bozhidar 2024-04-25 15:26:18 +03:00
parent 85d1d1bc2a
commit 6d76e0d19c
2 changed files with 16 additions and 1 deletions

View file

@ -4,6 +4,14 @@ namespace App;
class Helpers class Helpers
{ {
public static function extractTar($tarFile, $extractPath)
{
shell_exec('mkdir -p ' . $extractPath);
$exec = shell_exec('tar -xvf ' . $tarFile . ' -C ' . $extractPath);
return $exec;
}
public static function checkPathSize($path) public static function checkPathSize($path)
{ {

View file

@ -65,9 +65,16 @@ class BackupTest extends ActionTestCase
$getFilesize = filesize($findBackup->filepath); $getFilesize = filesize($findBackup->filepath);
$this->assertGreaterThan(0, $getFilesize); $this->assertGreaterThan(0, $getFilesize);
$this->assertSame(Helpers::checkPathSize($findBackup->path), $findBackup->size); $this->assertSame(Helpers::checkPathSize($findBackup->path), $findBackup->size);
Helpers::extractTar($findBackup->filepath, $findBackup->path . '/unit-test');
$this->assertTrue(is_dir($findBackup->path . '/unit-test'));
$this->assertTrue(is_dir($findBackup->path . '/unit-test/' . $hostingSubscription->system_username));
$this->assertTrue(is_dir($findBackup->path . '/unit-test/' . $hostingSubscription->system_username . '/public_html'));
$this->assertTrue(is_dir($findBackup->path . '/unit-test/' . $hostingSubscription->system_username . '/public_html/cgi-bin'));
$this->assertTrue(is_file($findBackup->path . '/unit-test/' . $hostingSubscription->system_username . '/public_html/index.php'));
} }
} }