This repository has been archived by the owner on Jan 17, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(http-server): return all headers with the same name joined by com…
…ma (#175) Co-authored-by: k911 <konradobal@gmail.com>
- Loading branch information
Showing
2 changed files
with
55 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
tests/Unit/Bridge/Symfony/HttpFoundation/ResponseProcessorTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace K911\Swoole\Tests\Unit\Bridge\Symfony\HttpFoundation; | ||
|
||
use K911\Swoole\Bridge\Symfony\HttpFoundation\ResponseProcessor; | ||
use PHPUnit\Framework\TestCase; | ||
use Prophecy\Prophecy\ObjectProphecy; | ||
use Swoole\Http\Response as SwooleResponse; | ||
use Symfony\Component\HttpFoundation\Response as HttpFoundationResponse; | ||
|
||
class ResponseProcessorTest extends TestCase | ||
{ | ||
/** | ||
* @var ResponseProcessor | ||
*/ | ||
protected $responseProcessor; | ||
|
||
/** | ||
* @var null|HttpFoundationResponse | ||
*/ | ||
protected $symfonyResponse; | ||
|
||
/** | ||
* @var null|ObjectProphecy|SwooleResponse | ||
*/ | ||
protected $swooleResponse; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->responseProcessor = new ResponseProcessor(); | ||
$this->swooleResponse = $this->prophesize(SwooleResponse::class); | ||
} | ||
|
||
public function testProcess(): void | ||
{ | ||
$this->symfonyResponse = new HttpFoundationResponse( | ||
'success', | ||
200, | ||
[ | ||
'Vary' => [ | ||
'Content-Type', | ||
'Authorization', | ||
'Origin', | ||
], | ||
] | ||
); | ||
|
||
$swooleResponse = $this->swooleResponse->reveal(); | ||
$this->responseProcessor->process($this->symfonyResponse, $swooleResponse); | ||
$this->swooleResponse->header('Vary', 'Content-Type, Authorization, Origin')->shouldBeCalled(); | ||
} | ||
} |