mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-11 10:56:58 +01:00
chore(tests): UT for ItemPreset
Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link https://syspass.org
|
||||
* @copyright 2012-2023, Rubén Domínguez nuxsmin@$syspass.org
|
||||
* @copyright 2012-2024, Rubén Domínguez nuxsmin@$syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
@@ -29,7 +29,7 @@ use JsonException;
|
||||
use SP\Core\Application;
|
||||
use SP\Core\Events\Event;
|
||||
use SP\Core\Events\EventMessage;
|
||||
use SP\DataModel\FileData;
|
||||
use SP\DataModel\FileItemWithIdAndName;
|
||||
use SP\Domain\Account\Ports\AccountFileService;
|
||||
use SP\Domain\Account\Ports\AccountService;
|
||||
use SP\Domain\Core\Exceptions\SPException;
|
||||
@@ -92,7 +92,7 @@ final class UploadController extends ControllerBase
|
||||
try {
|
||||
$fileHandler = new FileHandler($file['tmp_name']);
|
||||
|
||||
$fileData = new FileData();
|
||||
$fileData = new FileItemWithIdAndName();
|
||||
$fileData->setAccountId($accountId);
|
||||
$fileData->setName(htmlspecialchars($file['name'], ENT_QUOTES));
|
||||
$fileData->setSize($file['size']);
|
||||
@@ -161,14 +161,14 @@ final class UploadController extends ControllerBase
|
||||
}
|
||||
|
||||
/**
|
||||
* @param FileData $fileData
|
||||
* @param FileItemWithIdAndName $fileData
|
||||
* @param FileHandlerInterface $fileHandler
|
||||
*
|
||||
* @return string
|
||||
* @throws SPException
|
||||
* @throws FileException
|
||||
*/
|
||||
private function checkAllowedMimeType(FileData $fileData, FileHandlerInterface $fileHandler): string
|
||||
private function checkAllowedMimeType(FileItemWithIdAndName $fileData, FileHandlerInterface $fileHandler): string
|
||||
{
|
||||
if (in_array($fileData->getType(), $this->configData->getFilesAllowedMime(), true)) {
|
||||
return $fileData->getType();
|
||||
|
||||
Reference in New Issue
Block a user