mirror of
https://github.com/nuxsmin/sysPass.git
synced 2026-03-09 18:06:54 +01:00
chore: Refactor Category naming
Signed-off-by: Rubén D <nuxsmin@syspass.org>
This commit is contained in:
@@ -28,8 +28,8 @@ namespace SP\Modules\Api\Controllers\Category;
|
||||
use Klein\Klein;
|
||||
use SP\Core\Application;
|
||||
use SP\Domain\Api\Ports\ApiService;
|
||||
use SP\Domain\Category\Ports\CategoryAdapterInterface;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryAdapter;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Core\Acl\AclInterface;
|
||||
use SP\Domain\Core\Exceptions\InvalidClassException;
|
||||
use SP\Modules\Api\Controllers\ControllerBase;
|
||||
@@ -40,19 +40,19 @@ use SP\Modules\Api\Controllers\Help\CategoryHelp;
|
||||
*/
|
||||
abstract class CategoryBase extends ControllerBase
|
||||
{
|
||||
protected CategoryServiceInterface $categoryService;
|
||||
protected CategoryAdapterInterface $categoryAdapter;
|
||||
protected CategoryService $categoryService;
|
||||
protected CategoryAdapter $categoryAdapter;
|
||||
|
||||
/**
|
||||
* @throws InvalidClassException
|
||||
*/
|
||||
public function __construct(
|
||||
Application $application,
|
||||
Klein $router,
|
||||
ApiService $apiService,
|
||||
AclInterface $acl,
|
||||
CategoryServiceInterface $categoryService,
|
||||
CategoryAdapterInterface $categoryAdapter
|
||||
Application $application,
|
||||
Klein $router,
|
||||
ApiService $apiService,
|
||||
AclInterface $acl,
|
||||
CategoryService $categoryService,
|
||||
CategoryAdapter $categoryAdapter
|
||||
) {
|
||||
parent::__construct($application, $router, $apiService, $acl);
|
||||
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -32,7 +32,7 @@ use SP\Core\Events\Event;
|
||||
use SP\Domain\Account\Ports\AccountHistoryService;
|
||||
use SP\Domain\Account\Ports\AccountSearchService;
|
||||
use SP\Domain\Account\Ports\AccountService;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Client\Ports\ClientServiceInterface;
|
||||
use SP\Domain\Core\Acl\AclActionsInterface;
|
||||
use SP\Domain\CustomField\Ports\CustomFieldServiceInterface;
|
||||
@@ -61,20 +61,20 @@ final class BulkEditController extends ControllerBase
|
||||
private AccountSearchService $accountSearchService;
|
||||
private AccountHistoryService $accountHistoryService;
|
||||
private AccountGrid $accountGrid;
|
||||
private CustomFieldServiceInterface $customFieldService;
|
||||
private CategoryServiceInterface $categoryService;
|
||||
private ClientServiceInterface $clientService;
|
||||
private CustomFieldServiceInterface $customFieldService;
|
||||
private CategoryService $categoryService;
|
||||
private ClientServiceInterface $clientService;
|
||||
private TagServiceInterface $tagService;
|
||||
private UserServiceInterface $userService;
|
||||
private UserGroupServiceInterface $userGroupService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
CategoryServiceInterface $categoryService,
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
CategoryService $categoryService,
|
||||
ClientServiceInterface $clientService,
|
||||
TagServiceInterface $tagService,
|
||||
UserServiceInterface $userService,
|
||||
TagServiceInterface $tagService,
|
||||
UserServiceInterface $userService,
|
||||
UserGroupServiceInterface $userGroupService
|
||||
) {
|
||||
parent::__construct($application, $webControllerHelper);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link https://syspass.org
|
||||
* @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org
|
||||
* @copyright 2012-2024, Rubén Domínguez nuxsmin@$syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
@@ -25,7 +25,7 @@
|
||||
namespace SP\Modules\Web\Controllers\Category;
|
||||
|
||||
use SP\Core\Application;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\CustomField\Ports\CustomFieldServiceInterface;
|
||||
use SP\Modules\Web\Controllers\ControllerBase;
|
||||
use SP\Modules\Web\Controllers\Traits\JsonTrait;
|
||||
@@ -38,16 +38,17 @@ use SP\Mvc\Controller\WebControllerHelper;
|
||||
*/
|
||||
abstract class CategorySaveBase extends ControllerBase
|
||||
{
|
||||
use JsonTrait, ItemTrait;
|
||||
use ItemTrait;
|
||||
use JsonTrait;
|
||||
|
||||
protected CategoryServiceInterface $categoryService;
|
||||
protected CategoryService $categoryService;
|
||||
protected CustomFieldServiceInterface $customFieldService;
|
||||
protected CategoryForm $form;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
CategoryServiceInterface $categoryService,
|
||||
CategoryService $categoryService,
|
||||
CustomFieldServiceInterface $customFieldService
|
||||
) {
|
||||
parent::__construct($application, $webControllerHelper);
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -27,7 +27,7 @@ namespace SP\Modules\Web\Controllers\Category;
|
||||
use SP\Core\Acl\Acl;
|
||||
use SP\Core\Application;
|
||||
use SP\Domain\Category\Models\Category;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Common\Services\ServiceException;
|
||||
use SP\Domain\Core\Acl\AclActionsInterface;
|
||||
use SP\Domain\Core\Exceptions\ConstraintException;
|
||||
@@ -46,13 +46,13 @@ abstract class CategoryViewBase extends ControllerBase
|
||||
{
|
||||
use ItemTrait;
|
||||
|
||||
private CategoryServiceInterface $categoryService;
|
||||
private CategoryService $categoryService;
|
||||
private CustomFieldServiceInterface $customFieldService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
CategoryServiceInterface $categoryService,
|
||||
CategoryService $categoryService,
|
||||
CustomFieldServiceInterface $customFieldService
|
||||
) {
|
||||
parent::__construct($application, $webControllerHelper);
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -27,7 +27,7 @@ namespace SP\Modules\Web\Controllers\Category;
|
||||
|
||||
use JsonException;
|
||||
use SP\Core\Application;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Core\Acl\AclActionsInterface;
|
||||
use SP\Domain\Core\Exceptions\ConstraintException;
|
||||
use SP\Domain\Core\Exceptions\QueryException;
|
||||
@@ -48,14 +48,14 @@ final class SearchController extends ControllerBase
|
||||
use ItemTrait;
|
||||
use JsonTrait;
|
||||
|
||||
private CategoryServiceInterface $categoryService;
|
||||
private CategoryGrid $categoryGrid;
|
||||
private CategoryService $categoryService;
|
||||
private CategoryGrid $categoryGrid;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
CategoryServiceInterface $categoryService,
|
||||
CategoryGrid $categoryGrid
|
||||
CategoryService $categoryService,
|
||||
CategoryGrid $categoryGrid
|
||||
) {
|
||||
parent::__construct($application, $webControllerHelper);
|
||||
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -38,7 +38,7 @@ use SP\Domain\Account\Ports\AccountHistoryService;
|
||||
use SP\Domain\Account\Ports\AccountService;
|
||||
use SP\Domain\Account\Ports\PublicLinkService;
|
||||
use SP\Domain\Account\Services\PublicLink;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Client\Ports\ClientServiceInterface;
|
||||
use SP\Domain\Common\Services\ServiceException;
|
||||
use SP\Domain\Core\Acl\AccountPermissionException;
|
||||
@@ -78,9 +78,9 @@ final class AccountHelper extends AccountHelperBase
|
||||
private PublicLinkService $publicLinkService;
|
||||
private ItemPresetServiceInterface $itemPresetService;
|
||||
private MasterPassServiceInterface $masterPassService;
|
||||
private AccountAclService $accountAclService;
|
||||
private CategoryServiceInterface $categoryService;
|
||||
private ClientServiceInterface $clientService;
|
||||
private AccountAclService $accountAclService;
|
||||
private CategoryService $categoryService;
|
||||
private ClientServiceInterface $clientService;
|
||||
private CustomFieldServiceInterface $customFieldService;
|
||||
private ?AccountPermission $accountAcl = null;
|
||||
private ?int $accountId = null;
|
||||
@@ -100,7 +100,7 @@ final class AccountHelper extends AccountHelperBase
|
||||
MasterPassServiceInterface $masterPassService,
|
||||
AccountActionsHelper $accountActionsHelper,
|
||||
AccountAclService $accountAclService,
|
||||
CategoryServiceInterface $categoryService,
|
||||
CategoryService $categoryService,
|
||||
ClientServiceInterface $clientService,
|
||||
CustomFieldServiceInterface $customFieldService,
|
||||
UserServiceInterface $userService,
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -32,7 +32,7 @@ use SP\Domain\Account\Ports\AccountAclService;
|
||||
use SP\Domain\Account\Ports\AccountHistoryService;
|
||||
use SP\Domain\Account\Ports\AccountToUserGroupService;
|
||||
use SP\Domain\Account\Ports\AccountToUserService;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Client\Ports\ClientServiceInterface;
|
||||
use SP\Domain\Common\Services\ServiceException;
|
||||
use SP\Domain\Core\Acl\AccountPermissionException;
|
||||
@@ -67,7 +67,7 @@ final class AccountHistoryHelper extends AccountHelperBase
|
||||
MasterPassServiceInterface $masterPassService,
|
||||
private AccountHistoryService $accountHistoryService,
|
||||
private AccountAclService $accountAclService,
|
||||
private CategoryServiceInterface $categoryService,
|
||||
private CategoryService $categoryService,
|
||||
private ClientServiceInterface $clientService,
|
||||
private AccountToUserService $accountToUserService,
|
||||
private AccountToUserGroupService $accountToUserGroupService
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -34,7 +34,7 @@ use SP\Domain\Account\Adapters\AccountSearchItem;
|
||||
use SP\Domain\Account\Dtos\AccountSearchFilterDto;
|
||||
use SP\Domain\Account\Ports\AccountSearchConstants;
|
||||
use SP\Domain\Account\Ports\AccountSearchService;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Client\Ports\ClientServiceInterface;
|
||||
use SP\Domain\Core\Acl\AclActionsInterface;
|
||||
use SP\Domain\Core\Exceptions\ConstraintException;
|
||||
@@ -70,19 +70,19 @@ final class AccountSearchHelper extends HelperBase
|
||||
private ?AccountSearchFilterDto $accountSearchFilter = null;
|
||||
private ClientServiceInterface $clientService;
|
||||
private AccountSearchService $accountSearchService;
|
||||
private AccountActionsHelper $accountActionsHelper;
|
||||
private CategoryServiceInterface $categoryService;
|
||||
private TagServiceInterface $tagService;
|
||||
private AccountActionsHelper $accountActionsHelper;
|
||||
private CategoryService $categoryService;
|
||||
private TagServiceInterface $tagService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
TemplateInterface $template,
|
||||
RequestInterface $request,
|
||||
ClientServiceInterface $clientService,
|
||||
CategoryServiceInterface $categoryService,
|
||||
TagServiceInterface $tagService,
|
||||
AccountSearchService $accountSearchService,
|
||||
AccountActionsHelper $accountActionsHelper
|
||||
Application $application,
|
||||
TemplateInterface $template,
|
||||
RequestInterface $request,
|
||||
ClientServiceInterface $clientService,
|
||||
CategoryService $categoryService,
|
||||
TagServiceInterface $tagService,
|
||||
AccountSearchService $accountSearchService,
|
||||
AccountActionsHelper $accountActionsHelper
|
||||
) {
|
||||
parent::__construct($application, $template, $request);
|
||||
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -31,7 +31,7 @@ use SP\DataModel\ItemSearchData;
|
||||
use SP\Domain\Account\Ports\AccountFileService;
|
||||
use SP\Domain\Account\Ports\AccountHistoryService;
|
||||
use SP\Domain\Account\Ports\AccountService;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Client\Ports\ClientServiceInterface;
|
||||
use SP\Domain\Core\Acl\AclActionsInterface;
|
||||
use SP\Domain\Core\Exceptions\ConstraintException;
|
||||
@@ -61,9 +61,9 @@ use SP\Mvc\Controller\WebControllerHelper;
|
||||
final class IndexController extends ControllerBase
|
||||
{
|
||||
protected ?ItemSearchData $itemSearchData = null;
|
||||
private TabsGridHelper $tabsGridHelper;
|
||||
private CategoryServiceInterface $categoryService;
|
||||
private TagServiceInterface $tagService;
|
||||
private TabsGridHelper $tabsGridHelper;
|
||||
private CategoryService $categoryService;
|
||||
private TagServiceInterface $tagService;
|
||||
private ClientServiceInterface $clientService;
|
||||
private CustomFieldDefServiceInterface $customFieldDefService;
|
||||
private AccountFileService $accountFileService;
|
||||
@@ -83,7 +83,7 @@ final class IndexController extends ControllerBase
|
||||
Application $application,
|
||||
WebControllerHelper $webControllerHelper,
|
||||
Helpers\TabsGridHelper $tabsGridHelper,
|
||||
CategoryServiceInterface $categoryService,
|
||||
CategoryService $categoryService,
|
||||
TagServiceInterface $tagService,
|
||||
ClientServiceInterface $clientService,
|
||||
CustomFieldDefServiceInterface $customFieldDefService,
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -25,7 +25,7 @@
|
||||
namespace SP\Modules\Web\Controllers\Items;
|
||||
|
||||
use SP\Core\Application;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Core\Exceptions\ConstraintException;
|
||||
use SP\Domain\Core\Exceptions\QueryException;
|
||||
use SP\Domain\Core\Exceptions\SPException;
|
||||
@@ -39,12 +39,12 @@ use SP\Mvc\View\Components\SelectItemAdapter;
|
||||
*/
|
||||
final class CategoriesController extends SimpleControllerBase
|
||||
{
|
||||
private CategoryServiceInterface $categoryService;
|
||||
private CategoryService $categoryService;
|
||||
|
||||
public function __construct(
|
||||
Application $application,
|
||||
SimpleControllerHelper $simpleControllerHelper,
|
||||
CategoryServiceInterface $categoryService
|
||||
CategoryService $categoryService
|
||||
) {
|
||||
parent::__construct($application, $simpleControllerHelper);
|
||||
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -25,8 +25,8 @@
|
||||
namespace SP\Domain\Category\Adapters;
|
||||
|
||||
use League\Fractal\Resource\Collection;
|
||||
use SP\Domain\Category\Models\Category;
|
||||
use SP\Domain\Category\Ports\CategoryAdapterInterface;
|
||||
use SP\Domain\Category\Models\Category as CategoryModel;
|
||||
use SP\Domain\Category\Ports\CategoryAdapter;
|
||||
use SP\Domain\Common\Adapters\Adapter;
|
||||
use SP\Domain\Common\Services\ServiceException;
|
||||
use SP\Domain\Config\Ports\ConfigDataInterface;
|
||||
@@ -46,7 +46,7 @@ use SP\Util\Link;
|
||||
*
|
||||
* @package SP\Adapters
|
||||
*/
|
||||
final class CategoryAdapter extends Adapter implements CategoryAdapterInterface
|
||||
final class Category extends Adapter implements CategoryAdapter
|
||||
{
|
||||
use ItemTrait;
|
||||
|
||||
@@ -66,7 +66,7 @@ final class CategoryAdapter extends Adapter implements CategoryAdapterInterface
|
||||
* @throws SPException
|
||||
* @throws ServiceException
|
||||
*/
|
||||
public function includeCustomFields(Category $data): Collection
|
||||
public function includeCustomFields(CategoryModel $data): Collection
|
||||
{
|
||||
return $this->collection(
|
||||
$this->getCustomFieldsForItem(AclActionsInterface::CATEGORY, $data->id, $this->customFieldService),
|
||||
@@ -77,7 +77,7 @@ final class CategoryAdapter extends Adapter implements CategoryAdapterInterface
|
||||
/**
|
||||
* @throws ActionNotFoundException
|
||||
*/
|
||||
public function transform(Category $data): array
|
||||
public function transform(CategoryModel $data): array
|
||||
{
|
||||
$actionRoute = $this->actions->getActionById(AclActionsInterface::CATEGORY_VIEW)->getRoute();
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -36,7 +36,7 @@ use SP\Domain\Core\Exceptions\SPException;
|
||||
*
|
||||
* @package SP\Adapters
|
||||
*/
|
||||
interface CategoryAdapterInterface
|
||||
interface CategoryAdapter
|
||||
{
|
||||
/**
|
||||
* @throws ConstraintException
|
||||
@@ -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.
|
||||
*
|
||||
@@ -38,7 +38,7 @@ use SP\Infrastructure\Database\QueryResult;
|
||||
*
|
||||
* @template T of Category
|
||||
*/
|
||||
interface CategoryRepositoryInterface extends RepositoryInterface
|
||||
interface CategoryRepository extends RepositoryInterface
|
||||
{
|
||||
/**
|
||||
* Creates an item
|
||||
@@ -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.
|
||||
*
|
||||
@@ -39,7 +39,7 @@ use SP\Infrastructure\Database\QueryResult;
|
||||
*
|
||||
* @template T of Category
|
||||
*/
|
||||
interface CategoryServiceInterface
|
||||
interface CategoryService
|
||||
{
|
||||
/**
|
||||
* @param ItemSearchData $itemSearchData
|
||||
@@ -70,7 +70,7 @@ interface CategoryServiceInterface
|
||||
* @throws QueryException
|
||||
* @throws NoSuchItemException
|
||||
*/
|
||||
public function delete(int $id): CategoryServiceInterface;
|
||||
public function delete(int $id): CategoryService;
|
||||
|
||||
/**
|
||||
* Deletes all the items for given ids
|
||||
@@ -28,8 +28,8 @@ use Exception;
|
||||
use SP\Core\Application;
|
||||
use SP\DataModel\ItemSearchData;
|
||||
use SP\Domain\Category\Models\Category as CategoryModel;
|
||||
use SP\Domain\Category\Ports\CategoryRepositoryInterface;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryRepository;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Common\Services\Service;
|
||||
use SP\Domain\Common\Services\ServiceException;
|
||||
use SP\Domain\Core\Exceptions\ConstraintException;
|
||||
@@ -46,11 +46,11 @@ use function SP\__u;
|
||||
*
|
||||
* @template T of CategoryModel
|
||||
*/
|
||||
final class Category extends Service implements CategoryServiceInterface
|
||||
final class Category extends Service implements CategoryService
|
||||
{
|
||||
public function __construct(
|
||||
Application $application,
|
||||
private readonly CategoryRepositoryInterface $categoryRepository
|
||||
private readonly CategoryRepository $categoryRepository
|
||||
) {
|
||||
parent::__construct($application);
|
||||
}
|
||||
@@ -106,7 +106,7 @@ final class Category extends Service implements CategoryServiceInterface
|
||||
* @throws QueryException
|
||||
* @throws NoSuchItemException
|
||||
*/
|
||||
public function delete(int $id): CategoryServiceInterface
|
||||
public function delete(int $id): CategoryService
|
||||
{
|
||||
if ($this->categoryRepository->delete($id)->getAffectedNumRows() === 0) {
|
||||
throw new NoSuchItemException(__u('Category not found'), SPException::INFO);
|
||||
|
||||
@@ -37,7 +37,7 @@ use SP\Core\PhpExtensionChecker;
|
||||
use SP\Domain\Account\Ports\AccountService;
|
||||
use SP\Domain\Account\Ports\AccountToTagService;
|
||||
use SP\Domain\Category\Models\Category;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Client\Ports\ClientServiceInterface;
|
||||
use SP\Domain\Common\Services\Service;
|
||||
use SP\Domain\Common\Services\ServiceException;
|
||||
@@ -65,9 +65,9 @@ final class XmlExportService extends Service implements XmlExportServiceInterfac
|
||||
private PhpExtensionChecker $extensionChecker;
|
||||
private ClientServiceInterface $clientService;
|
||||
private AccountService $accountService;
|
||||
private AccountToTagService $accountToTagService;
|
||||
private CategoryServiceInterface $categoryService;
|
||||
private TagServiceInterface $tagService;
|
||||
private AccountToTagService $accountToTagService;
|
||||
private CategoryService $categoryService;
|
||||
private TagServiceInterface $tagService;
|
||||
private ?DOMDocument $xml = null;
|
||||
private ?DOMElement $root = null;
|
||||
private ?string $exportPass = null;
|
||||
@@ -81,7 +81,7 @@ final class XmlExportService extends Service implements XmlExportServiceInterfac
|
||||
ClientServiceInterface $clientService,
|
||||
AccountService $accountService,
|
||||
AccountToTagService $accountToTagService,
|
||||
CategoryServiceInterface $categoryService,
|
||||
CategoryService $categoryService,
|
||||
TagServiceInterface $tagService
|
||||
|
||||
) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* @author nuxsmin
|
||||
* @link https://syspass.org
|
||||
* @copyright 2012-2022, Rubén Domínguez nuxsmin@$syspass.org
|
||||
* @copyright 2012-2024, Rubén Domínguez nuxsmin@$syspass.org
|
||||
*
|
||||
* This file is part of sysPass.
|
||||
*
|
||||
@@ -26,7 +26,7 @@ namespace SP\Domain\Import\Services;
|
||||
|
||||
|
||||
use SP\Domain\Account\Ports\AccountService;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Client\Ports\ClientServiceInterface;
|
||||
use SP\Domain\Tag\Ports\TagServiceInterface;
|
||||
|
||||
@@ -35,14 +35,14 @@ use SP\Domain\Tag\Ports\TagServiceInterface;
|
||||
*/
|
||||
final class ImportHelper
|
||||
{
|
||||
private AccountService $accountService;
|
||||
private CategoryServiceInterface $categoryService;
|
||||
private ClientServiceInterface $clientService;
|
||||
private AccountService $accountService;
|
||||
private CategoryService $categoryService;
|
||||
private ClientServiceInterface $clientService;
|
||||
private TagServiceInterface $tagService;
|
||||
|
||||
public function __construct(
|
||||
AccountService $accountService,
|
||||
CategoryServiceInterface $categoryService,
|
||||
CategoryService $categoryService,
|
||||
ClientServiceInterface $clientService,
|
||||
TagServiceInterface $tagService
|
||||
) {
|
||||
@@ -57,7 +57,7 @@ final class ImportHelper
|
||||
return $this->accountService;
|
||||
}
|
||||
|
||||
public function getCategoryService(): CategoryServiceInterface
|
||||
public function getCategoryService(): CategoryService
|
||||
{
|
||||
return $this->categoryService;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ use SP\DataModel\TagData;
|
||||
use SP\Domain\Account\Dtos\AccountRequest;
|
||||
use SP\Domain\Account\Ports\AccountService;
|
||||
use SP\Domain\Category\Models\Category;
|
||||
use SP\Domain\Category\Ports\CategoryServiceInterface;
|
||||
use SP\Domain\Category\Ports\CategoryService;
|
||||
use SP\Domain\Client\Models\Client;
|
||||
use SP\Domain\Client\Ports\ClientServiceInterface;
|
||||
use SP\Domain\Core\Exceptions\ConstraintException;
|
||||
@@ -54,9 +54,9 @@ trait ImportTrait
|
||||
protected bool $mPassValidHash = false;
|
||||
protected int $counter = 0;
|
||||
protected ImportParams $importParams;
|
||||
private AccountService $accountService;
|
||||
private CategoryServiceInterface $categoryService;
|
||||
private ClientServiceInterface $clientService;
|
||||
private AccountService $accountService;
|
||||
private CategoryService $categoryService;
|
||||
private ClientServiceInterface $clientService;
|
||||
private TagServiceInterface $tagService;
|
||||
private array $items;
|
||||
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -26,8 +26,8 @@ namespace SP\Infrastructure\Category\Repositories;
|
||||
|
||||
use Exception;
|
||||
use SP\DataModel\ItemSearchData;
|
||||
use SP\Domain\Category\Models\Category;
|
||||
use SP\Domain\Category\Ports\CategoryRepositoryInterface;
|
||||
use SP\Domain\Category\Models\Category as CategoryModel;
|
||||
use SP\Domain\Category\Ports\CategoryRepository;
|
||||
use SP\Domain\Core\Exceptions\ConstraintException;
|
||||
use SP\Domain\Core\Exceptions\QueryException;
|
||||
use SP\Infrastructure\Common\Repositories\DuplicatedItemException;
|
||||
@@ -41,9 +41,9 @@ use function SP\__u;
|
||||
/**
|
||||
* Class CategoryRepository
|
||||
*
|
||||
* @template T of Category
|
||||
* @template T of CategoryModel
|
||||
*/
|
||||
final class CategoryRepository extends Repository implements CategoryRepositoryInterface
|
||||
final class Category extends Repository implements CategoryRepository
|
||||
{
|
||||
use RepositoryItemTrait;
|
||||
|
||||
@@ -52,14 +52,14 @@ final class CategoryRepository extends Repository implements CategoryRepositoryI
|
||||
/**
|
||||
* Creates an item
|
||||
*
|
||||
* @param Category $category
|
||||
* @param CategoryModel $category
|
||||
*
|
||||
* @return QueryResult
|
||||
* @throws ConstraintException
|
||||
* @throws DuplicatedItemException
|
||||
* @throws QueryException
|
||||
*/
|
||||
public function create(Category $category): QueryResult
|
||||
public function create(CategoryModel $category): QueryResult
|
||||
{
|
||||
if ($this->checkDuplicatedOnAdd($category)) {
|
||||
throw new DuplicatedItemException(__u('Duplicated category'));
|
||||
@@ -79,13 +79,13 @@ final class CategoryRepository extends Repository implements CategoryRepositoryI
|
||||
/**
|
||||
* Checks whether the item is duplicated on adding
|
||||
*
|
||||
* @param Category $category
|
||||
* @param CategoryModel $category
|
||||
*
|
||||
* @return bool
|
||||
* @throws ConstraintException
|
||||
* @throws QueryException
|
||||
*/
|
||||
private function checkDuplicatedOnAdd(Category $category): bool
|
||||
private function checkDuplicatedOnAdd(CategoryModel $category): bool
|
||||
{
|
||||
$query = $this->queryFactory
|
||||
->newSelect()
|
||||
@@ -106,14 +106,14 @@ final class CategoryRepository extends Repository implements CategoryRepositoryI
|
||||
/**
|
||||
* Updates an item
|
||||
*
|
||||
* @param Category $category
|
||||
* @param CategoryModel $category
|
||||
*
|
||||
* @return int
|
||||
* @throws DuplicatedItemException
|
||||
* @throws ConstraintException
|
||||
* @throws QueryException
|
||||
*/
|
||||
public function update(Category $category): int
|
||||
public function update(CategoryModel $category): int
|
||||
{
|
||||
if ($this->checkDuplicatedOnUpdate($category)) {
|
||||
throw new DuplicatedItemException(__u('Duplicated category name'));
|
||||
@@ -140,13 +140,13 @@ final class CategoryRepository extends Repository implements CategoryRepositoryI
|
||||
/**
|
||||
* Checks whether the item is duplicated on updating
|
||||
*
|
||||
* @param Category $category
|
||||
* @param CategoryModel $category
|
||||
*
|
||||
* @return bool
|
||||
* @throws ConstraintException
|
||||
* @throws QueryException
|
||||
*/
|
||||
private function checkDuplicatedOnUpdate(Category $category): bool
|
||||
private function checkDuplicatedOnUpdate(CategoryModel $category): bool
|
||||
{
|
||||
$query = $this->queryFactory
|
||||
->newSelect()
|
||||
@@ -177,12 +177,12 @@ final class CategoryRepository extends Repository implements CategoryRepositoryI
|
||||
$query = $this->queryFactory
|
||||
->newSelect()
|
||||
->from(self::TABLE)
|
||||
->cols(Category::getCols())
|
||||
->cols(CategoryModel::getCols())
|
||||
->where('id = :id')
|
||||
->bindValues(['id' => $categoryId])
|
||||
->limit(1);
|
||||
|
||||
$queryData = QueryData::buildWithMapper($query, Category::class);
|
||||
$queryData = QueryData::buildWithMapper($query, CategoryModel::class);
|
||||
|
||||
return $this->db->doSelect($queryData);
|
||||
}
|
||||
@@ -199,12 +199,12 @@ final class CategoryRepository extends Repository implements CategoryRepositoryI
|
||||
$query = $this->queryFactory
|
||||
->newSelect()
|
||||
->from(self::TABLE)
|
||||
->cols(Category::getCols())
|
||||
->cols(CategoryModel::getCols())
|
||||
->where('(name = :name OR hash = :hash)')
|
||||
->bindValues(['name' => $name, 'hash' => $this->makeItemHash($name)])
|
||||
->limit(1);
|
||||
|
||||
$queryData = QueryData::buildWithMapper($query, Category::class);
|
||||
$queryData = QueryData::buildWithMapper($query, CategoryModel::class);
|
||||
|
||||
return $this->db->doSelect($queryData);
|
||||
}
|
||||
@@ -219,9 +219,9 @@ final class CategoryRepository extends Repository implements CategoryRepositoryI
|
||||
$query = $this->queryFactory
|
||||
->newSelect()
|
||||
->from(self::TABLE)
|
||||
->cols(Category::getCols());
|
||||
->cols(CategoryModel::getCols());
|
||||
|
||||
return $this->db->doSelect(QueryData::buildWithMapper($query, Category::class));
|
||||
return $this->db->doSelect(QueryData::buildWithMapper($query, CategoryModel::class));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -284,7 +284,7 @@ final class CategoryRepository extends Repository implements CategoryRepositoryI
|
||||
$query = $this->queryFactory
|
||||
->newSelect()
|
||||
->from(self::TABLE)
|
||||
->cols(Category::getCols(['hash']))
|
||||
->cols(CategoryModel::getCols(['hash']))
|
||||
->orderBy(['name'])
|
||||
->limit($itemSearchData->getLimitCount())
|
||||
->offset($itemSearchData->getLimitStart());
|
||||
@@ -297,7 +297,7 @@ final class CategoryRepository extends Repository implements CategoryRepositoryI
|
||||
$query->bindValues(['name' => $search, 'description' => $search]);
|
||||
}
|
||||
|
||||
$queryData = QueryData::build($query)->setMapClassName(Category::class);
|
||||
$queryData = QueryData::build($query)->setMapClassName(CategoryModel::class);
|
||||
|
||||
return $this->db->doSelect($queryData, true);
|
||||
}
|
||||
@@ -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.
|
||||
*
|
||||
@@ -26,7 +26,7 @@ namespace SPT\Domain\Category\Services;
|
||||
|
||||
use Exception;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use SP\Domain\Category\Ports\CategoryRepositoryInterface;
|
||||
use SP\Domain\Category\Ports\CategoryRepository;
|
||||
use SP\Domain\Category\Services\Category;
|
||||
use SP\Domain\Common\Services\ServiceException;
|
||||
use SP\Domain\Core\Exceptions\ConstraintException;
|
||||
@@ -47,8 +47,8 @@ use SPT\UnitaryTestCase;
|
||||
class CategoryTest extends UnitaryTestCase
|
||||
{
|
||||
|
||||
private CategoryRepositoryInterface|MockObject $categoryRepository;
|
||||
private Category $categoryService;
|
||||
private CategoryRepository|MockObject $categoryRepository;
|
||||
private Category $category;
|
||||
|
||||
/**
|
||||
* @throws NoSuchItemException
|
||||
@@ -68,7 +68,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
->with($id)
|
||||
->willReturn(new QueryResult([$category]));
|
||||
|
||||
$out = $this->categoryService->getById($id);
|
||||
$out = $this->category->getById($id);
|
||||
|
||||
$this->assertEquals($category, $out);
|
||||
}
|
||||
@@ -94,7 +94,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
$this->expectException(NoSuchItemException::class);
|
||||
$this->expectExceptionMessage('Category not found');
|
||||
|
||||
$this->categoryService->getById($id);
|
||||
$this->category->getById($id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,7 +109,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
->method('search')
|
||||
->with($itemSearch);
|
||||
|
||||
$this->categoryService->search($itemSearch);
|
||||
$this->category->search($itemSearch);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -130,7 +130,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
->with($id)
|
||||
->willReturn($queryResult);
|
||||
|
||||
$this->categoryService->delete($id);
|
||||
$this->category->delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -150,7 +150,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
$this->expectException(NoSuchItemException::class);
|
||||
$this->expectExceptionMessage('Category not found');
|
||||
|
||||
$this->categoryService->delete($id);
|
||||
$this->category->delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +170,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
->with($category)
|
||||
->willReturn($queryResult);
|
||||
|
||||
$out = $this->categoryService->create($category);
|
||||
$out = $this->category->create($category);
|
||||
|
||||
$this->assertEquals($queryResult->getLastId(), $out);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
->with($category)
|
||||
->willReturn(1);
|
||||
|
||||
$this->categoryService->update($category);
|
||||
$this->category->update($category);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,7 +214,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
->with($name)
|
||||
->willReturn(new QueryResult([$category]));
|
||||
|
||||
$out = $this->categoryService->getByName($name);
|
||||
$out = $this->category->getByName($name);
|
||||
|
||||
$this->assertEquals($category, $out);
|
||||
}
|
||||
@@ -238,7 +238,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
$this->expectException(NoSuchItemException::class);
|
||||
$this->expectExceptionMessage('Category not found');
|
||||
|
||||
$this->categoryService->getByName($name);
|
||||
$this->category->getByName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -259,7 +259,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
->with($ids)
|
||||
->willReturn($queryResult);
|
||||
|
||||
$this->categoryService->deleteByIdBatch($ids);
|
||||
$this->category->deleteByIdBatch($ids);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -282,7 +282,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
$this->expectException(ServiceException::class);
|
||||
$this->expectExceptionMessage('Error while deleting categories');
|
||||
|
||||
$this->categoryService->deleteByIdBatch($ids);
|
||||
$this->category->deleteByIdBatch($ids);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -299,7 +299,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
->method('getAll')
|
||||
->willReturn(new QueryResult([$category]));
|
||||
|
||||
$out = $this->categoryService->getAll();
|
||||
$out = $this->category->getAll();
|
||||
|
||||
$this->assertEquals([$category], $out);
|
||||
}
|
||||
@@ -308,7 +308,7 @@ class CategoryTest extends UnitaryTestCase
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->categoryRepository = $this->createMock(CategoryRepositoryInterface::class);
|
||||
$this->categoryService = new Category($this->application, $this->categoryRepository);
|
||||
$this->categoryRepository = $this->createMock(CategoryRepository::class);
|
||||
$this->category = new Category($this->application, $this->categoryRepository);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
*
|
||||
@@ -33,11 +33,11 @@ use Exception;
|
||||
use PHPUnit\Framework\Constraint\Callback;
|
||||
use PHPUnit\Framework\MockObject\MockObject;
|
||||
use SP\DataModel\ItemSearchData;
|
||||
use SP\Domain\Category\Models\Category;
|
||||
use SP\Domain\Category\Models\Category as CategoryModel;
|
||||
use SP\Domain\Common\Models\Simple;
|
||||
use SP\Domain\Core\Exceptions\ConstraintException;
|
||||
use SP\Domain\Core\Exceptions\QueryException;
|
||||
use SP\Infrastructure\Category\Repositories\CategoryRepository;
|
||||
use SP\Infrastructure\Category\Repositories\Category;
|
||||
use SP\Infrastructure\Common\Repositories\DuplicatedItemException;
|
||||
use SP\Infrastructure\Database\DatabaseInterface;
|
||||
use SP\Infrastructure\Database\QueryData;
|
||||
@@ -50,10 +50,10 @@ use SPT\UnitaryTestCase;
|
||||
*
|
||||
* @group unitary
|
||||
*/
|
||||
class CategoryRepositoryTest extends UnitaryTestCase
|
||||
class CategoryTest extends UnitaryTestCase
|
||||
{
|
||||
|
||||
private CategoryRepository $categoryRepository;
|
||||
private Category $category;
|
||||
private DatabaseInterface|MockObject $database;
|
||||
|
||||
/**
|
||||
@@ -98,7 +98,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
->with(...self::withConsecutive([$callbackDuplicate], [$callbackUpdate]))
|
||||
->willReturn(new QueryResult([]), new QueryResult([1]));
|
||||
|
||||
$this->categoryRepository->create($category);
|
||||
$this->category->create($category);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -132,7 +132,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
$this->expectException(DuplicatedItemException::class);
|
||||
$this->expectExceptionMessage('Duplicated category');
|
||||
|
||||
$this->categoryRepository->create($category);
|
||||
$this->category->create($category);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,7 +155,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
|
||||
$this->database->expects(self::once())->method('doQuery')->with($callback);
|
||||
|
||||
$this->categoryRepository->delete($id);
|
||||
$this->category->delete($id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -186,7 +186,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
->method('doQuery')
|
||||
->with($callback);
|
||||
|
||||
$this->categoryRepository->deleteByIdBatch($ids);
|
||||
$this->category->deleteByIdBatch($ids);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,7 +199,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
->expects(self::never())
|
||||
->method('doQuery');
|
||||
|
||||
$this->categoryRepository->deleteByIdBatch([]);
|
||||
$this->category->deleteByIdBatch([]);
|
||||
}
|
||||
|
||||
public function testGetById()
|
||||
@@ -213,7 +213,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
|
||||
return count($params) === 1
|
||||
&& $params['id'] === $id
|
||||
&& $arg->getMapClassName() === Category::class
|
||||
&& $arg->getMapClassName() === CategoryModel::class
|
||||
&& is_a($query, SelectInterface::class)
|
||||
&& !empty($query->getStatement());
|
||||
}
|
||||
@@ -224,7 +224,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
->method('doSelect')
|
||||
->with($callback);
|
||||
|
||||
$this->categoryRepository->getById($id);
|
||||
$this->category->getById($id);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -243,7 +243,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
return count($params) === 2
|
||||
&& $params['name'] === $searchStringLike
|
||||
&& $params['description'] === $searchStringLike
|
||||
&& $arg->getMapClassName() === Category::class
|
||||
&& $arg->getMapClassName() === CategoryModel::class
|
||||
&& is_a($query, SelectInterface::class)
|
||||
&& !empty($query->getStatement());
|
||||
}
|
||||
@@ -254,7 +254,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
->method('doSelect')
|
||||
->with($callback, true);
|
||||
|
||||
$this->categoryRepository->search($item);
|
||||
$this->category->search($item);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -266,7 +266,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
static function (QueryData $arg) {
|
||||
$query = $arg->getQuery();
|
||||
return count($query->getBindValues()) === 0
|
||||
&& $arg->getMapClassName() === Category::class
|
||||
&& $arg->getMapClassName() === CategoryModel::class
|
||||
&& is_a($query, SelectInterface::class)
|
||||
&& !empty($query->getStatement());
|
||||
}
|
||||
@@ -277,7 +277,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
->method('doSelect')
|
||||
->with($callback, true);
|
||||
|
||||
$this->categoryRepository->search(new ItemSearchData());
|
||||
$this->category->search(new ItemSearchData());
|
||||
}
|
||||
|
||||
public function testGetAll()
|
||||
@@ -285,7 +285,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
$callback = new Callback(
|
||||
static function (QueryData $arg) {
|
||||
$query = $arg->getQuery();
|
||||
return $arg->getMapClassName() === Category::class
|
||||
return $arg->getMapClassName() === CategoryModel::class
|
||||
&& is_a($query, SelectInterface::class)
|
||||
&& !empty($query->getStatement());
|
||||
}
|
||||
@@ -296,7 +296,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
->method('doSelect')
|
||||
->with($callback);
|
||||
|
||||
$this->categoryRepository->getAll();
|
||||
$this->category->getAll();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -343,7 +343,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
->with(...self::withConsecutive([$callbackDuplicate], [$callbackUpdate]))
|
||||
->willReturn(new QueryResult([]), new QueryResult([1]));
|
||||
|
||||
$this->categoryRepository->update($category);
|
||||
$this->category->update($category);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -377,7 +377,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
$this->expectException(DuplicatedItemException::class);
|
||||
$this->expectExceptionMessage('Duplicated category name');
|
||||
|
||||
$this->categoryRepository->update($category);
|
||||
$this->category->update($category);
|
||||
}
|
||||
|
||||
public function testGetByName()
|
||||
@@ -392,7 +392,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
return count($params) === 2
|
||||
&& $params['name'] === $name
|
||||
&& !empty($params['hash'])
|
||||
&& $arg->getMapClassName() === Category::class
|
||||
&& $arg->getMapClassName() === CategoryModel::class
|
||||
&& is_a($query, SelectInterface::class)
|
||||
&& !empty($query->getStatement());
|
||||
}
|
||||
@@ -403,7 +403,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
->method('doSelect')
|
||||
->with($callback);
|
||||
|
||||
$this->categoryRepository->getByName($name);
|
||||
$this->category->getByName($name);
|
||||
}
|
||||
|
||||
protected function setUp(): void
|
||||
@@ -413,7 +413,7 @@ class CategoryRepositoryTest extends UnitaryTestCase
|
||||
$this->database = $this->createMock(DatabaseInterface::class);
|
||||
$queryFactory = new QueryFactory('mysql');
|
||||
|
||||
$this->categoryRepository = new CategoryRepository(
|
||||
$this->category = new Category(
|
||||
$this->database,
|
||||
$this->context,
|
||||
$this->application->getEventDispatcher(),
|
||||
Reference in New Issue
Block a user