2014-05-13 21:08:07 +02:00
|
|
|
<?php
|
|
|
|
class PostMocker extends AbstractMocker implements IMocker
|
|
|
|
{
|
|
|
|
private $tagMocker;
|
|
|
|
private $testSupport;
|
|
|
|
|
|
|
|
public function __construct(
|
|
|
|
TagMocker $tagMocker,
|
|
|
|
TestSupport $testSupport)
|
|
|
|
{
|
|
|
|
$this->testSupport = $testSupport;
|
|
|
|
$this->tagMocker = $tagMocker;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function mockSingle()
|
|
|
|
{
|
|
|
|
$post = PostModel::spawn();
|
|
|
|
$post->setType(new PostType(PostType::Image));
|
|
|
|
$post->setTags([$this->tagMocker->mockSingle()]);
|
2014-06-01 13:51:29 +02:00
|
|
|
copy($this->testSupport->getPath('image.jpg'), $post->getContentPath());
|
2014-05-13 21:08:07 +02:00
|
|
|
return PostModel::save($post);
|
|
|
|
}
|
|
|
|
}
|