Skip to content

Commit

Permalink
Tests: Comment actrivity parsing
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Oct 9, 2018
1 parent 68880fc commit 4779d3a
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/unit/Activity/DeckProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
use OC\Activity\Event;
use OCA\Deck\Db\Acl;
use OCP\Activity\IEvent;
use OCP\Comments\IComment;
use OCP\Comments\ICommentsManager;
use OCP\IL10N;
use OCP\IURLGenerator;
Expand Down Expand Up @@ -449,6 +450,30 @@ public function testParseParamForChanges() {
$this->assertEquals($expected, $actual);
}

public function testParseParamForComment() {
$comment = $this->createMock(IComment::class);
$comment->expects($this->once())
->method('getMessage')
->willReturn('Comment content');
$this->commentsManager->expects($this->once())
->method('get')
->with(123)
->willReturn($comment);
$event = $this->createMock(IEvent::class);
$event->expects($this->once())
->method('setParsedMessage')
->with('Comment content');
$params = [];
$subjectParams = [
'comment' => 123
];
$expected = [
'comment' => 123,
];
$actual = $this->invokePrivate($this->provider, 'parseParamForComment', [$subjectParams, $params, $event]);
$this->assertEquals($expected, $actual);
}

public function invokePrivate(&$object, $methodName, array $parameters = array())
{
$reflection = new \ReflectionClass(get_class($object));
Expand Down

0 comments on commit 4779d3a

Please sign in to comment.