Unit tests for missing service methods
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -27,6 +27,7 @@ use OCA\Deck\Db\Attachment;
|
||||
use OCA\Deck\Db\AttachmentMapper;
|
||||
use OCA\Deck\Db\Board;
|
||||
use OCA\Deck\Db\BoardMapper;
|
||||
use OCA\Deck\InvalidAttachmentType;
|
||||
use OCA\Deck\Service\AttachmentService;
|
||||
use OCA\Deck\Service\IAttachmentService;
|
||||
|
||||
@@ -97,4 +98,24 @@ class DeleteCronTest extends \Test\TestCase {
|
||||
->with($attachment);
|
||||
$this->invokePrivate($this->deleteCron, 'run', [null]);
|
||||
}
|
||||
|
||||
public function testDeleteCronInvalidAttachment() {
|
||||
$boards = [];
|
||||
$this->boardMapper->expects($this->once())
|
||||
->method('findToDelete')
|
||||
->willReturn($boards);
|
||||
|
||||
$attachment = new Attachment();
|
||||
$attachment->setType('deck_file_invalid');
|
||||
$this->attachmentMapper->expects($this->once())
|
||||
->method('findToDelete')
|
||||
->willReturn([$attachment]);
|
||||
$this->attachmentService->expects($this->once())
|
||||
->method('getService')
|
||||
->will($this->throwException(new InvalidAttachmentType('deck_file_invalid')));
|
||||
$this->attachmentMapper->expects($this->once())
|
||||
->method('delete')
|
||||
->with($attachment);
|
||||
$this->invokePrivate($this->deleteCron, 'run', [null]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user