/** * Test Aggregate method. */ public function testAggregate() { $this->given($post = PostEventSourcedFactory::create($this->faker->sentence, $this->faker->paragraph))->and($event = new PostPersistEvent($post))->then()->object($event->aggregate())->isEqualTo($post); }
/** * @param PostPersistEvent $event */ public function onPostPersist(PostPersistEvent $event) { $event->aggregate()->version()->setPatch($event->aggregate()->version()->patch() * 2); }