Move API status tests

This commit is contained in:
Philipp 2021-12-30 22:02:57 +01:00
parent 43a001bf73
commit 2c15fb03ff
No known key found for this signature in database
GPG Key ID: 24A7501396EB5432
2 changed files with 26 additions and 29 deletions

View File

@ -638,35 +638,6 @@ class ApiTest extends FixtureTest
); );
} }
/**
* Test the api_get_entitities() function.
*
* @return void
*/
public function testApiGetEntitities()
{
// $text = 'text';
// self::assertIsArray(api_get_entitities($text, 'bbcode', 0));
}
/**
* Test the api_get_entitities() function with the include_entities parameter.
*
* @return void
*/
public function testApiGetEntititiesWithIncludeEntities()
{
/*
$_REQUEST['include_entities'] = 'true';
$text = 'text';
$result = api_get_entitities($text, 'bbcode', 0);
self::assertIsArray($result['hashtags']);
self::assertIsArray($result['symbols']);
self::assertIsArray($result['urls']);
self::assertIsArray($result['user_mentions']);
*/
}
/** /**
* Test the api_format_items_embeded_images() function. * Test the api_format_items_embeded_images() function.
* *

View File

@ -82,4 +82,30 @@ class StatusTest extends FixtureTest
self::assertEquals('<h4>item_title</h4><br>item_title item_body', $result['html']); self::assertEquals('<h4>item_title</h4><br>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']);
}
} }