Skip to content

Commit

Permalink
AclCommentManager::saveComment must have a return value (#692)
Browse files Browse the repository at this point in the history
* AclCommentManager::saveComment must have a return value

* Fixed unit test
  • Loading branch information
XWB authored Aug 22, 2019
1 parent b3589d0 commit a4c05d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Acl/AclCommentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,13 @@ public function saveComment(CommentInterface $comment)
throw new AccessDeniedException();
}

$this->realManager->saveComment($comment);
$state = $this->realManager->saveComment($comment);

if ($newComment) {
if ($state && $newComment) {
$this->commentAcl->setDefaultAcl($comment);
}

return $state;
}

/**
Expand Down
5 changes: 5 additions & 0 deletions Tests/Acl/AclCommentManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,11 @@ public function testSaveComment()
->with($this->equalTo($this->comment))
->will($this->returnValue(true));

$this->realManager->expects($this->once())
->method('saveComment')
->with($this->equalTo($this->comment))
->will($this->returnValue(true));

$manager = new AclCommentManager($this->realManager, $this->commentSecurity, $this->threadSecurity);
$manager->saveComment($this->comment, $this->parent);
}
Expand Down

0 comments on commit a4c05d7

Please sign in to comment.