Skip to content

Commit

Permalink
Move SuluAutomationBundle services into Infrastructure namespace (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasnatter authored May 19, 2020
1 parent 0cf6d8f commit 225f969
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,7 +22,7 @@
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\TranslatorInterface;

class ContentEntityPublishHandler implements AutomationTaskHandlerInterface
class ContentPublishTaskHandler implements AutomationTaskHandlerInterface
{
/**
* @var ContentManagerInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -22,7 +22,7 @@
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Translation\TranslatorInterface;

class ContentEntityUnpublishHandler implements AutomationTaskHandlerInterface
class ContentUnpublishTaskHandler implements AutomationTaskHandlerInterface
{
/**
* @var ContentManagerInterface
Expand Down
4 changes: 2 additions & 2 deletions Resources/config/automation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<services>
<service id="sulu_content.content.automation.publish_handler"
class="Sulu\Bundle\ContentBundle\Content\Application\Automation\Handler\ContentEntityPublishHandler">
class="ContentPublishTaskHandler">
<argument type="service" id="sulu_content.content_manager"/>
<argument type="service" id="doctrine.orm.entity_manager"/>
<argument type="service" id="translator"/>
Expand All @@ -13,7 +13,7 @@
</service>

<service id="sulu_content.content.automation.unpublish_handler"
class="Sulu\Bundle\ContentBundle\Content\Application\Automation\Handler\ContentEntityUnpublishHandler">
class="ContentUnpublishTaskHandler">
<argument type="service" id="sulu_content.content_manager"/>
<argument type="service" id="doctrine.orm.entity_manager"/>
<argument type="service" id="translator"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -48,7 +48,7 @@ class ContentEntityPublishHandlerTest extends TestCase
private $translator;

/**
* @var ContentEntityPublishHandler
* @var ContentPublishTaskHandler
*/
private $handler;

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -48,7 +48,7 @@ class ContentEntityUnpublishHandlerTest extends TestCase
private $translator;

/**
* @var ContentEntityUnpublishHandler
* @var ContentUnpublishTaskHandler
*/
private $handler;

Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 225f969

Please sign in to comment.