use wcf\data\comment\Comment;
use wcf\data\comment\CommentAction;
use wcf\data\comment\CommentEditor;
+use wcf\data\object\type\ObjectTypeCache;
use wcf\data\user\UserProfile;
+use wcf\system\comment\manager\ICommentManager;
use wcf\system\user\notification\object\CommentResponseUserNotificationObject;
use wcf\system\user\notification\object\IUserNotificationObject;
], self::getTestCommentObjectData($recipient, $author))
]))->executeAction()['returnValues'];
+ /** @var ICommentManager $commentManager */
+ $commentManager = ObjectTypeCache::getInstance()->getObjectType($comment->objectTypeID)->getProcessor();
+ $commentManager->updateCounter($comment->objectID, 1);
+
/** @var CommentResponse $commentResponse */
$commentResponse = (new CommentResponseAction([], 'create', [
'data' => [
namespace wcf\system\user\notification\event;
use wcf\data\comment\Comment;
use wcf\data\comment\CommentAction;
+use wcf\data\object\type\ObjectTypeCache;
use wcf\data\user\UserProfile;
+use wcf\system\comment\manager\ICommentManager;
use wcf\system\user\notification\object\CommentUserNotificationObject;
use wcf\system\user\notification\object\IUserNotificationObject;
* @return Comment
*/
public static function createTestComment(UserProfile $recipient, UserProfile $author) {
- return (new CommentAction([], 'create', [
+ /** @var Comment $comment */
+ $comment = (new CommentAction([], 'create', [
'data' => array_merge([
'enableHtml' => 1,
'isDisabled' => 0,
'username' => $recipient->username
], self::getTestCommentObjectData($recipient, $author))
]))->executeAction()['returnValues'];
+
+ /** @var ICommentManager $commentManager */
+ $commentManager = ObjectTypeCache::getInstance()->getObjectType($comment->objectTypeID)->getProcessor();
+ $commentManager->updateCounter($comment->objectID, 1);
+
+ return $comment;
}
/**