Fixed youtube uploads
This commit is contained in:
parent
c15f59db39
commit
538c5054d6
2 changed files with 25 additions and 1 deletions
|
@ -57,7 +57,7 @@ final class PostEntity extends AbstractEntity implements IValidatable
|
||||||
if (empty($this->getType()))
|
if (empty($this->getType()))
|
||||||
throw new SimpleException('No post type detected');
|
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');
|
throw new SimpleException('No post content');
|
||||||
|
|
||||||
if (empty($this->getTags()))
|
if (empty($this->getTags()))
|
||||||
|
|
|
@ -34,6 +34,30 @@ class AddPostJobTest extends AbstractTest
|
||||||
$this->assert->isNotNull($post->getUploaderId());
|
$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()
|
public function testAnonymousUploads()
|
||||||
{
|
{
|
||||||
$this->prepare();
|
$this->prepare();
|
||||||
|
|
Loading…
Reference in a new issue