mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-12 01:54:26 +02:00
Merge pull request #11127 from nupplaphil/feat/tests
Transform legacy API tests into new structure
This commit is contained in:
commit
0df539a65e
52 changed files with 1472 additions and 1298 deletions
|
@ -51,7 +51,7 @@ class DirectMessage extends BaseFactory
|
|||
*
|
||||
* @param int $id Mail id
|
||||
* @param int $uid Mail user
|
||||
* @param string $text_mode Either empty, "html" or "text"
|
||||
* @param string $text_mode Either empty, "html" or "plain"
|
||||
*
|
||||
* @return \Friendica\Object\Api\Twitter\DirectMessage
|
||||
*/
|
||||
|
|
|
@ -119,7 +119,19 @@ class Status extends BaseFactory
|
|||
|
||||
$friendica_comments = Post::countPosts(['thr-parent-id' => $item['uri-id'], 'deleted' => false, 'gravity' => GRAVITY_COMMENT]);
|
||||
|
||||
$text = Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
|
||||
$text = '';
|
||||
$title = '';
|
||||
|
||||
// Add the title to text / html if set
|
||||
if (!empty($item['title'])) {
|
||||
$text .= $item['title'] . ' ';
|
||||
$title = sprintf("[h4]%s[/h4]\n", $item['title']);
|
||||
}
|
||||
|
||||
$statusnetHtml = BBCode::convertForUriId($item['uri-id'], BBCode::setMentionsToNicknames($title . ($item['raw-body'] ?? $item['body'])), BBCode::API);
|
||||
$friendicaHtml = BBCode::convertForUriId($item['uri-id'], $title . $item['body'], BBCode::EXTERNAL);
|
||||
|
||||
$text .= Post\Media::addAttachmentsToBody($item['uri-id'], $item['body']);
|
||||
|
||||
$text = trim(HTML::toPlaintext(BBCode::convertForUriId($item['uri-id'], $text, BBCode::API), 0));
|
||||
|
||||
|
@ -190,6 +202,6 @@ class Status extends BaseFactory
|
|||
$entities = [];
|
||||
}
|
||||
|
||||
return new \Friendica\Object\Api\Twitter\Status($text, $item, $author, $owner, $retweeted, $quoted, $geo, $friendica_activities, $entities, $attachments, $friendica_comments, $liked);
|
||||
return new \Friendica\Object\Api\Twitter\Status($text, $statusnetHtml, $friendicaHtml, $item, $author, $owner, $retweeted, $quoted, $geo, $friendica_activities, $entities, $attachments, $friendica_comments, $liked);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue