diff --git a/src/Domain/Subscription/Service/Manager/SubscribePageManager.php b/src/Domain/Subscription/Service/Manager/SubscribePageManager.php index 4f9474d5..523ba2e7 100644 --- a/src/Domain/Subscription/Service/Manager/SubscribePageManager.php +++ b/src/Domain/Subscription/Service/Manager/SubscribePageManager.php @@ -10,8 +10,6 @@ use PhpList\Core\Domain\Subscription\Model\SubscribePageData; use PhpList\Core\Domain\Subscription\Repository\SubscriberPageDataRepository; use PhpList\Core\Domain\Subscription\Repository\SubscriberPageRepository; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Contracts\Translation\TranslatorInterface; class SubscribePageManager { @@ -19,7 +17,6 @@ public function __construct( private readonly SubscriberPageRepository $pageRepository, private readonly SubscriberPageDataRepository $pageDataRepository, private readonly EntityManagerInterface $entityManager, - private readonly TranslatorInterface $translator, ) { } @@ -35,17 +32,6 @@ public function createPage(string $title, bool $active = false, ?Administrator $ return $page; } - public function getPage(int $id): SubscribePage - { - /** @var SubscribePage|null $page */ - $page = $this->pageRepository->find($id); - if (!$page) { - throw new NotFoundHttpException($this->translator->trans('Subscribe page not found')); - } - - return $page; - } - public function updatePage( SubscribePage $page, ?string $title = null, diff --git a/tests/Unit/Domain/Subscription/Service/Manager/SubscribePageManagerTest.php b/tests/Unit/Domain/Subscription/Service/Manager/SubscribePageManagerTest.php index 0c29242a..8d0dff73 100644 --- a/tests/Unit/Domain/Subscription/Service/Manager/SubscribePageManagerTest.php +++ b/tests/Unit/Domain/Subscription/Service/Manager/SubscribePageManagerTest.php @@ -13,8 +13,6 @@ use PhpList\Core\Domain\Subscription\Service\Manager\SubscribePageManager; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; -use Symfony\Component\Translation\Translator; class SubscribePageManagerTest extends TestCase { @@ -33,7 +31,6 @@ protected function setUp(): void pageRepository: $this->pageRepository, pageDataRepository: $this->pageDataRepository, entityManager: $this->entityManager, - translator: new Translator('en'), ); } @@ -53,34 +50,6 @@ public function testCreatePageCreatesAndSaves(): void $this->assertSame($owner, $page->getOwner()); } - public function testGetPageReturnsPage(): void - { - $page = new SubscribePage(); - $this->pageRepository - ->expects($this->once()) - ->method('find') - ->with(123) - ->willReturn($page); - - $result = $this->manager->getPage(123); - - $this->assertSame($page, $result); - } - - public function testGetPageThrowsWhenNotFound(): void - { - $this->pageRepository - ->expects($this->once()) - ->method('find') - ->with(999) - ->willReturn(null); - - $this->expectException(NotFoundHttpException::class); - $this->expectExceptionMessage('Subscribe page not found'); - - $this->manager->getPage(999); - } - public function testUpdatePageUpdatesProvidedFieldsAndFlushes(): void { $originalOwner = new Administrator();