Added post content existence validation

This commit is contained in:
Marcin Kurczewski 2014-05-13 14:08:00 +02:00
parent 561ebd5508
commit dcd2c8aa06
2 changed files with 4 additions and 0 deletions

View file

@ -56,6 +56,9 @@ final class PostEntity extends AbstractEntity implements IValidatable
if (empty($this->getType()))
throw new SimpleException('No post type detected');
if (empty($this->tryGetWorkingFullPath()))
throw new SimpleException('No post content');
if (empty($this->getTags()))
throw new SimpleException('No tags set');

View file

@ -38,6 +38,7 @@ class AbstractTest
$post->setUploader($owner);
$post->setType(new PostType(PostType::Image));
$post->setTags([$this->mockTag(), $this->mockTag()]);
copy($this->getPath('image.jpg'), $post->getFullPath());
return PostModel::save($post);
}