예제 #1
0
 public function testFillModel()
 {
     $data = new WritePostDTO();
     $data->setContent('foobar');
     $data->setUser($user = User::fromDTO(new CreateUserDTO('Ma27', '123456', '*****@*****.**')));
     $post = Post::fill($data);
     $this->assertSame('foobar', $post->getContent());
     $this->assertSame($user, $post->getAuthor());
 }
예제 #2
0
 /**
  * Creates the entity by a dto
  *
  * @param \Sententiaregum\Dashboard\DTO\WritePostDTO $postData
  *
  * @return Post
  */
 public static function fill(WritePostDTO $postData)
 {
     return new self($postData->getUser(), $postData->getContent());
 }