test(fix): Fix Config Backup UT

Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
Rubén D
2024-09-07 08:37:47 +02:00
parent 04554ed079
commit 7bd90d14b8
2 changed files with 10 additions and 8 deletions

View File

@@ -1,4 +1,5 @@
<?php
declare(strict_types=1);
/*
* sysPass
@@ -80,6 +81,7 @@ class ConfigBackupTest extends UnitaryTestCase
* @throws Exception
* @throws ServiceException
* @throws FileException
* @throws SPException
*/
public function testRestore()
{
@@ -112,6 +114,7 @@ class ConfigBackupTest extends UnitaryTestCase
* @throws Exception
* @throws ServiceException
* @throws FileException
* @throws SPException
*/
public function testRestoreWithNullData()
{
@@ -129,15 +132,16 @@ class ConfigBackupTest extends UnitaryTestCase
->method('getConfigData');
$this->expectException(ServiceException::class);
$this->expectExceptionMessage('Unable to restore the configuration');
$this->expectExceptionMessage('Unable to retrieve the configuration');
$this->configBackup->restore($configFile);
}
/**
* @throws Exception
* @throws ServiceException
* @throws FileException
* @throws SPException
* @throws ServiceException
*/
public function testRestoreWithMissingParam()
{
@@ -154,7 +158,7 @@ class ConfigBackupTest extends UnitaryTestCase
->method('getConfigData');
$this->expectException(ServiceException::class);
$this->expectExceptionMessage('Unable to restore the configuration');
$this->expectExceptionMessage('Unable to retrieve the configuration');
$this->configBackup->restore($configFile);
}
@@ -194,7 +198,7 @@ class ConfigBackupTest extends UnitaryTestCase
->willReturn(null);
$this->expectException(ServiceException::class);
$this->expectExceptionMessage('Unable to restore the configuration');
$this->expectExceptionMessage('Unable to retrieve the configuration');
$this->configBackup->getBackup();
}
@@ -206,7 +210,7 @@ class ConfigBackupTest extends UnitaryTestCase
->willThrowException(new NoSuchItemException('test'));
$this->expectException(ServiceException::class);
$this->expectExceptionMessage('Unable to restore the configuration');
$this->expectExceptionMessage('Unable to retrieve the configuration');
$this->configBackup->getBackup();
}
@@ -219,6 +223,4 @@ class ConfigBackupTest extends UnitaryTestCase
$this->configBackup = new ConfigBackup($this->configService);
}
}

View File

@@ -29,7 +29,7 @@
<Time>1531870108</Time>
<User id="1">admin</User>
<Group id="1">admin</Group>
<Hash sign="757a6ae3009a60cb9a3dd879880ea196a1799c73c9fcea51bd543430bd7a82ab">
<Hash sign="9e01c5b83d76b89f61b84c5ab546e27295ec731e3e1f12bc785ea4f08bc843e1">
da39a3ee5e6b4b0d3255bfef95601890afd80709
</Hash>
</Meta>