Code Duplication    Length = 50-50 lines in 3 locations

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

@@ 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.
@@ 243-292 (lines=50) @@
240
    /**
241
     * @return array
242
     */
243
    public function providerForTestHasAccessReturnsPermissionSets()
244
    {
245
        return [
246
            [
247
                [
248
                    31 => $this->createRole(
249
                        [
250
                            ['dummy-module', 'dummy-function', 'test-limitation'],
251
                        ],
252
                        31
253
                    ),
254
                ],
255
                [
256
                    new RoleAssignment(
257
                        [
258
                            'roleId' => 31,
259
                        ]
260
                    ),
261
                ],
262
            ],
263
            [
264
                [
265
                    31 => $this->createRole(
266
                        [
267
                            ['dummy-module', 'dummy-function', 'test-limitation'],
268
                        ],
269
                        31
270
                    ),
271
                    32 => $this->createRole(
272
                        [
273
                            ['dummy-module', 'dummy-function', 'test-limitation2'],
274
                        ],
275
                        32
276
                    ),
277
                ],
278
                [
279
                    new RoleAssignment(
280
                        [
281
                            'roleId' => 31,
282
                        ]
283
                    ),
284
                    new RoleAssignment(
285
                        [
286
                            'roleId' => 32,
287
                        ]
288
                    ),
289
                ],
290
            ],
291
        ];
292
    }
293
294
    /**
295
     * Test for the hasAccess() method.
@@ 357-406 (lines=50) @@
354
    /**
355
     * @return array
356
     */
357
    public function providerForTestHasAccessReturnsLimitationNotFoundException()
358
    {
359
        return [
360
            [
361
                [
362
                    31 => $this->createRole(
363
                        [
364
                            ['dummy-module', 'dummy-function', 'notfound'],
365
                        ],
366
                        31
367
                    ),
368
                ],
369
                [
370
                    new RoleAssignment(
371
                        [
372
                            'roleId' => 31,
373
                        ]
374
                    ),
375
                ],
376
            ],
377
            [
378
                [
379
                    31 => $this->createRole(
380
                        [
381
                            ['dummy-module', 'dummy-function', 'test-limitation'],
382
                        ],
383
                        31
384
                    ),
385
                    32 => $this->createRole(
386
                        [
387
                            ['dummy-module', 'dummy-function', 'notfound'],
388
                        ],
389
                        32
390
                    ),
391
                ],
392
                [
393
                    new RoleAssignment(
394
                        [
395
                            'roleId' => 31,
396
                        ]
397
                    ),
398
                    new RoleAssignment(
399
                        [
400
                            'roleId' => 32,
401
                        ]
402
                    ),
403
                ],
404
            ],
405
        ];
406
    }
407
408
    /**
409
     * Test for the hasAccess() method.