Code Duplication    Length = 12-13 lines in 3 locations

eZ/Bundle/EzPublishRestBundle/Tests/EventListener/ResponseListenerTest.php 2 locations

@@ 139-150 (lines=12) @@
136
    /**
137
     * @return PHPUnit_Framework_MockObject_MockObject|GetResponseForControllerResultEvent
138
     */
139
    protected function getControllerResultEventMock()
140
    {
141
        if (!isset($this->eventMock)) {
142
            $this->eventMock = parent::getEventMock('Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent');
143
            $this->eventMock
144
                ->expects($this->any())
145
                ->method('getControllerResult')
146
                ->will($this->returnValue($this->eventValue));
147
        }
148
149
        return $this->eventMock;
150
    }
151
152
    /**
153
     * @return PHPUnit_Framework_MockObject_MockObject|GetResponseForExceptionEvent
@@ 155-167 (lines=13) @@
152
    /**
153
     * @return PHPUnit_Framework_MockObject_MockObject|GetResponseForExceptionEvent
154
     */
155
    protected function getExceptionEventMock()
156
    {
157
        if (!isset($this->eventMock)) {
158
            $this->eventMock = parent::getEventMock('Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent');
159
160
            $this->eventMock
161
                ->expects($this->any())
162
                ->method('getException')
163
                ->will($this->returnValue($this->eventValue));
164
        }
165
166
        return $this->eventMock;
167
    }
168
}
169

eZ/Bundle/EzPublishRestBundle/Tests/EventListener/CsrfListenerTest.php 1 location

@@ 196-208 (lines=13) @@
193
    /**
194
     * @return PHPUnit_Framework_MockObject_MockObject|GetResponseEvent
195
     */
196
    protected function getEventMock($class = null)
197
    {
198
        if (!isset($this->eventMock)) {
199
            parent::getEventMock('Symfony\Component\HttpKernel\Event\GetResponseEvent');
200
201
            $this->eventMock
202
                ->expects($this->any())
203
                ->method('getRequestType')
204
                ->will($this->returnValue($this->requestType));
205
        }
206
207
        return $this->eventMock;
208
    }
209
210
    /**
211
     * @return \Symfony\Component\HttpFoundation\Session\SessionInterface|PHPUnit_Framework_MockObject_MockObject