chore(tests): UT for UserProfile service

Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
Rubén D
2024-04-07 08:42:47 +02:00
parent f8ce2f1821
commit 1fd39467fd
19 changed files with 387 additions and 129 deletions

View File

@@ -34,7 +34,7 @@ use SP\Domain\Core\Acl\AclActionsInterface;
use SP\Domain\Core\Exceptions\ConstraintException;
use SP\Domain\Core\Exceptions\QueryException;
use SP\Domain\User\Ports\UserGroupService;
use SP\Domain\User\Ports\UserProfileServiceInterface;
use SP\Domain\User\Ports\UserProfileService;
use SP\Domain\User\Ports\UserServiceInterface;
use SP\Html\DataGrid\DataGridTab;
use SP\Modules\Web\Controllers\ControllerBase;
@@ -61,9 +61,9 @@ final class IndexController extends ControllerBase
private AuthTokenGrid $authTokenGrid;
private PublicLinkGrid $publicLinkGrid;
private UserServiceInterface $userService;
private UserGroupService $userGroupService;
private UserProfileServiceInterface $userProfileService;
private AuthTokenService $authTokenService;
private UserGroupService $userGroupService;
private UserProfileService $userProfileService;
private AuthTokenService $authTokenService;
private PublicLinkService $publicLinkService;
public function __construct(
@@ -77,7 +77,7 @@ final class IndexController extends ControllerBase
PublicLinkGrid $publicLinkGrid,
UserServiceInterface $userService,
UserGroupService $userGroupService,
UserProfileServiceInterface $userProfileService,
UserProfileService $userProfileService,
AuthTokenService $authTokenService,
PublicLinkService $publicLinkService
) {

View File

@@ -49,7 +49,7 @@ use SP\Domain\Export\Services\BackupFileHelper;
use SP\Domain\Export\Services\XmlExport;
use SP\Domain\Task\Services\Task;
use SP\Domain\User\Ports\UserGroupService;
use SP\Domain\User\Ports\UserProfileServiceInterface;
use SP\Domain\User\Ports\UserProfileService;
use SP\Domain\User\Ports\UserServiceInterface;
use SP\Infrastructure\Common\Repositories\NoSuchItemException;
use SP\Infrastructure\Database\DatabaseUtil;
@@ -75,26 +75,26 @@ final class IndexController extends ControllerBase
{
protected TabsHelper $tabsHelper;
private UserServiceInterface $userService;
private UserGroupService $userGroupService;
private UserProfileServiceInterface $userProfileService;
private MimeTypesService $mimeTypes;
private UserGroupService $userGroupService;
private UserProfileService $userProfileService;
private MimeTypesService $mimeTypes;
private DatabaseUtil $databaseUtil;
private ConfigService $configService;
private AccountService $accountService;
private PluginManager $pluginManager;
public function __construct(
Application $application,
WebControllerHelper $webControllerHelper,
TabsHelper $tabsHelper,
UserServiceInterface $userService,
UserGroupService $userGroupService,
UserProfileServiceInterface $userProfileService,
MimeTypesService $mimeTypes,
DatabaseUtil $databaseUtil,
ConfigService $configService,
AccountService $accountService,
PluginManager $pluginManager
Application $application,
WebControllerHelper $webControllerHelper,
TabsHelper $tabsHelper,
UserServiceInterface $userService,
UserGroupService $userGroupService,
UserProfileService $userProfileService,
MimeTypesService $mimeTypes,
DatabaseUtil $databaseUtil,
ConfigService $configService,
AccountService $accountService,
PluginManager $pluginManager
) {
parent::__construct($application, $webControllerHelper);

View File

@@ -36,7 +36,7 @@ use SP\Domain\Core\Exceptions\QueryException;
use SP\Domain\Http\RequestInterface;
use SP\Domain\ItemPreset\Models\ItemPreset;
use SP\Domain\User\Ports\UserGroupService;
use SP\Domain\User\Ports\UserProfileServiceInterface;
use SP\Domain\User\Ports\UserProfileService;
use SP\Domain\User\Ports\UserServiceInterface;
use SP\Mvc\View\Components\SelectItemAdapter;
use SP\Mvc\View\TemplateInterface;
@@ -51,8 +51,8 @@ final class ItemPresetHelper extends HelperBase
private ?SelectItemAdapter $users = null;
private ?SelectItemAdapter $userGroups = null;
private UserServiceInterface $userService;
private UserGroupService $userGroupService;
private UserProfileServiceInterface $userProfileService;
private UserGroupService $userGroupService;
private UserProfileService $userProfileService;
public function __construct(
Application $application,
@@ -60,7 +60,7 @@ final class ItemPresetHelper extends HelperBase
RequestInterface $request,
UserServiceInterface $userService,
UserGroupService $userGroupService,
UserProfileServiceInterface $userProfileService
UserProfileService $userProfileService
) {
parent::__construct($application, $template, $request);

View File

@@ -35,7 +35,7 @@ use SP\Domain\Core\Exceptions\SPException;
use SP\Domain\CustomField\Ports\CustomFieldDataService;
use SP\Domain\User\Models\User;
use SP\Domain\User\Ports\UserGroupService;
use SP\Domain\User\Ports\UserProfileServiceInterface;
use SP\Domain\User\Ports\UserProfileService;
use SP\Domain\User\Ports\UserServiceInterface;
use SP\Modules\Web\Controllers\ControllerBase;
use SP\Mvc\Controller\ItemTrait;
@@ -51,7 +51,7 @@ abstract class UserViewBase extends ControllerBase
protected UserServiceInterface $userService;
private UserGroupService $userGroupService;
private UserProfileServiceInterface $userProfileService;
private UserProfileService $userProfileService;
private CustomFieldDataService $customFieldService;
public function __construct(
@@ -59,7 +59,7 @@ abstract class UserViewBase extends ControllerBase
WebControllerHelper $webControllerHelper,
UserServiceInterface $userService,
UserGroupService $userGroupService,
UserProfileServiceInterface $userProfileService,
UserProfileService $userProfileService,
CustomFieldDataService $customFieldService
) {
parent::__construct($application, $webControllerHelper);

View File

@@ -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.
*
@@ -30,7 +30,7 @@ use SP\Core\Application;
use SP\Domain\Core\Acl\AclActionsInterface;
use SP\Domain\Core\Exceptions\ConstraintException;
use SP\Domain\Core\Exceptions\QueryException;
use SP\Domain\User\Ports\UserProfileServiceInterface;
use SP\Domain\User\Ports\UserProfileService;
use SP\Html\DataGrid\DataGridInterface;
use SP\Http\JsonMessage;
use SP\Modules\Web\Controllers\ControllerBase;
@@ -47,14 +47,14 @@ final class SearchController extends ControllerBase
use ItemTrait;
use JsonTrait;
private UserProfileServiceInterface $userProfileService;
private UserProfileGrid $userProfileGrid;
private UserProfileService $userProfileService;
private UserProfileGrid $userProfileGrid;
public function __construct(
Application $application,
Application $application,
WebControllerHelper $webControllerHelper,
UserProfileServiceInterface $userProfileService,
UserProfileGrid $userProfileGrid
UserProfileService $userProfileService,
UserProfileGrid $userProfileGrid
) {
parent::__construct($application, $webControllerHelper);

View File

@@ -27,7 +27,7 @@ namespace SP\Modules\Web\Controllers\UserProfile;
use SP\Core\Application;
use SP\Domain\CustomField\Ports\CustomFieldDataService;
use SP\Domain\User\Ports\UserProfileServiceInterface;
use SP\Domain\User\Ports\UserProfileService;
use SP\Modules\Web\Controllers\ControllerBase;
use SP\Modules\Web\Forms\UserProfileForm;
use SP\Mvc\Controller\WebControllerHelper;
@@ -37,14 +37,14 @@ use SP\Mvc\Controller\WebControllerHelper;
*/
abstract class UserProfileSaveBase extends ControllerBase
{
protected UserProfileServiceInterface $userProfileService;
protected UserProfileService $userProfileService;
protected CustomFieldDataService $customFieldService;
protected UserProfileForm $form;
public function __construct(
Application $application,
Application $application,
WebControllerHelper $webControllerHelper,
UserProfileServiceInterface $userProfileService,
UserProfileService $userProfileService,
CustomFieldDataService $customFieldService
) {
parent::__construct($application, $webControllerHelper);

View File

@@ -35,7 +35,7 @@ use SP\Domain\Core\Exceptions\QueryException;
use SP\Domain\Core\Exceptions\SPException;
use SP\Domain\CustomField\Ports\CustomFieldDataService;
use SP\Domain\User\Models\UserProfile;
use SP\Domain\User\Ports\UserProfileServiceInterface;
use SP\Domain\User\Ports\UserProfileService;
use SP\Infrastructure\Common\Repositories\NoSuchItemException;
use SP\Modules\Web\Controllers\ControllerBase;
use SP\Mvc\Controller\ItemTrait;
@@ -48,13 +48,13 @@ abstract class UserProfileViewBase extends ControllerBase
{
use ItemTrait;
private UserProfileServiceInterface $userProfileService;
private UserProfileService $userProfileService;
private CustomFieldDataService $customFieldService;
public function __construct(
Application $application,
Application $application,
WebControllerHelper $webControllerHelper,
UserProfileServiceInterface $userProfileService,
UserProfileService $userProfileService,
CustomFieldDataService $customFieldService
) {
parent::__construct($application, $webControllerHelper);