Code Duplication    Length = 15-15 lines in 2 locations

Tests/EventListener/AutoJsonResponseListenerTest.php 2 locations

@@ 63-77 (lines=15) @@
60
        $listener->onKernelView($event->reveal());
61
    }
62
63
    public function testOnKernelViewWithNonObjectControllerResult()
64
    {
65
        $event = $this->prophesizeEvent();
66
        $request = $this->prophesizeRequest();
67
        $event->getRequest()->shouldBeCalledTimes(1)->willReturn($request->reveal());
68
69
        $nonObject = ['foo' => 'bar'];
70
        $event->getControllerResult()->shouldBeCalledTimes(1)->willReturn($nonObject);
71
        $request->isMethod('POST')->shouldBeCalledTimes(1)->willReturn(false);
72
73
        $event->setResponse(new JsonResponse($nonObject))->shouldBeCalledTimes(1);
74
75
        $listener = new AutoJsonResponseListener();
76
        $listener->onKernelView($event->reveal());
77
    }
78
79
    public function testOnKernelViewWithPostRequestAndNonObjectControllerResult()
80
    {
@@ 79-93 (lines=15) @@
76
        $listener->onKernelView($event->reveal());
77
    }
78
79
    public function testOnKernelViewWithPostRequestAndNonObjectControllerResult()
80
    {
81
        $event = $this->prophesizeEvent();
82
        $request = $this->prophesizeRequest();
83
        $event->getRequest()->shouldBeCalledTimes(1)->willReturn($request->reveal());
84
85
        $nonObject = 'hello world';
86
        $event->getControllerResult()->shouldBeCalledTimes(1)->willReturn($nonObject);
87
        $request->isMethod('POST')->shouldBeCalledTimes(1)->willReturn(true);
88
89
        $event->setResponse(new JsonResponse($nonObject, 201))->shouldBeCalledTimes(1);
90
91
        $listener = new AutoJsonResponseListener();
92
        $listener->onKernelView($event->reveal());
93
    }
94
95
    /**
96
     * @expectedException BadMethodCallException