From 225f9699998d3a64d88e0b3c88886c044320fade Mon Sep 17 00:00:00 2001 From: nnatter Date: Tue, 19 May 2020 18:20:24 +0200 Subject: [PATCH] Move SuluAutomationBundle services into Infrastructure namespace (#146) --- .../Sulu/Automation/ContentPublishTaskHandler.php} | 4 ++-- .../Sulu/Automation/ContentUnpublishTaskHandler.php} | 4 ++-- Resources/config/automation.xml | 4 ++-- .../Sulu/Automation/ContentPublishTaskHandlerTest.php} | 10 +++++----- .../Automation/ContentUnpublishTaskHandlerTest.php} | 10 +++++----- UPGRADE.md | 7 +++++++ 6 files changed, 23 insertions(+), 16 deletions(-) rename Content/{Application/Automation/Handler/ContentEntityPublishHandler.php => Infrastructure/Sulu/Automation/ContentPublishTaskHandler.php} (94%) rename Content/{Application/Automation/Handler/ContentEntityUnpublishHandler.php => Infrastructure/Sulu/Automation/ContentUnpublishTaskHandler.php} (94%) rename Tests/Unit/Content/{Application/Automation/ContentEntityPublishHandlerTest.php => Infrastructure/Sulu/Automation/ContentPublishTaskHandlerTest.php} (89%) rename Tests/Unit/Content/{Application/Automation/ContentEntityUnpublishHandlerTest.php => Infrastructure/Sulu/Automation/ContentUnpublishTaskHandlerTest.php} (89%) diff --git a/Content/Application/Automation/Handler/ContentEntityPublishHandler.php b/Content/Infrastructure/Sulu/Automation/ContentPublishTaskHandler.php similarity index 94% rename from Content/Application/Automation/Handler/ContentEntityPublishHandler.php rename to Content/Infrastructure/Sulu/Automation/ContentPublishTaskHandler.php index 7e21b393..ba368420 100644 --- a/Content/Application/Automation/Handler/ContentEntityPublishHandler.php +++ b/Content/Infrastructure/Sulu/Automation/ContentPublishTaskHandler.php @@ -11,7 +11,7 @@ * with this source code in the file LICENSE. */ -namespace Sulu\Bundle\ContentBundle\Content\Application\Automation\Handler; +namespace Sulu\Bundle\ContentBundle\Content\Infrastructure\Sulu\Automation; use Doctrine\ORM\EntityManagerInterface; use Sulu\Bundle\AutomationBundle\TaskHandler\AutomationTaskHandlerInterface; @@ -22,7 +22,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Translation\TranslatorInterface; -class ContentEntityPublishHandler implements AutomationTaskHandlerInterface +class ContentPublishTaskHandler implements AutomationTaskHandlerInterface { /** * @var ContentManagerInterface diff --git a/Content/Application/Automation/Handler/ContentEntityUnpublishHandler.php b/Content/Infrastructure/Sulu/Automation/ContentUnpublishTaskHandler.php similarity index 94% rename from Content/Application/Automation/Handler/ContentEntityUnpublishHandler.php rename to Content/Infrastructure/Sulu/Automation/ContentUnpublishTaskHandler.php index d7075087..440cf5e4 100644 --- a/Content/Application/Automation/Handler/ContentEntityUnpublishHandler.php +++ b/Content/Infrastructure/Sulu/Automation/ContentUnpublishTaskHandler.php @@ -11,7 +11,7 @@ * with this source code in the file LICENSE. */ -namespace Sulu\Bundle\ContentBundle\Content\Application\Automation\Handler; +namespace Sulu\Bundle\ContentBundle\Content\Infrastructure\Sulu\Automation; use Doctrine\ORM\EntityManagerInterface; use Sulu\Bundle\AutomationBundle\TaskHandler\AutomationTaskHandlerInterface; @@ -22,7 +22,7 @@ use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Translation\TranslatorInterface; -class ContentEntityUnpublishHandler implements AutomationTaskHandlerInterface +class ContentUnpublishTaskHandler implements AutomationTaskHandlerInterface { /** * @var ContentManagerInterface diff --git a/Resources/config/automation.xml b/Resources/config/automation.xml index 0ae413e5..3072880d 100644 --- a/Resources/config/automation.xml +++ b/Resources/config/automation.xml @@ -4,7 +4,7 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> + class="ContentPublishTaskHandler"> @@ -13,7 +13,7 @@ + class="ContentUnpublishTaskHandler"> diff --git a/Tests/Unit/Content/Application/Automation/ContentEntityPublishHandlerTest.php b/Tests/Unit/Content/Infrastructure/Sulu/Automation/ContentPublishTaskHandlerTest.php similarity index 89% rename from Tests/Unit/Content/Application/Automation/ContentEntityPublishHandlerTest.php rename to Tests/Unit/Content/Infrastructure/Sulu/Automation/ContentPublishTaskHandlerTest.php index 1895d291..683fca5b 100644 --- a/Tests/Unit/Content/Application/Automation/ContentEntityPublishHandlerTest.php +++ b/Tests/Unit/Content/Infrastructure/Sulu/Automation/ContentPublishTaskHandlerTest.php @@ -11,22 +11,22 @@ * with this source code in the file LICENSE. */ -namespace Sulu\Bundle\ContentBundle\Tests\Unit\Content\Application\Automation; +namespace Sulu\Bundle\ContentBundle\Tests\Unit\Content\Infrastructure\Sulu\Automation; use Doctrine\Common\Persistence\ObjectRepository; use Doctrine\ORM\EntityManagerInterface; use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; -use Sulu\Bundle\ContentBundle\Content\Application\Automation\Handler\ContentEntityPublishHandler; use Sulu\Bundle\ContentBundle\Content\Application\ContentManager\ContentManagerInterface; use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface; use Sulu\Bundle\ContentBundle\Content\Domain\Model\WorkflowInterface; +use Sulu\Bundle\ContentBundle\Content\Infrastructure\Sulu\Automation\ContentPublishTaskHandler; use Sulu\Bundle\PageBundle\Document\PageDocument; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Translation\TranslatorInterface; -class ContentEntityPublishHandlerTest extends TestCase +class ContentPublishTaskHandlerTest extends TestCase { /** * @var EntityManagerInterface|ObjectProphecy @@ -48,7 +48,7 @@ class ContentEntityPublishHandlerTest extends TestCase private $translator; /** - * @var ContentEntityPublishHandler + * @var ContentPublishTaskHandler */ private $handler; @@ -61,7 +61,7 @@ protected function setUp(): void $this->contentManager = $this->prophesize(ContentManagerInterface::class); $this->translator = $this->prophesize(TranslatorInterface::class); - $this->handler = new ContentEntityPublishHandler($this->contentManager->reveal(), $this->entityManager->reveal(), $this->translator->reveal()); + $this->handler = new ContentPublishTaskHandler($this->contentManager->reveal(), $this->entityManager->reveal(), $this->translator->reveal()); } public function testPublish(): void diff --git a/Tests/Unit/Content/Application/Automation/ContentEntityUnpublishHandlerTest.php b/Tests/Unit/Content/Infrastructure/Sulu/Automation/ContentUnpublishTaskHandlerTest.php similarity index 89% rename from Tests/Unit/Content/Application/Automation/ContentEntityUnpublishHandlerTest.php rename to Tests/Unit/Content/Infrastructure/Sulu/Automation/ContentUnpublishTaskHandlerTest.php index a93ed4f2..4bedb09c 100644 --- a/Tests/Unit/Content/Application/Automation/ContentEntityUnpublishHandlerTest.php +++ b/Tests/Unit/Content/Infrastructure/Sulu/Automation/ContentUnpublishTaskHandlerTest.php @@ -11,22 +11,22 @@ * with this source code in the file LICENSE. */ -namespace Sulu\Bundle\ContentBundle\Tests\Unit\Content\Application\Automation; +namespace Sulu\Bundle\ContentBundle\Tests\Unit\Content\Infrastructure\Sulu\Automation; use Doctrine\Common\Persistence\ObjectRepository; use Doctrine\ORM\EntityManagerInterface; use PHPUnit\Framework\TestCase; use Prophecy\Argument; use Prophecy\Prophecy\ObjectProphecy; -use Sulu\Bundle\ContentBundle\Content\Application\Automation\Handler\ContentEntityUnpublishHandler; use Sulu\Bundle\ContentBundle\Content\Application\ContentManager\ContentManagerInterface; use Sulu\Bundle\ContentBundle\Content\Domain\Model\ContentRichEntityInterface; use Sulu\Bundle\ContentBundle\Content\Domain\Model\WorkflowInterface; +use Sulu\Bundle\ContentBundle\Content\Infrastructure\Sulu\Automation\ContentUnpublishTaskHandler; use Sulu\Bundle\PageBundle\Document\PageDocument; use Symfony\Component\OptionsResolver\OptionsResolver; use Symfony\Component\Translation\TranslatorInterface; -class ContentEntityUnpublishHandlerTest extends TestCase +class ContentUnpublishTaskHandlerTest extends TestCase { /** * @var EntityManagerInterface|ObjectProphecy @@ -48,7 +48,7 @@ class ContentEntityUnpublishHandlerTest extends TestCase private $translator; /** - * @var ContentEntityUnpublishHandler + * @var ContentUnpublishTaskHandler */ private $handler; @@ -61,7 +61,7 @@ protected function setUp(): void $this->contentManager = $this->prophesize(ContentManagerInterface::class); $this->translator = $this->prophesize(TranslatorInterface::class); - $this->handler = new ContentEntityUnpublishHandler($this->contentManager->reveal(), $this->entityManager->reveal(), $this->translator->reveal()); + $this->handler = new ContentUnpublishTaskHandler($this->contentManager->reveal(), $this->entityManager->reveal(), $this->translator->reveal()); } public function testUnpublish(): void diff --git a/UPGRADE.md b/UPGRADE.md index 10c682de..6f547182 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -2,6 +2,13 @@ ## dev-master +### Moved automation bundle services + +The services related to the `SuluAutomationBundle` were moved to the +`Sulu\Bundle\ContentBundle\Content\Infrastructure\Sulu\Automation` namespace. +Furthermore the `ContentEntityPublishHandler` was renamed to `ContentPublishTaskHandler` and +the `ContentEntityUnpublishHandler` was renamed to `ContentUnpublishTaskHandler`. + ### Removed ContentProjection concept To simplify the usage of the bundle, the ContentProjection concept was removed from the source code.