@@ 38-49 (lines=12) @@ | ||
35 | $listener->onKernelView($event->reveal()); |
|
36 | } |
|
37 | ||
38 | public function testOnKernelViewWithNullControllerResult() |
|
39 | { |
|
40 | $event = $this->prophesizeEvent(); |
|
41 | $request = $this->prophesizeRequest(); |
|
42 | $event->getRequest()->shouldBeCalledTimes(1)->willReturn($request->reveal()); |
|
43 | ||
44 | $event->getControllerResult()->shouldBeCalledTimes(1)->willReturn(null); |
|
45 | $event->setResponse(new JsonResponse(null, 204))->shouldBeCalledTimes(1); |
|
46 | ||
47 | $listener = new AutoJsonResponseListener(); |
|
48 | $listener->onKernelView($event->reveal()); |
|
49 | } |
|
50 | ||
51 | public function testOnKernelViewWithResponseControllerResult() |
|
52 | { |
|
@@ 98-110 (lines=13) @@ | ||
95 | /** |
|
96 | * @expectedException BadMethodCallException |
|
97 | */ |
|
98 | public function testOnKernelViewWithObjectControllerResultButNoSerializer() |
|
99 | { |
|
100 | $event = $this->prophesizeEvent(); |
|
101 | $request = $this->prophesizeRequest(); |
|
102 | $event->getRequest()->shouldBeCalledTimes(1)->willReturn($request->reveal()); |
|
103 | ||
104 | $object = new \stdClass(); |
|
105 | $event->getControllerResult()->shouldBeCalledTimes(1)->willReturn($object); |
|
106 | $request->isMethod('POST')->shouldBeCalledTimes(1)->willReturn(false); |
|
107 | ||
108 | $listener = new AutoJsonResponseListener(); |
|
109 | $listener->onKernelView($event->reveal()); |
|
110 | } |
|
111 | ||
112 | public function testOnKernelViewWithObjectControllerResult() |
|
113 | { |