refactor(bookmarks): remove factory chain, interfaces, and duplicated sort logic

Remove BookmarkRepositoryFactory, BookmarkServicesFactory, and all 3
repository interfaces — single-consumer abstractions with no
polymorphism. Simplify container registrar to wire directly. Extract
duplicated updateSortOrders() (60 identical lines in two repos) into
SortOrderTrait. Consolidate icon labels from template into
BookmarkService::allowedGroupIconLabels() single source of truth.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-26 12:10:05 +01:00
parent e746a2e874
commit 8f6c9951c1
13 changed files with 146 additions and 298 deletions

View File

@@ -2,25 +2,25 @@
namespace MintyPHP\Tests\Module\Bookmarks\Service;
use MintyPHP\Module\Bookmarks\Repository\BookmarkGroupRepositoryInterface;
use MintyPHP\Module\Bookmarks\Repository\BookmarkNavigationRepositoryInterface;
use MintyPHP\Module\Bookmarks\Repository\BookmarkRepositoryInterface;
use MintyPHP\Module\Bookmarks\Repository\BookmarkGroupRepository;
use MintyPHP\Module\Bookmarks\Repository\BookmarkNavigationRepository;
use MintyPHP\Module\Bookmarks\Repository\BookmarkRepository;
use MintyPHP\Module\Bookmarks\Service\BookmarkService;
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
class BookmarkServiceTest extends TestCase
{
private BookmarkRepositoryInterface&MockObject $bookmarkRepo;
private BookmarkGroupRepositoryInterface&MockObject $groupRepo;
private BookmarkNavigationRepositoryInterface&MockObject $navigationRepo;
private BookmarkRepository&MockObject $bookmarkRepo;
private BookmarkGroupRepository&MockObject $groupRepo;
private BookmarkNavigationRepository&MockObject $navigationRepo;
private BookmarkService $service;
protected function setUp(): void
{
$this->bookmarkRepo = $this->createMock(BookmarkRepositoryInterface::class);
$this->groupRepo = $this->createMock(BookmarkGroupRepositoryInterface::class);
$this->navigationRepo = $this->createMock(BookmarkNavigationRepositoryInterface::class);
$this->bookmarkRepo = $this->createMock(BookmarkRepository::class);
$this->groupRepo = $this->createMock(BookmarkGroupRepository::class);
$this->navigationRepo = $this->createMock(BookmarkNavigationRepository::class);
$this->service = new BookmarkService($this->bookmarkRepo, $this->groupRepo, $this->navigationRepo);
}