chore: Fix unitary tests

Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
Rubén D
2022-11-06 17:34:32 +01:00
parent 6a71fe3372
commit 2ccce01acb
7 changed files with 109 additions and 358 deletions

View File

@@ -22,7 +22,7 @@
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
namespace SP\Tests\Services\Backup;
namespace SP\Tests\Domain\Export\Services;
use SP\Core\PhpExtensionChecker;
use SP\Domain\Export\Services\BackupFiles;
@@ -41,7 +41,6 @@ use SP\Tests\UnitaryTestCase;
class FileBackupServiceTest extends UnitaryTestCase
{
private FileBackupService $fileBackupService;
private BackupFiles $backupFiles;
/**
* @throws \SP\Domain\Common\Services\ServiceException
@@ -77,18 +76,18 @@ class FileBackupServiceTest extends UnitaryTestCase
FileBackupService::BACKUP_INCLUDE_REGEX
);
$this->backupFiles = $this->getMockBuilder(BackupFiles::class)
$backupFiles = $this->getMockBuilder(BackupFiles::class)
->onlyMethods(['getDbBackupArchiveHandler', 'getAppBackupArchiveHandler'])
->setConstructorArgs([new PhpExtensionChecker()])
->getMock();
$this->backupFiles->method('getDbBackupArchiveHandler')->willReturn($archiveHandler);
$this->backupFiles->method('getAppBackupArchiveHandler')->willReturn($archiveHandler);
$backupFiles->method('getDbBackupArchiveHandler')->willReturn($archiveHandler);
$backupFiles->method('getAppBackupArchiveHandler')->willReturn($archiveHandler);
$this->fileBackupService = new FileBackupService(
$this->application,
$database,
$this->createStub(DatabaseUtil::class),
$this->backupFiles
$backupFiles
);
}
}

View File

@@ -22,7 +22,7 @@
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
namespace SP\Tests\Services\Install;
namespace SP\Tests\Domain\Install\Services;
use Exception;
use SP\Core\Exceptions\InvalidArgumentException;

View File

@@ -22,7 +22,7 @@
* along with sysPass. If not, see <http://www.gnu.org/licenses/>.
*/
namespace SP\Tests\Services\Install;
namespace SP\Tests\Domain\Install\Services;
use PDOException;
use SP\Core\Exceptions\SPException;

View File

@@ -1,4 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ sysPass
~
~ @author nuxsmin
~ @link https://syspass.org
~ @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org
~
~ This file is part of sysPass.
~
~ sysPass is free software: you can redistribute it and/or modify
~ it under the terms of the GNU General Public License as published by
~ the Free Software Foundation, either version 3 of the License, or
~ (at your option) any later version.
~
~ sysPass is distributed in the hope that it will be useful,
~ but WITHOUT ANY WARRANTY; without even the implied warranty of
~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
~ along with sysPass. If not, see <http://www.gnu.org/licenses/>.
-->
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
@@ -41,8 +64,8 @@
<directory suffix=".php">./SP/Modules/Cli</directory>
</testsuite>
<testsuite name="unitary">
<directory suffix=".php">./SP/Services/Install</directory>
<directory suffix=".php">./SP/Services/Backup</directory>
<directory suffix=".php">./SP/Domain</directory>
<directory suffix=".php">./SP/Infrastructure</directory>
</testsuite>
</testsuites>
<logging/>