Possibly fixing tests

This commit is contained in:
Michael 2021-11-21 10:20:03 +00:00
parent 0e5f876680
commit 8abf6c9dd0

View file

@ -22,8 +22,10 @@ class ApiResponseTest extends MockedTest
$l10n = \Mockery::mock(L10n::class);
$args = \Mockery::mock(Arguments::class);
$args->shouldReceive('getQueryString')->andReturn('');
$baseUrl = \Mockery::mock(BaseURL::class);
$twitterUser = \Mockery::mock(Friendica\Factory\Api\Twitter\User::class);
$response = new ApiResponseDouble($l10n, $args, new NullLogger());
$response = new ApiResponseDouble($l10n, $args, new NullLogger(), $baseUrl, $twitterUser);
$response->error(200, 'OK', 'error_message', 'json');
self::assertEquals('{"error":"error_message","code":"200 OK","request":""}', ApiResponseDouble::getOutput());
@ -34,8 +36,10 @@ class ApiResponseTest extends MockedTest
$l10n = \Mockery::mock(L10n::class);
$args = \Mockery::mock(Arguments::class);
$args->shouldReceive('getQueryString')->andReturn('');
$baseUrl = \Mockery::mock(BaseURL::class);
$twitterUser = \Mockery::mock(Friendica\Factory\Api\Twitter\User::class);
$response = new ApiResponseDouble($l10n, $args, new NullLogger());
$response = new ApiResponseDouble($l10n, $args, new NullLogger(), $baseUrl, $twitterUser);
$response->error(200, 'OK', 'error_message', 'xml');
self::assertEquals('<?xml version="1.0"?>' . "\n" .
@ -54,8 +58,10 @@ class ApiResponseTest extends MockedTest
$l10n = \Mockery::mock(L10n::class);
$args = \Mockery::mock(Arguments::class);
$args->shouldReceive('getQueryString')->andReturn('');
$baseUrl = \Mockery::mock(BaseURL::class);
$twitterUser = \Mockery::mock(Friendica\Factory\Api\Twitter\User::class);
$response = new ApiResponseDouble($l10n, $args, new NullLogger());
$response = new ApiResponseDouble($l10n, $args, new NullLogger(), $baseUrl, $twitterUser);
$response->error(200, 'OK', 'error_message', 'rss');
self::assertEquals(
@ -75,8 +81,10 @@ class ApiResponseTest extends MockedTest
$l10n = \Mockery::mock(L10n::class);
$args = \Mockery::mock(Arguments::class);
$args->shouldReceive('getQueryString')->andReturn('');
$baseUrl = \Mockery::mock(BaseURL::class);
$twitterUser = \Mockery::mock(Friendica\Factory\Api\Twitter\User::class);
$response = new ApiResponseDouble($l10n, $args, new NullLogger());
$response = new ApiResponseDouble($l10n, $args, new NullLogger(), $baseUrl, $twitterUser);
$response->error(200, 'OK', 'error_message', 'atom');
self::assertEquals(
@ -99,8 +107,10 @@ class ApiResponseTest extends MockedTest
});
$args = \Mockery::mock(Arguments::class);
$args->shouldReceive('getQueryString')->andReturn('');
$baseUrl = \Mockery::mock(BaseURL::class);
$twitterUser = \Mockery::mock(Friendica\Factory\Api\Twitter\User::class);
$response = new ApiResponseDouble($l10n, $args, new NullLogger());
$response = new ApiResponseDouble($l10n, $args, new NullLogger(), $baseUrl, $twitterUser);
$response->unsupported();
self::assertEquals('{"error":"API endpoint %s %s is not implemented","error_description":"The API endpoint is currently not implemented but might be in the future."}', ApiResponseDouble::getOutput());