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