From a4c05d724914fa04abef12094382c3129e68bb14 Mon Sep 17 00:00:00 2001 From: Karel Date: Thu, 22 Aug 2019 14:08:57 +0200 Subject: [PATCH] AclCommentManager::saveComment must have a return value (#692) * AclCommentManager::saveComment must have a return value * Fixed unit test --- Acl/AclCommentManager.php | 6 ++++-- Tests/Acl/AclCommentManagerTest.php | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Acl/AclCommentManager.php b/Acl/AclCommentManager.php index 3f435044b..c792044d9 100644 --- a/Acl/AclCommentManager.php +++ b/Acl/AclCommentManager.php @@ -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; } /** diff --git a/Tests/Acl/AclCommentManagerTest.php b/Tests/Acl/AclCommentManagerTest.php index fd0dae7d4..55197977a 100644 --- a/Tests/Acl/AclCommentManagerTest.php +++ b/Tests/Acl/AclCommentManagerTest.php @@ -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); }