fbef8891a5bd9e0433b410f0ea4f6606d0523951
[GitHub/WoltLab/WCF.git] /
1 <?php
2 declare(strict_types=1);
3 namespace wcf\system\user\notification\event;
4 use wcf\data\comment\response\LikeableCommentResponse;
5 use wcf\data\user\UserProfile;
6 use wcf\system\user\notification\object\IUserNotificationObject;
7
8 /**
9 * Default implementation of some methods of the testable user notification event interface
10 * for comment response like user notificiation events.
11 *
12 * @author Matthias Schmidt
13 * @copyright 2001-2018 WoltLab GmbH
14 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
15 * @package WoltLabSuite\Core\System\User\Notification\Event
16 * @since 3.1
17 */
18 trait TTestableCommentResponseLikeUserNotificationEvent {
19 use TTestableCommentResponseUserNotificationEvent;
20 use TTestableLikeUserNotificationEvent {
21 TTestableLikeUserNotificationEvent::canBeTriggeredByGuests insteadof TTestableCommentResponseUserNotificationEvent;
22 TTestableLikeUserNotificationEvent::getTestObjects insteadof TTestableCommentResponseUserNotificationEvent;
23 }
24
25 /**
26 * @inheritDoc
27 */
28 protected static function createTestLikeObject(UserProfile $recipient, UserProfile $author) {
29 return new LikeableCommentResponse(self::createTestCommentResponse($recipient, $author));
30 }
31
32 /**
33 * @inheritDoc
34 */
35 public static function getTestAdditionalData(IUserNotificationObject $object) {
36 /** @var LikeableCommentResponse $likedObject */
37 $likedObject = self::getTestLikeObject($object);
38
39 return [
40 'commentID' => $likedObject->getComment()->commentID,
41 'commentUserID' => $likedObject->getComment()->userID,
42 'objectID' => $likedObject->getComment()->objectID
43 ];
44 }
45
46 /**
47 * @inheritDoc
48 */
49 protected static function getTestLikeableObjectTypeName() {
50 return 'com.woltlab.wcf.comment.response';
51 }
52 }