mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-08 09:26:57 +01:00
chore: Create tests for AccountFileService
Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
@@ -48,17 +48,12 @@ use function SP\__u;
|
||||
*/
|
||||
final class AccountFileService extends Service implements AccountFileServiceInterface
|
||||
{
|
||||
private AccountFileRepositoryInterface $accountFileRepository;
|
||||
private ImageUtilInterface $imageUtil;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
AccountFileRepositoryInterface $accountFileRepository,
|
||||
ImageUtilInterface $imageUtil
|
||||
private AccountFileRepositoryInterface $accountFileRepository,
|
||||
private ImageUtilInterface $imageUtil
|
||||
) {
|
||||
$this->accountFileRepository = $accountFileRepository;
|
||||
$this->imageUtil = $imageUtil;
|
||||
|
||||
parent::__construct($application);
|
||||
}
|
||||
|
||||
|
||||
@@ -64,6 +64,27 @@ class AccountFileServiceTest extends UnitaryTestCase
|
||||
$this->accountFileService->create($fileData);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws \SP\Core\Exceptions\InvalidImageException
|
||||
* @throws \SP\Core\Exceptions\QueryException
|
||||
* @throws \SP\Core\Exceptions\ConstraintException
|
||||
*/
|
||||
public function testCreateWithThumbnail(): void
|
||||
{
|
||||
$fileData = FileData::buildFromSimpleModel(FileDataGenerator::factory()->buildFileData());
|
||||
$fileData->type = 'image/jpeg';
|
||||
|
||||
$this->accountFileRepository
|
||||
->expects(self::once())
|
||||
->method('create')
|
||||
->with($fileData);
|
||||
$this->imageUtil
|
||||
->expects(self::once())
|
||||
->method('createThumbnail');
|
||||
|
||||
$this->accountFileService->create($fileData);
|
||||
}
|
||||
|
||||
public function testGetById(): void
|
||||
{
|
||||
$fileData = FileExtData::buildFromSimpleModel(FileDataGenerator::factory()->buildFileExtData());
|
||||
|
||||
Reference in New Issue
Block a user