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/GridViewSubscriberTest.php 2 locations

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

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
    {