/** @test */ public function it_can_create() { $this->markTestIncomplete('Post::create() does not exist.'); $id = 'my-id'; $this->scenario->when(function () use($id) { return Post::create($id); })->then([new PostWasCreated($id)]); }
public function handle(CreatePost $command) { $post = Post::create($command->id); $this->getPostRepository()->save($post); }
public function then(array $thens) { $this->testCase->assertEquals($thens, $this->post->getRecordedEvents()); $this->post->clearRecordedEvents(); return $this; }
/** * {@inheritdoc} */ public function save(Post $post) { $recordedEvents = $post->getRecordedEvents(); $this->eventStore->appendEvents($post->getId(), $recordedEvents); $this->eventBus->publish($recordedEvents); }