@@ 59-80 (lines=22) @@ | ||
56 | * |
|
57 | * @return void |
|
58 | */ |
|
59 | public function fromOAuth2EmptyBody() |
|
60 | { |
|
61 | $oauth2Response = new Response( |
|
62 | [], |
|
63 | 204, |
|
64 | ['Content-Type' => 'application/json'] |
|
65 | ); |
|
66 | ||
67 | $slimResponse = ResponseBridge::fromOAuth2($oauth2Response); |
|
68 | ||
69 | $this->assertSame(204, $slimResponse->getStatusCode()); |
|
70 | $this->assertSame( |
|
71 | [ |
|
72 | 'Content-Type' => [ |
|
73 | 'application/json', |
|
74 | ], |
|
75 | ], |
|
76 | $slimResponse->getHeaders() |
|
77 | ); |
|
78 | ||
79 | $this->assertSame('', (string)$slimResponse->getBody()); |
|
80 | } |
|
81 | ||
82 | /** |
|
83 | * Verify response can be written to when empty. |
|
@@ 90-113 (lines=24) @@ | ||
87 | * |
|
88 | * @return void |
|
89 | */ |
|
90 | public function fromOAuth2WritableEmptyBody() |
|
91 | { |
|
92 | $oauth2Response = new Response( |
|
93 | [], |
|
94 | 204, |
|
95 | ['Content-Type' => 'application/json'] |
|
96 | ); |
|
97 | ||
98 | $slimResponse = ResponseBridge::fromOAuth2($oauth2Response); |
|
99 | ||
100 | $slimResponse->getBody()->write('I was here'); |
|
101 | ||
102 | $this->assertSame(204, $slimResponse->getStatusCode()); |
|
103 | $this->assertSame( |
|
104 | [ |
|
105 | 'Content-Type' => [ |
|
106 | 'application/json', |
|
107 | ], |
|
108 | ], |
|
109 | $slimResponse->getHeaders() |
|
110 | ); |
|
111 | ||
112 | $this->assertSame('I was here', (string)$slimResponse->getBody()); |
|
113 | } |
|
114 | } |
|
115 |