Fixed youtube uploads

This commit is contained in:
Marcin Kurczewski 2014-05-16 17:24:32 +02:00
parent c15f59db39
commit 538c5054d6
2 changed files with 25 additions and 1 deletions

View file

@ -57,7 +57,7 @@ final class PostEntity extends AbstractEntity implements IValidatable
if (empty($this->getType()))
throw new SimpleException('No post type detected');
if (empty($this->tryGetWorkingFullPath()))
if (empty($this->tryGetWorkingFullPath()) and $this->type->toInteger() != PostType::Youtube)
throw new SimpleException('No post content');
if (empty($this->getTags()))

View file

@ -34,6 +34,30 @@ class AddPostJobTest extends AbstractTest
$this->assert->isNotNull($post->getUploaderId());
}
public function testYoutube()
{
$this->prepare();
$this->grantAccess('addPost');
$this->grantAccess('addPostTags');
$this->grantAccess('addPostContent');
$this->login($this->userMocker->mockSingle());
$post = $this->assert->doesNotThrow(function()
{
return Api::run(
new AddPostJob(),
[
JobArgs::ARG_NEW_TAG_NAMES => ['kamen', 'raider'],
JobArgs::ARG_NEW_POST_CONTENT_URL => 'http://www.youtube.com/watch?v=qWq_jydCUw4',
]);
});
$this->assert->areEqual(PostType::Youtube, $post->getType()->toInteger());
$this->assert->areEqual('qWq_jydCUw4', $post->getFileHash());
}
public function testAnonymousUploads()
{
$this->prepare();