[TESTS] Added unit tests

This commit is contained in:
Daniel
2020-10-16 01:07:01 +01:00
committed by Hugo Sales
parent d53fef09a8
commit 95f95d2dd8
29 changed files with 716 additions and 477 deletions

View File

@@ -18,12 +18,13 @@
* ActivityPub implementation for GNU social
*
* @package GNUsocial
*
* @author Diogo Cordeiro <diogo@fc.up.pt>
* @copyright 2018-2019 Free Software Foundation, Inc http://www.fsf.org
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
* @link http://www.gnu.org/software/social/
*
* @see http://www.gnu.org/software/social/
*/
defined('GNUSOCIAL') || die();
/**
@@ -31,6 +32,7 @@ defined('GNUSOCIAL') || die();
*
* @category Plugin
* @package GNUsocial
*
* @author Diogo Cordeiro <diogo@fc.up.pt>
* @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
*/
@@ -39,8 +41,11 @@ class Activitypub_like
/**
* Generates an ActivityPub representation of a Like
*
* @author Diogo Cordeiro <diogo@fc.up.pt>
*
* @param string $actor Actor URI
* @param Notice $notice Notice URI
* @param string $object Notice URI
*
* @return array pretty array to be used in a response
* @author Diogo Cordeiro <diogo@fc.up.pt>
*/
@@ -48,10 +53,10 @@ class Activitypub_like
{
$res = [
'@context' => 'https://www.w3.org/ns/activitystreams',
'id' => Activitypub_notice::getUri($notice),
'id' => common_root_url() . 'like_from_' . urlencode($actor) . '_to_' . urlencode($object),
'type' => 'Like',
'actor' => $actor,
'object' => Activitypub_notice::getUri($notice->getParent()),
'object' => $object,
];
return $res;
}