@@ 80-99 (lines=20) @@ | ||
77 | /** |
|
78 | * @test |
|
79 | */ |
|
80 | public function shouldOverrideSuccessResponse() |
|
81 | { |
|
82 | $controller = new GenericExceptionResponseController($this->controllerHelper, $this->argumentBuilder, [ |
|
83 | 'inner-controller' => $this->innerController, |
|
84 | 'inner-controller-method' => "serialize", |
|
85 | 'success-response' => "Some success!", |
|
86 | 'success-response-code' => 234, |
|
87 | ]); |
|
88 | ||
89 | $this->innerController->method("serialize")->willReturn(new Response("foo", 205)); |
|
90 | ||
91 | /** @var Request $request */ |
|
92 | $request = $this->createMock(Request::class); |
|
93 | ||
94 | /** @var Response $response */ |
|
95 | $response = $controller->executeInnerControllerSafely($request); |
|
96 | ||
97 | $this->assertEquals("Some success!", $response->getContent()); |
|
98 | $this->assertEquals(234, $response->getStatusCode()); |
|
99 | } |
|
100 | ||
101 | /** |
|
102 | * @test |
|
@@ 104-122 (lines=19) @@ | ||
101 | /** |
|
102 | * @test |
|
103 | */ |
|
104 | public function shouldOverrideSuccessResponseWithDefaultResponseCode() |
|
105 | { |
|
106 | $controller = new GenericExceptionResponseController($this->controllerHelper, $this->argumentBuilder, [ |
|
107 | 'inner-controller' => $this->innerController, |
|
108 | 'inner-controller-method' => "serialize", |
|
109 | 'success-response' => "Some success!", |
|
110 | ]); |
|
111 | ||
112 | $this->innerController->method("serialize")->willReturn(new Response("foo", 205)); |
|
113 | ||
114 | /** @var Request $request */ |
|
115 | $request = $this->createMock(Request::class); |
|
116 | ||
117 | /** @var Response $response */ |
|
118 | $response = $controller->executeInnerControllerSafely($request); |
|
119 | ||
120 | $this->assertEquals("Some success!", $response->getContent()); |
|
121 | $this->assertEquals(200, $response->getStatusCode()); |
|
122 | } |
|
123 | ||
124 | /** |
|
125 | * @test |