Code Duplication    Length = 38-50 lines in 3 locations

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

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