Code Duplication    Length = 24-24 lines in 6 locations

src/Bundle/ResourceBundle/Tests/Rest/View/EventSubscriber/FormViewSubscriberTest.php 2 locations

@@ 87-110 (lines=24) @@
84
        $this->subscriber->onApi($event);
85
    }
86
87
    public function testApiWithoutForms()
88
    {
89
        $this->parameterResolver
90
            ->expects($this->once())
91
            ->method('resolveApi')
92
            ->will($this->returnValue(true));
93
94
        $event = $this->createViewEventMock();
95
        $event
96
            ->expects($this->once())
97
            ->method('getView')
98
            ->will($this->returnValue($view = $this->createViewMock()));
99
100
        $view
101
            ->expects($this->once())
102
            ->method('getData')
103
            ->will($this->returnValue('data'));
104
105
        $view
106
            ->expects($this->never())
107
            ->method('setData');
108
109
        $this->subscriber->onApi($event);
110
    }
111
112
    public function testApiWithForms()
113
    {
@@ 189-212 (lines=24) @@
186
        $this->subscriber->onView($event);
187
    }
188
189
    public function testViewWithoutForm()
190
    {
191
        $this->parameterResolver
192
            ->expects($this->once())
193
            ->method('resolveApi')
194
            ->will($this->returnValue(false));
195
196
        $event = $this->createViewEventMock();
197
        $event
198
            ->expects($this->once())
199
            ->method('getView')
200
            ->will($this->returnValue($view = $this->createViewMock()));
201
202
        $view
203
            ->expects($this->once())
204
            ->method('getData')
205
            ->will($this->returnValue('data'));
206
207
        $view
208
            ->expects($this->never())
209
            ->method('setData');
210
211
        $this->subscriber->onView($event);
212
    }
213
214
    public function testViewWithForm()
215
    {

src/Bundle/ResourceBundle/Tests/Rest/View/EventSubscriber/PagerfantaViewSubscriberTest.php 2 locations

@@ 101-124 (lines=24) @@
98
        $this->subscriber->onApi($event);
99
    }
100
101
    public function testApiWithoutPagerfanta()
102
    {
103
        $this->parameterResolver
104
            ->expects($this->once())
105
            ->method('resolveApi')
106
            ->will($this->returnValue(true));
107
108
        $event = $this->createViewEventMock();
109
        $event
110
            ->expects($this->once())
111
            ->method('getView')
112
            ->will($this->returnValue($view = $this->createViewMock()));
113
114
        $view
115
            ->expects($this->once())
116
            ->method('getData')
117
            ->will($this->returnValue('data'));
118
119
        $view
120
            ->expects($this->never())
121
            ->method('setData');
122
123
        $this->subscriber->onApi($event);
124
    }
125
126
    public function testApiWithPagerfanta()
127
    {
@@ 269-292 (lines=24) @@
266
        $this->subscriber->onView($event);
267
    }
268
269
    public function testViewWithoutPagerfanta()
270
    {
271
        $this->parameterResolver
272
            ->expects($this->once())
273
            ->method('resolveApi')
274
            ->will($this->returnValue(false));
275
276
        $event = $this->createViewEventMock();
277
        $event
278
            ->expects($this->once())
279
            ->method('getView')
280
            ->will($this->returnValue($view = $this->createViewMock()));
281
282
        $view
283
            ->expects($this->once())
284
            ->method('getData')
285
            ->will($this->returnValue('data'));
286
287
        $view
288
            ->expects($this->never())
289
            ->method('setTemplateVar');
290
291
        $this->subscriber->onView($event);
292
    }
293
294
    public function testViewWithPagerfanta()
295
    {

src/Bundle/ResourceBundle/Tests/Rest/View/EventSubscriber/GridViewSubscriberTest.php 2 locations

@@ 96-119 (lines=24) @@
93
        $this->subscriber->onApi($event);
94
    }
95
96
    public function testApiWithoutGrid()
97
    {
98
        $this->parameterResolver
99
            ->expects($this->once())
100
            ->method('resolveApi')
101
            ->will($this->returnValue(true));
102
103
        $event = $this->createViewEventMock();
104
        $event
105
            ->expects($this->once())
106
            ->method('getView')
107
            ->will($this->returnValue($view = $this->createViewMock()));
108
109
        $view
110
            ->expects($this->once())
111
            ->method('getData')
112
            ->will($this->returnValue('data'));
113
114
        $view
115
            ->expects($this->never())
116
            ->method('setData');
117
118
        $this->subscriber->onApi($event);
119
    }
120
121
    public function testApiWithGrid()
122
    {
@@ 167-190 (lines=24) @@
164
        $this->subscriber->onView($event);
165
    }
166
167
    public function testViewWithoutGrid()
168
    {
169
        $this->parameterResolver
170
            ->expects($this->once())
171
            ->method('resolveApi')
172
            ->will($this->returnValue(false));
173
174
        $event = $this->createViewEventMock();
175
        $event
176
            ->expects($this->once())
177
            ->method('getView')
178
            ->will($this->returnValue($view = $this->createViewMock()));
179
180
        $view
181
            ->expects($this->once())
182
            ->method('getData')
183
            ->will($this->returnValue('data'));
184
185
        $view
186
            ->expects($this->never())
187
            ->method('setData');
188
189
        $this->subscriber->onView($event);
190
    }
191
192
    public function testViewWithoutBatchForm()
193
    {