d11f071f8e31f573ffb53b839b760b8293c48fe7
[GitHub/WoltLab/WCF.git] /
1 <?php
2 declare(strict_types=1);
3 namespace wcf\system\user\notification\event;
4 use wcf\data\comment\LikeableComment;
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 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 TTestableCommentLikeUserNotificationEvent {
19 use TTestableCommentUserNotificationEvent;
20 use TTestableLikeUserNotificationEvent {
21 TTestableLikeUserNotificationEvent::canBeTriggeredByGuests insteadof TTestableCommentUserNotificationEvent;
22 TTestableLikeUserNotificationEvent::getTestObjects insteadof TTestableCommentUserNotificationEvent;
23 }
24
25 /**
26 * @inheritDoc
27 */
28 protected static function createTestLikeObject(UserProfile $recipient, UserProfile $author) {
29 return new LikeableComment(self::createTestComment($recipient, $author));
30 }
31
32 /**
33 * @inheritDoc
34 */
35 public static function getTestAdditionalData(IUserNotificationObject $object) {
36 /** @var LikeableComment $likedObject */
37 $likedObject = self::getTestLikeObject($object);
38
39 return [
40 'objectID' => $likedObject->objectID,
41 'objectOwnerID' => $likedObject->getUserID()
42 ];
43 }
44
45 /**
46 * @inheritDoc
47 */
48 protected static function getTestLikeableObjectTypeName() {
49 return 'com.woltlab.wcf.comment';
50 }
51 }