Code Duplication    Length = 38-50 lines in 3 locations

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

@@ 234-283 (lines=50) @@
231
    /**
232
     * @return array
233
     */
234
    public function providerForTestHasAccessReturnsPermissionSets()
235
    {
236
        return array(
237
            array(
238
                array(
239
                    31 => $this->createRole(
240
                        array(
241
                            array('test-module', 'test-function', 'test-limitation'),
242
                        ),
243
                        31
244
                    ),
245
                ),
246
                array(
247
                    new RoleAssignment(
248
                        array(
249
                            'roleId' => 31,
250
                        )
251
                    ),
252
                ),
253
            ),
254
            array(
255
                array(
256
                    31 => $this->createRole(
257
                        array(
258
                            array('test-module', 'test-function', 'test-limitation'),
259
                        ),
260
                        31
261
                    ),
262
                    32 => $this->createRole(
263
                        array(
264
                            array('test-module', 'test-function', 'test-limitation2'),
265
                        ),
266
                        32
267
                    ),
268
                ),
269
                array(
270
                    new RoleAssignment(
271
                        array(
272
                            'roleId' => 31,
273
                        )
274
                    ),
275
                    new RoleAssignment(
276
                        array(
277
                            'roleId' => 32,
278
                        )
279
                    ),
280
                ),
281
            ),
282
        );
283
    }
284
285
    /**
286
     * Test for the hasAccess() method.
@@ 348-397 (lines=50) @@
345
    /**
346
     * @return array
347
     */
348
    public function providerForTestHasAccessReturnsException()
349
    {
350
        return array(
351
            array(
352
                array(
353
                    31 => $this->createRole(
354
                        array(
355
                            array('test-module', 'test-function', 'notfound'),
356
                        ),
357
                        31
358
                    ),
359
                ),
360
                array(
361
                    new RoleAssignment(
362
                        array(
363
                            'roleId' => 31,
364
                        )
365
                    ),
366
                ),
367
            ),
368
            array(
369
                array(
370
                    31 => $this->createRole(
371
                        array(
372
                            array('test-module', 'test-function', 'test-limitation'),
373
                        ),
374
                        31
375
                    ),
376
                    32 => $this->createRole(
377
                        array(
378
                            array('test-module', 'test-function', 'notfound'),
379
                        ),
380
                        32
381
                    ),
382
                ),
383
                array(
384
                    new RoleAssignment(
385
                        array(
386
                            'roleId' => 31,
387
                        )
388
                    ),
389
                    new RoleAssignment(
390
                        array(
391
                            'roleId' => 32,
392
                        )
393
                    ),
394
                ),
395
            ),
396
        );
397
    }
398
399
    /**
400
     * Test for the hasAccess() method.
@@ 459-496 (lines=38) @@
456
        $permissionServiceMock->hasAccess('test-module', 'test-function');
457
    }
458
459
    public function providerForTestHasAccessReturnsPermissionSetsWithRoleLimitation()
460
    {
461
        return array(
462
            array(
463
                array(
464
                    32 => $this->createRole(
465
                        array(
466
                            array('test-module', 'test-function', 'test-limitation'),
467
                        ),
468
                        32
469
                    ),
470
                ),
471
                array(
472
                    new RoleAssignment(
473
                        array(
474
                            'roleId' => 32,
475
                            'limitationIdentifier' => 'test-role-limitation',
476
                            'values' => array('test-role-limitation-value'),
477
                        )
478
                    ),
479
                ),
480
            ),
481
            array(
482
                array(
483
                    33 => $this->createRole(array(array('*', '*', '*')), 33),
484
                ),
485
                array(
486
                    new RoleAssignment(
487
                        array(
488
                            'roleId' => 33,
489
                            'limitationIdentifier' => 'test-role-limitation',
490
                            'values' => array('test-role-limitation-value'),
491
                        )
492
                    ),
493
                ),
494
            ),
495
        );
496
    }
497
498
    /**
499
     * Test for the hasAccess() method.