Possibly fixing tests
This commit is contained in:
parent
0e5f876680
commit
8abf6c9dd0
1 changed files with 15 additions and 5 deletions
|
@ -22,8 +22,10 @@ class ApiResponseTest extends MockedTest
|
||||||
$l10n = \Mockery::mock(L10n::class);
|
$l10n = \Mockery::mock(L10n::class);
|
||||||
$args = \Mockery::mock(Arguments::class);
|
$args = \Mockery::mock(Arguments::class);
|
||||||
$args->shouldReceive('getQueryString')->andReturn('');
|
$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');
|
$response->error(200, 'OK', 'error_message', 'json');
|
||||||
|
|
||||||
self::assertEquals('{"error":"error_message","code":"200 OK","request":""}', ApiResponseDouble::getOutput());
|
self::assertEquals('{"error":"error_message","code":"200 OK","request":""}', ApiResponseDouble::getOutput());
|
||||||
|
@ -34,8 +36,10 @@ class ApiResponseTest extends MockedTest
|
||||||
$l10n = \Mockery::mock(L10n::class);
|
$l10n = \Mockery::mock(L10n::class);
|
||||||
$args = \Mockery::mock(Arguments::class);
|
$args = \Mockery::mock(Arguments::class);
|
||||||
$args->shouldReceive('getQueryString')->andReturn('');
|
$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');
|
$response->error(200, 'OK', 'error_message', 'xml');
|
||||||
|
|
||||||
self::assertEquals('<?xml version="1.0"?>' . "\n" .
|
self::assertEquals('<?xml version="1.0"?>' . "\n" .
|
||||||
|
@ -54,8 +58,10 @@ class ApiResponseTest extends MockedTest
|
||||||
$l10n = \Mockery::mock(L10n::class);
|
$l10n = \Mockery::mock(L10n::class);
|
||||||
$args = \Mockery::mock(Arguments::class);
|
$args = \Mockery::mock(Arguments::class);
|
||||||
$args->shouldReceive('getQueryString')->andReturn('');
|
$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');
|
$response->error(200, 'OK', 'error_message', 'rss');
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
|
@ -75,8 +81,10 @@ class ApiResponseTest extends MockedTest
|
||||||
$l10n = \Mockery::mock(L10n::class);
|
$l10n = \Mockery::mock(L10n::class);
|
||||||
$args = \Mockery::mock(Arguments::class);
|
$args = \Mockery::mock(Arguments::class);
|
||||||
$args->shouldReceive('getQueryString')->andReturn('');
|
$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');
|
$response->error(200, 'OK', 'error_message', 'atom');
|
||||||
|
|
||||||
self::assertEquals(
|
self::assertEquals(
|
||||||
|
@ -99,8 +107,10 @@ class ApiResponseTest extends MockedTest
|
||||||
});
|
});
|
||||||
$args = \Mockery::mock(Arguments::class);
|
$args = \Mockery::mock(Arguments::class);
|
||||||
$args->shouldReceive('getQueryString')->andReturn('');
|
$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();
|
$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());
|
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());
|
||||||
|
|
Loading…
Reference in a new issue