Exemplo n.º 1
0
 /**
  * @test
  */
 public function it_can_retract_a_post()
 {
     $draft = Post::draft(new PostTitle('The answer to life, the universe and everything.'), new PostIntroduction('intro to 42'), new PostContent('42'));
     $postDateTime = new DateTimeImmutable('2016-01-13');
     $draft->publish($postDateTime);
     $draft->retract();
     $this->assertFalse($draft->isPublished());
     $this->assertEquals(null, $draft->getPostDateTime());
 }
Exemplo n.º 2
0
 /**
  * @param AddDraft $command
  * @throws InvalidArgumentException
  */
 public function handle(AddDraft $command)
 {
     $this->postRepository->save(Post::draft(new PostTitle($command->title), new PostIntroduction($command->introduction), new PostContent($command->content)));
 }