szurubooru/tests/Support/Mockers/PostMocker.php
Marcin Kurczewski e59b7e8b7b Refactored privilege system a bit
- Jobs specify main privilege and sub privileges separately
  Rationale: increase maintenance, restrict what can be done runtime
- Renamed ChangeUser* to EditUser* (consistency with EditPost*)
- Simplified enum names and configuration reading
- IJob interface members must be explicitly implemented
  Rationale: reduce chances of forgetting something, or typos in
  inherited method names
- Invalid privileges names in configuration yield exceptions
2014-05-18 21:59:56 +02:00

23 lines
545 B
PHP

<?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()]);
copy($this->testSupport->getPath('image.jpg'), $post->getFullPath());
return PostModel::save($post);
}
}