mirror of
https://github.com/friendica/friendica
synced 2025-04-23 23:10:10 +00:00
Add explicit status setting for PSR/ResponseInterface & add tests for OPTIONS endpoint
This commit is contained in:
parent
3092e74a3a
commit
eaad220738
6 changed files with 60 additions and 4 deletions
26
tests/src/Module/Special/OptionsTest.php
Normal file
26
tests/src/Module/Special/OptionsTest.php
Normal file
|
@ -0,0 +1,26 @@
|
|||
<?php
|
||||
|
||||
namespace Friendica\Test\src\Module\Special;
|
||||
|
||||
use Friendica\App\Router;
|
||||
use Friendica\Capabilities\ICanCreateResponses;
|
||||
use Friendica\DI;
|
||||
use Friendica\Module\Special\Options;
|
||||
use Friendica\Test\FixtureTest;
|
||||
|
||||
class OptionsTest extends FixtureTest
|
||||
{
|
||||
public function testOptions()
|
||||
{
|
||||
$response = (new Options(DI::l10n(), DI::baseUrl(), DI::args(), DI::logger(), DI::profiler(), DI::apiResponse(), ['REQUEST_METHOD' => Router::OPTIONS]))->run();
|
||||
|
||||
self::assertEmpty((string)$response->getBody());
|
||||
self::assertEquals(204, $response->getStatusCode());
|
||||
self::assertEquals('No Content', $response->getReasonPhrase());
|
||||
self::assertEquals([
|
||||
'Allow' => [implode(',', Router::ALLOWED_METHODS)],
|
||||
ICanCreateResponses::X_HEADER => ['html'],
|
||||
], $response->getHeaders());
|
||||
self::assertEquals(implode(',', Router::ALLOWED_METHODS), $response->getHeaderLine('Allow'));
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue