Skip to content

Commit 9f5ad24

Browse files
committed
update ResponseTest
1 parent 28969dd commit 9f5ad24

File tree

1 file changed

+25
-35
lines changed

1 file changed

+25
-35
lines changed

tests/ResponseTest.php

Lines changed: 25 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,11 @@ class ResponseTest extends TestCase
2121
*/
2222
public function test_empty_response_with_code_204()
2323
{
24-
$router = $this->router();
25-
26-
$router->get('/', function () {
27-
return new EmptyResponse(204);
28-
});
29-
30-
$router->dispatch();
24+
$router = $this->router()
25+
->get('/', function () {
26+
return new EmptyResponse(204);
27+
})
28+
->dispatch();
3129

3230
$this->assertEquals(204, $this->publisherOf($router)->responseCode);
3331
}
@@ -37,13 +35,11 @@ public function test_empty_response_with_code_204()
3735
*/
3836
public function test_html_response_with_code_200()
3937
{
40-
$router = $this->router();
41-
42-
$router->get('/', function () {
43-
return new HtmlResponse('<html lang="fa"></html>', 200);
44-
});
45-
46-
$router->dispatch();
38+
$router = $this->router()
39+
->get('/', function () {
40+
return new HtmlResponse('<html lang="fa"></html>', 200);
41+
})
42+
->dispatch();
4743

4844
$this->assertEquals(200, $this->publisherOf($router)->responseCode);
4945
$this->assertEquals('<html lang="fa"></html>', $this->outputOf($router));
@@ -54,13 +50,11 @@ public function test_html_response_with_code_200()
5450
*/
5551
public function test_json_response_with_code_201()
5652
{
57-
$router = $this->router();
58-
59-
$router->get('/', function () {
60-
return new JsonResponse(['a' => 'x', 'b' => 'y'], 201);
61-
});
62-
63-
$router->dispatch();
53+
$router = $this->router()
54+
->get('/', function () {
55+
return new JsonResponse(['a' => 'x', 'b' => 'y'], 201);
56+
})
57+
->dispatch();
6458

6559
$this->assertEquals(201, $this->publisherOf($router)->responseCode);
6660
$this->assertEquals(json_encode(['a' => 'x', 'b' => 'y']), $this->outputOf($router));
@@ -71,13 +65,11 @@ public function test_json_response_with_code_201()
7165
*/
7266
public function test_text_response_with_code_203()
7367
{
74-
$router = $this->router();
75-
76-
$router->get('/', function () {
77-
return new TextResponse('Content', 203);
78-
});
79-
80-
$router->dispatch();
68+
$router = $this->router()
69+
->get('/', function () {
70+
return new TextResponse('Content', 203);
71+
})
72+
->dispatch();
8173

8274
$this->assertEquals(203, $this->publisherOf($router)->responseCode);
8375
$this->assertEquals('Content', $this->outputOf($router));
@@ -88,13 +80,11 @@ public function test_text_response_with_code_203()
8880
*/
8981
public function test_redirect_response_with_code_203()
9082
{
91-
$router = $this->router();
92-
93-
$router->get('/', function () {
94-
return new RedirectResponse('https://miladrahimi.com');
95-
});
96-
97-
$router->dispatch();
83+
$router = $this->router()
84+
->get('/', function () {
85+
return new RedirectResponse('https://miladrahimi.com');
86+
})
87+
->dispatch();
9888

9989
$this->assertEquals(302, $this->publisherOf($router)->responseCode);
10090
$this->assertEquals('', $this->outputOf($router));

0 commit comments

Comments
 (0)