Code Duplication    Length = 21-21 lines in 11 locations

src/Component/Grid/Tests/DataSource/Doctrine/MongoDB/ExpressionBuilderTest.php 11 locations

@@ 126-146 (lines=21) @@
123
        $this->assertSame($expr, $this->expressionBuilder->desc($x));
124
    }
125
126
    public function testEq()
127
    {
128
        $this->queryBuilder
129
            ->expects($this->once())
130
            ->method('expr')
131
            ->will($this->returnValue($expr = $this->createExprMock()));
132
133
        $expr
134
            ->expects($this->once())
135
            ->method('field')
136
            ->with($this->identicalTo($x = 'property'))
137
            ->will($this->returnSelf());
138
139
        $expr
140
            ->expects($this->once())
141
            ->method('equals')
142
            ->with($this->identicalTo($y = 'value'))
143
            ->will($this->returnSelf());
144
145
        $this->assertSame($expr, $this->expressionBuilder->eq($x, $y));
146
    }
147
148
    public function testNeq()
149
    {
@@ 148-168 (lines=21) @@
145
        $this->assertSame($expr, $this->expressionBuilder->eq($x, $y));
146
    }
147
148
    public function testNeq()
149
    {
150
        $this->queryBuilder
151
            ->expects($this->once())
152
            ->method('expr')
153
            ->will($this->returnValue($expr = $this->createExprMock()));
154
155
        $expr
156
            ->expects($this->once())
157
            ->method('field')
158
            ->with($this->identicalTo($x = 'property'))
159
            ->will($this->returnSelf());
160
161
        $expr
162
            ->expects($this->once())
163
            ->method('notEqual')
164
            ->with($this->identicalTo($y = 'value'))
165
            ->will($this->returnSelf());
166
167
        $this->assertSame($expr, $this->expressionBuilder->neq($x, $y));
168
    }
169
170
    public function testLt()
171
    {
@@ 170-190 (lines=21) @@
167
        $this->assertSame($expr, $this->expressionBuilder->neq($x, $y));
168
    }
169
170
    public function testLt()
171
    {
172
        $this->queryBuilder
173
            ->expects($this->once())
174
            ->method('expr')
175
            ->will($this->returnValue($expr = $this->createExprMock()));
176
177
        $expr
178
            ->expects($this->once())
179
            ->method('field')
180
            ->with($this->identicalTo($x = 'property'))
181
            ->will($this->returnSelf());
182
183
        $expr
184
            ->expects($this->once())
185
            ->method('lt')
186
            ->with($this->identicalTo($y = 'value'))
187
            ->will($this->returnSelf());
188
189
        $this->assertSame($expr, $this->expressionBuilder->lt($x, $y));
190
    }
191
192
    public function testLte()
193
    {
@@ 192-212 (lines=21) @@
189
        $this->assertSame($expr, $this->expressionBuilder->lt($x, $y));
190
    }
191
192
    public function testLte()
193
    {
194
        $this->queryBuilder
195
            ->expects($this->once())
196
            ->method('expr')
197
            ->will($this->returnValue($expr = $this->createExprMock()));
198
199
        $expr
200
            ->expects($this->once())
201
            ->method('field')
202
            ->with($this->identicalTo($x = 'property'))
203
            ->will($this->returnSelf());
204
205
        $expr
206
            ->expects($this->once())
207
            ->method('lte')
208
            ->with($this->identicalTo($y = 'value'))
209
            ->will($this->returnSelf());
210
211
        $this->assertSame($expr, $this->expressionBuilder->lte($x, $y));
212
    }
213
214
    public function testGt()
215
    {
@@ 214-234 (lines=21) @@
211
        $this->assertSame($expr, $this->expressionBuilder->lte($x, $y));
212
    }
213
214
    public function testGt()
215
    {
216
        $this->queryBuilder
217
            ->expects($this->once())
218
            ->method('expr')
219
            ->will($this->returnValue($expr = $this->createExprMock()));
220
221
        $expr
222
            ->expects($this->once())
223
            ->method('field')
224
            ->with($this->identicalTo($x = 'property'))
225
            ->will($this->returnSelf());
226
227
        $expr
228
            ->expects($this->once())
229
            ->method('gt')
230
            ->with($this->identicalTo($y = 'value'))
231
            ->will($this->returnSelf());
232
233
        $this->assertSame($expr, $this->expressionBuilder->gt($x, $y));
234
    }
235
236
    public function testGte()
237
    {
@@ 236-256 (lines=21) @@
233
        $this->assertSame($expr, $this->expressionBuilder->gt($x, $y));
234
    }
235
236
    public function testGte()
