Move Api\Help
This commit is contained in:
parent
9482ef3c34
commit
0757c00d52
|
@ -2567,30 +2567,6 @@ class ApiTest extends FixtureTest
|
||||||
// self::assertXml($result, 'hash');
|
// self::assertXml($result, 'hash');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the api_help_test() function.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testApiHelpTest()
|
|
||||||
{
|
|
||||||
// @todo How to test the new API?
|
|
||||||
// $result = \Friendica\Module\Api\Friendica\Help\Test::rawcontent(['extension' => 'json']);
|
|
||||||
// self::assertEquals(['ok' => 'ok'], $result);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Test the api_help_test() function with an XML result.
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function testApiHelpTestWithXml()
|
|
||||||
{
|
|
||||||
// @todo How to test the new API?
|
|
||||||
// $result = api_help_test('xml');
|
|
||||||
// self::assertXml($result, 'ok');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test the api_lists_list() function.
|
* Test the api_lists_list() function.
|
||||||
*
|
*
|
||||||
|
|
|
@ -33,6 +33,21 @@ use Friendica\Test\Util\AuthenticationDouble;
|
||||||
|
|
||||||
class ApiTest extends FixtureTest
|
class ApiTest extends FixtureTest
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Assert that the string is XML and contain the root element.
|
||||||
|
*
|
||||||
|
* @param string $result XML string
|
||||||
|
* @param string $root_element Root element name
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function assertXml(string $result = '', string $root_element = '')
|
||||||
|
{
|
||||||
|
self::assertStringStartsWith('<?xml version="1.0"?>', $result);
|
||||||
|
self::assertStringContainsString('<' . $root_element, $result);
|
||||||
|
// We could probably do more checks here.
|
||||||
|
}
|
||||||
|
|
||||||
protected function setUp(): void
|
protected function setUp(): void
|
||||||
{
|
{
|
||||||
parent::setUp(); // TODO: Change the autogenerated stub
|
parent::setUp(); // TODO: Change the autogenerated stub
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Friendica\Test\src\Module\Api\GnuSocial\Help;
|
||||||
|
|
||||||
|
use Friendica\Module\Api\GNUSocial\Help\Test;
|
||||||
|
use Friendica\Test\src\Module\Api\ApiTest;
|
||||||
|
use Friendica\Test\Util\ApiResponseDouble;
|
||||||
|
|
||||||
|
class TestTest extends ApiTest
|
||||||
|
{
|
||||||
|
public function testJson()
|
||||||
|
{
|
||||||
|
Test::rawContent(['extension' => 'json']);
|
||||||
|
|
||||||
|
self::assertEquals('"ok"', ApiResponseDouble::getOutput());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testXml()
|
||||||
|
{
|
||||||
|
Test::rawContent(['extension' => 'xml']);
|
||||||
|
|
||||||
|
self::assertxml(ApiResponseDouble::getOutput(), 'ok');
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user