createFromItemId(13, ApiTest::SELF_USER['id']);
$status = $statusObj->toArray();
self::assertStringStartsWith('item_title', $status['text']);
self::assertStringStartsWith('
item_title
perspiciatis impedit voluptatem', $status['friendica_html']);
}
/**
* Test the api_convert_item() function with an empty item body.
*
* @return void
*/
public function testApiConvertItemWithoutBody()
{
self::markTestIncomplete('Needs a dataset first');
/*
$result = api_convert_item(
[
'network' => 'feed',
'title' => 'item_title',
'uri-id' => -1,
'body' => '',
'plink' => 'item_plink'
]
);
self::assertEquals("item_title", $result['text']);
self::assertEquals('item_title
item_plink', $result['html']);
*/
}
/**
* Test the api_convert_item() function with the title in the body.
*
* @return void
*/
public function testApiConvertItemWithTitleInBody()
{
self::markTestIncomplete('Needs a dataset first');
/*
$result = api_convert_item(
[
'title' => 'item_title',
'body' => 'item_title item_body',
'uri-id' => 1,
]
);
self::assertEquals('item_title item_body', $result['text']);
self::assertEquals('item_title
item_title item_body', $result['html']);
*/
}
/**
* Test the api_get_entitities() function.
*
* @return void
*/
public function testApiGetEntititiesWithIncludeEntities()
{
$hashTagFac = new Hashtag(DI::logger());
$mediaFac = new Media(DI::logger(), DI::baseUrl());
$urlFac = new Url(DI::logger());
$mentionFac = new Mention(DI::logger(), DI::baseUrl());
$activitiesFac = new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser());
$attachmentFac = new Attachment(DI::logger());
$statusFac = new Status(DI::logger(), DI::dba(), DI::twitterUser(), $hashTagFac, $mediaFac, $urlFac, $mentionFac, $activitiesFac, $attachmentFac);
$statusObj = $statusFac->createFromItemId(13, ApiTest::SELF_USER['id'], true);
$status = $statusObj->toArray();
self::assertIsArray($status['entities']);
self::assertIsArray($status['extended_entities']);
self::assertIsArray($status['entities']['hashtags']);
self::assertIsArray($status['entities']['media']);
self::assertIsArray($status['entities']['urls']);
self::assertIsArray($status['entities']['user_mentions']);
}
/**
* Test the api_format_items() function.
*/
public function testApiFormatItems()
{
$hashTagFac = new Hashtag(DI::logger());
$mediaFac = new Media(DI::logger(), DI::baseUrl());
$urlFac = new Url(DI::logger());
$mentionFac = new Mention(DI::logger(), DI::baseUrl());
$activitiesFac = new Activities(DI::logger(), DI::baseUrl(), DI::twitterUser());
$attachmentFac = new Attachment(DI::logger());
$statusFac = new Status(DI::logger(), DI::dba(), DI::twitterUser(), $hashTagFac, $mediaFac, $urlFac, $mentionFac, $activitiesFac, $attachmentFac);
$posts = DI::dba()->selectToArray('post-view', ['uri-id']);
foreach ($posts as $item) {
$statusObj = $statusFac->createFromUriId($item['uri-id'], ApiTest::SELF_USER['id']);
$status = $statusObj->toArray();
self::assertIsInt($status['id']);
self::assertIsString($status['text']);
}
}
}