Code Duplication    Length = 50-50 lines in 3 locations

eZ/Publish/Core/Repository/Tests/Service/Mock/PermissionTest.php 3 locations

@@ 244-293 (lines=50) @@
241
    /**
242
     * @return array
243
     */
244
    public function providerForTestHasAccessReturnsPermissionSets()
245
    {
246
        return [
247
            [
248
                [
249
                    31 => $this->createRole(
250
                        [
251
                            ['dummy-module', 'dummy-function', 'test-limitation'],
252
                        ],
253
                        31
254
                    ),
255
                ],
256
                [
257
                    new RoleAssignment(
258
                        [
259
                            'roleId' => 31,
260
                        ]
261
                    ),
262
                ],
263
            ],
264
            [
265
                [
266
                    31 => $this->createRole(
267
                        [
268
                            ['dummy-module', 'dummy-function', 'test-limitation'],
269
                        ],
270
                        31
271
                    ),
272
                    32 => $this->createRole(
273
                        [
274
                            ['dummy-module', 'dummy-function', 'test-limitation2'],
275
                        ],
276
                        32
277
                    ),
278
                ],
279
                [
280
                    new RoleAssignment(
281
                        [
282
                            'roleId' => 31,
283
                        ]
284
                    ),
285
                    new RoleAssignment(
286
                        [
287
                            'roleId' => 32,
288
                        ]
289
                    ),
290
                ],
291
            ],
292
        ];
293
    }
294
295
    /**
296
     * Test for the hasAccess() method.
@@ 358-407 (lines=50) @@
355
    /**
356
     * @return array
357
     */
358
    public function providerForTestHasAccessReturnsLimitationNotFoundException()
359
    {
360
        return [
361
            [
362
                [
363
                    31 => $this->createRole(
364
                        [
365
                            ['dummy-module', 'dummy-function', 'notfound'],
366
                        ],
367
                        31
368
                    ),
369
                ],
370
                [
371
                    new RoleAssignment(
372
                        [
373
                            'roleId' => 31,
374
                        ]
375
                    ),
376
                ],
377
            ],
378
            [
379
                [
380
                    31 => $this->createRole(
381
                        [
382
                            ['dummy-module', 'dummy-function', 'test-limitation'],
383
                        ],
384
                        31
385
                    ),
386
                    32 => $this->createRole(
387
                        [
388
                            ['dummy-module', 'dummy-function', 'notfound'],
389
                        ],
390
                        32
391
                    ),
392
                ],
393
                [
394
                    new RoleAssignment(
395
                        [
396
                            'roleId' => 31,
397
                        ]
398
                    ),
399
                    new RoleAssignment(
400
                        [
401
                            'roleId' => 32,
402
                        ]
403
                    ),
404
                ],
405
            ],
406
        ];
407
    }
408
409
    /**
410
     * Test for the hasAccess() method.
@@ 472-521 (lines=50) @@
469
    /**
470
     * @return array
471
     */
472
    public function providerForTestHasAccessReturnsInvalidArgumentValueException()
473
    {
474
        return [
475
            [
476
                [
477
                    31 => $this->createRole(
478
                        [
479
                            ['test-module', 'test-function', '*'],
480
                        ],
481
                        31
482
                    ),
483
                ],
484
                [
485
                    new RoleAssignment(
486
                        [
487
                            'roleId' => 31,
488
                        ]
489
                    ),
490
                ],
491
            ],
492
            [
493
                [
494
                    31 => $this->createRole(
495
                        [
496
                            ['other-module', 'test-function', '*'],
497
                        ],
498
                        31
499
                    ),
500
                    32 => $this->createRole(
501
                        [
502
                            ['test-module', 'other-function', '*'],
503
                        ],
504
                        32
505
                    ),
506
                ],
507
                [
508
                    new RoleAssignment(
509
                        [
510
                            'roleId' => 31,
511
                        ]
512
                    ),
513
                    new RoleAssignment(
514
                        [
515
                            'roleId' => 32,
516
                        ]
517
                    ),
518
                ],
519
            ],
520
        ];
521
    }
522
523
    /**
524
     * Test for the hasAccess() method.