diff --git a/php/federator/test.php b/php/federator/test.php index bfaab0c..61f3456 100644 --- a/php/federator/test.php +++ b/php/federator/test.php @@ -91,6 +91,9 @@ class Test // pretend that we are running from web directory define('PROJECT_ROOT', dirname(__DIR__, 2)); $api = new \Federator\Api(); + $api->loadPlugins(); + $api->openDatabase(); + for ($i = 1; $i < $argc; ++$i) { switch ($argv[$i]) { case 'fetchoutbox': @@ -109,18 +112,18 @@ class Test /** - * print usage of maintenance tool + * print usage of test tool * * @return void */ public static function printUsage() { - echo "usage php maintenance.php [ ...]\n"; + echo "usage php test.php [ ...]\n"; echo "command can be one of:\n"; echo " fetchoutbox - fetch users outbox. parameter: username\n"; echo " upvote - upvote. parameter: URL to upvote\n"; echo " downvote - downvote. parameter: URL to downvote\n"; - echo " comment - downvote. parameter: URL to comment, text to comment\n"; + echo " comment - comment. parameter: URL to comment, text to comment\n"; echo " Run this after you updated the program files\n"; exit(); } @@ -136,13 +139,16 @@ class Test public static function upvote($api, $_url) { $dbh = $api->getDatabase(); - $inboxActivity = new \Federator\Data\ActivityPub\Common\Create(); + $inboxActivity = new \Federator\Data\ActivityPub\Common\Like(); + $inboxActivity->setAActor('https://mastodon.local/users/admin'); + $inboxActivity->setObject($_url); + $inboxActivity->setID("https://mastodon.local/users/admin#like/" . md5($_url)); \Federator\Api\FedUsers\Inbox::postForUser( $dbh, $api->getConnector(), null, - 'grumpydevelop', - $_url, + 'admin@mastodon.local', + "grumpydevelop@192.168.178.143", $inboxActivity ); }