コード例 #1
0
 /** @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)]);
 }
コード例 #2
0
 public function handle(CreatePost $command)
 {
     $post = Post::create($command->id);
     $this->getPostRepository()->save($post);
 }
コード例 #3
0
 public function then(array $thens)
 {
     $this->testCase->assertEquals($thens, $this->post->getRecordedEvents());
     $this->post->clearRecordedEvents();
     return $this;
 }
コード例 #4
0
 /**
  * {@inheritdoc}
  */
 public function save(Post $post)
 {
     $recordedEvents = $post->getRecordedEvents();
     $this->eventStore->appendEvents($post->getId(), $recordedEvents);
     $this->eventBus->publish($recordedEvents);
 }