[Chapter 7] Until the Read Side

This commit is contained in:
Carlos Buenosvinos
2022-03-12 12:57:18 +01:00
parent a856403b49
commit 05b97aceaa
4 changed files with 4 additions and 33 deletions

View File

@@ -1,29 +0,0 @@
<?php
declare(strict_types=1);
namespace Cheeper\Chapter7\Application\Author\Event;
use Cheeper\Chapter7\Application\Author\Projection\CreateFollowersCounterProjection;
use Cheeper\Chapter7\Application\Author\Projection\CreateFollowersCounterProjectionHandlerInterface;
use Cheeper\Chapter7\Application\Author\Projection\CreateTimelineProjection;
use Cheeper\Chapter7\Application\Author\Projection\CreateTimelineProjectionHandlerInterface;
use Cheeper\Chapter7\DomainModel\Author\NewAuthorSigned;
final class WhenNewAuthorSignedThenCreateTimelineProjectionEventHandler
{
public function __construct(
private CreateTimelineProjectionHandlerInterface $projector
) {
}
public function __invoke(NewAuthorSigned $event): void
{
$this->projector->__invoke(
CreateTimelineProjection::ofAuthor(
$event->authorId(),
$event->authorUsername()
)
);
}
}

View File

@@ -30,7 +30,7 @@ final class AuthorFollowedEventHandlerTest extends TestCase
AuthorId::nextIdentity(),
);
$eventHandler->handle(
$eventHandler(
AuthorFollowed::fromFollow(
$follow
)

View File

@@ -31,7 +31,7 @@ final class NewAuthorSignedEventHandlerTest extends TestCase
EmailAddress::from('alice@alice.com')
);
$eventHandler->handle(
$eventHandler(
NewAuthorSigned::fromAuthor($author)
);
}

View File

@@ -43,7 +43,7 @@ final class CheepPostedEventHandlerTest extends TestCase
$projectionBus
);
$eventHandler->handle(
$eventHandler(
CheepPosted::create(
CheepId::nextIdentity(),
AuthorId::nextIdentity(),
@@ -89,7 +89,7 @@ final class CheepPostedEventHandlerTest extends TestCase
$projectionBus
);
$eventHandler->handle(
$eventHandler(
CheepPosted::create(
CheepId::nextIdentity(),
$rockStarAuthorId,