237
    {
238
        $this->queryBuilder
239
            ->expects($this->once())
240
            ->method('expr')
241
            ->will($this->returnValue($expr = $this->createExprMock()));
242
243
        $expr
244
            ->expects($this->once())
245
            ->method('field')
246
            ->with($this->identicalTo($x = 'property'))
247
            ->will($this->returnSelf());
248
249
        $expr
250
            ->expects($this->once())
251
            ->method('gte')
252
            ->with($this->identicalTo($y = 'value'))
253
            ->will($this->returnSelf());
254
255
        $this->assertSame($expr, $this->expressionBuilder->gte($x, $y));
256
    }
257
258
    public function testExists()
259
    {
@@ 258-278 (lines=21) @@
255
        $this->assertSame($expr, $this->expressionBuilder->gte($x, $y));
256
    }
257
258
    public function testExists()
259
    {
260
        $this->queryBuilder
261
            ->expects($this->once())
262
            ->method('expr')
263
            ->will($this->returnValue($expr = $this->createExprMock()));
264
265
        $expr
266
            ->expects($this->once())
267
            ->method('field')
268
            ->with($this->identicalTo($x = 'property'))
269
            ->will($this->returnSelf());
270
271
        $expr
272
            ->expects($this->once())
273
            ->method('exists')
274
            ->with($this->identicalTo(true))
275
            ->will($this->returnSelf());
276
277
        $this->assertSame($expr, $this->expressionBuilder->exists($x));
278
    }
279
280
    public function testIn()
281
    {
@@ 280-300 (lines=21) @@
277
        $this->assertSame($expr, $this->expressionBuilder->exists($x));
278
    }
279
280
    public function testIn()
281
    {
282
        $this->queryBuilder
283
            ->expects($this->once())
284
            ->method('expr')
285
            ->will($this->returnValue($expr = $this->createExprMock()));
286
287
        $expr
288
            ->expects($this->once())
289
            ->method('field')
290
            ->with($this->identicalTo($x = 'property'))
291
            ->will($this->returnSelf());
292
293
        $expr
294
            ->expects($this->once())
295
            ->method('in')
296
            ->with($this->identicalTo($y = ['value']))
297
            ->will($this->returnSelf());
298
299
        $this->assertSame($expr, $this->expressionBuilder->in($x, $y));
300
    }
301
302
    public function testNotIn()
303
    {
@@ 302-322 (lines=21) @@
299
        $this->assertSame($expr, $this->expressionBuilder->in($x, $y));
300
    }
301
302
    public function testNotIn()
303
    {
304
        $this->queryBuilder
305
            ->expects($this->once())
306
            ->method('expr')
307
            ->will($this->returnValue($expr = $this->createExprMock()));
308
309
        $expr
310
            ->expects($this->once())
311
            ->method('field')
312
            ->with($this->identicalTo($x = 'property'))
313
            ->will($this->returnSelf());
314
315
        $expr
316
            ->expects($this->once())
317
            ->method('notIn')
318
            ->with($this->identicalTo($y = ['value']))
319
            ->will($this->returnSelf());
320
321
        $this->assertSame($expr, $this->expressionBuilder->notIn($x, $y));
322
    }
323
324
    public function testIsNull()
325
    {
@@ 324-344 (lines=21) @@
321
        $this->assertSame($expr, $this->expressionBuilder->notIn($x, $y));
322
    }
323
324
    public function testIsNull()
325
    {
326
        $this->queryBuilder
327
            ->expects($this->once())
328
            ->method('expr')
329
            ->will($this->returnValue($expr = $this->createExprMock()));
330
331
        $expr
332
            ->expects($this->once())
333
            ->method('field')
334
            ->with($this->identicalTo($x = 'property'))
335
            ->will($this->returnSelf());
336
337
        $expr
338
            ->expects($this->once())
339
            ->method('equals')
340
            ->with($this->identicalTo(null))
341
            ->will($this->returnSelf());
342
343
        $this->assertSame($expr, $this->expressionBuilder->isNull($x));
344
    }
345
346
    public function testIsNotNull()
347
    {
@@ 346-366 (lines=21) @@
343
        $this->assertSame($expr, $this->expressionBuilder->isNull($x));
344
    }
345
346
    public function testIsNotNull()
347
    {
348
        $this->queryBuilder
349
            ->expects($this->once())
350
            ->method('expr')
351
            ->will($this->returnValue($expr = $this->createExprMock()));
352
353
        $expr
354
            ->expects($this->once())
355
            ->method('field')
356
            ->with($this->identicalTo($x = 'property'))
357
            ->will($this->returnSelf());
358
359
        $expr
360
            ->expects($this->once())
361
            ->method('notEqual')
362
            ->with($this->identicalTo(null))
363
            ->will($this->returnSelf());
364
365
        $this->assertSame($expr, $this->expressionBuilder->isNotNull($x));
366
    }
367
368
    /**
369
     * @dataProvider likeProvider