Removing unused functions, added (deactivated) attachments

This commit is contained in:
Michael 2021-11-23 21:54:19 +00:00
commit 07c2f36946
6 changed files with 264 additions and 752 deletions

View file

@ -1130,8 +1130,8 @@ class ApiTest extends FixtureTest
*/
public function testApiStatusShowWithJson()
{
$result = api_status_show('json', 1);
self::assertStatus($result['status']);
// $result = api_status_show('json', 1);
// self::assertStatus($result['status']);
}
/**
@ -1139,8 +1139,8 @@ class ApiTest extends FixtureTest
*/
public function testApiStatusShowWithXml()
{
$result = api_status_show('xml', 1);
self::assertXml($result, 'statuses');
// $result = api_status_show('xml', 1);
// self::assertXml($result, 'statuses');
}
/**
@ -1148,9 +1148,8 @@ class ApiTest extends FixtureTest
*/
public function testApiGetLastStatus()
{
$item = api_get_last_status($this->selfUser['id'], $this->selfUser['id']);
self::assertNotNull($item);
// $item = api_get_last_status($this->selfUser['id'], $this->selfUser['id']);
// self::assertNotNull($item);
}
/**
@ -1998,6 +1997,7 @@ class ApiTest extends FixtureTest
*/
public function testApiConvertItem()
{
/*
$result = api_convert_item(
[
'network' => 'feed',
@ -2032,6 +2032,7 @@ class ApiTest extends FixtureTest
);
self::assertStringStartsWith('item_title', $result['text']);
self::assertStringStartsWith('<h4>item_title</h4><br>perspiciatis impedit voluptatem', $result['html']);
*/
}
/**
@ -2041,6 +2042,7 @@ class ApiTest extends FixtureTest
*/
public function testApiConvertItemWithoutBody()
{
/*
$result = api_convert_item(
[
'network' => 'feed',
@ -2052,6 +2054,7 @@ class ApiTest extends FixtureTest
);
self::assertEquals("item_title", $result['text']);
self::assertEquals('<h4>item_title</h4><br>item_plink', $result['html']);
*/
}
/**
@ -2061,6 +2064,7 @@ class ApiTest extends FixtureTest
*/
public function testApiConvertItemWithTitleInBody()
{
/*
$result = api_convert_item(
[
'title' => 'item_title',
@ -2070,6 +2074,7 @@ class ApiTest extends FixtureTest
);
self::assertEquals('item_title item_body', $result['text']);
self::assertEquals('<h4>item_title</h4><br>item_title item_body', $result['html']);
*/
}
/**
@ -2079,8 +2084,8 @@ class ApiTest extends FixtureTest
*/
public function testApiGetAttachments()
{
$body = 'body';
self::assertEmpty(api_get_attachments($body, 0));
// $body = 'body';
// self::assertEmpty(api_get_attachments($body, 0));
}
/**
@ -2090,8 +2095,8 @@ class ApiTest extends FixtureTest
*/
public function testApiGetAttachmentsWithImage()
{
$body = '[img]http://via.placeholder.com/1x1.png[/img]';
self::assertIsArray(api_get_attachments($body, 0));
// $body = '[img]http://via.placeholder.com/1x1.png[/img]';
// self::assertIsArray(api_get_attachments($body, 0));
}
/**
@ -2101,9 +2106,9 @@ class ApiTest extends FixtureTest
*/
public function testApiGetAttachmentsWithImageAndAndStatus()
{
$_SERVER['HTTP_USER_AGENT'] = 'AndStatus';
$body = '[img]http://via.placeholder.com/1x1.png[/img]';
self::assertIsArray(api_get_attachments($body, 0));
// $_SERVER['HTTP_USER_AGENT'] = 'AndStatus';
// $body = '[img]http://via.placeholder.com/1x1.png[/img]';
// self::assertIsArray(api_get_attachments($body, 0));
}
/**
@ -2113,8 +2118,8 @@ class ApiTest extends FixtureTest
*/
public function testApiGetEntitities()
{
$text = 'text';
self::assertIsArray(api_get_entitities($text, 'bbcode', 0));
// $text = 'text';
// self::assertIsArray(api_get_entitities($text, 'bbcode', 0));
}
/**
@ -2124,6 +2129,7 @@ class ApiTest extends FixtureTest
*/
public function testApiGetEntititiesWithIncludeEntities()
{
/*
$_REQUEST['include_entities'] = 'true';
$text = 'text';
$result = api_get_entitities($text, 'bbcode', 0);
@ -2131,6 +2137,7 @@ class ApiTest extends FixtureTest
self::assertIsArray($result['symbols']);
self::assertIsArray($result['urls']);
self::assertIsArray($result['user_mentions']);
*/
}
/**
@ -2140,42 +2147,12 @@ class ApiTest extends FixtureTest
*/
public function testApiFormatItemsEmbededImages()
{
/*
self::assertEquals(
'text ' . DI::baseUrl() . '/display/item_guid',
api_format_items_embeded_images(['guid' => 'item_guid'], 'text data:image/foo')
);
}
/**
* Test the api_contactlink_to_array() function.
*
* @return void
*/
public function testApiContactlinkToArray()
{
self::assertEquals(
[
'name' => 'text',
'url' => '',
],
api_contactlink_to_array('text')
);
}
/**
* Test the api_contactlink_to_array() function with an URL.
*
* @return void
*/
public function testApiContactlinkToArrayWithUrl()
{
self::assertEquals(
[
'name' => ['link_text'],
'url' => ['url'],
],
api_contactlink_to_array('text <a href="url">link_text</a>')
);
*/
}
/**
@ -2216,11 +2193,13 @@ class ApiTest extends FixtureTest
*/
public function testApiFormatItems()
{
/*
$items = Post::selectToArray([], ['uid' => 42]);
foreach ($items as $item) {
$status = api_format_item($item);
self::assertStatus($status);
}
*/
}
/**
@ -2229,11 +2208,13 @@ class ApiTest extends FixtureTest
*/
public function testApiFormatItemsWithXml()
{
/*
$items = Post::selectToArray([], ['uid' => 42]);
foreach ($items as $item) {
$status = api_format_item($item, 'xml');
self::assertStatus($status);
}
*/
}
/**
@ -3055,21 +3036,6 @@ class ApiTest extends FixtureTest
$this->markTestIncomplete();
}
/**
* Test the api_in_reply_to() function.
*
* @return void
*/
public function testApiInReplyTo()
{
$result = api_in_reply_to(['id' => 0, 'parent' => 0, 'uri' => '', 'thr-parent' => '']);
self::assertArrayHasKey('status_id', $result);
self::assertArrayHasKey('user_id', $result);
self::assertArrayHasKey('status_id_str', $result);
self::assertArrayHasKey('user_id_str', $result);
self::assertArrayHasKey('screen_name', $result);
}
/**
* Test the api_in_reply_to() function with a valid item.
*