Code Duplication    Length = 38-50 lines in 3 locations

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

@@ 227-276 (lines=50) @@
224
    /**
225
     * @return array
226
     */
227
    public function providerForTestHasAccessReturnsPermissionSets()
228
    {
229
        return array(
230
            array(
231
                array(
232
                    31 => $this->createRole(
233
                        array(
234
                            array('test-module', 'test-function', 'test-limitation'),
235
                        ),
236
                        31
237
                    ),
238
                ),
239
                array(
240
                    new RoleAssignment(
241
                        array(
242
                            'roleId' => 31,
243
                        )
244
                    ),
245
                ),
246
            ),
247
            array(
248
                array(
249
                    31 => $this->createRole(
250
                        array(
251
                            array('test-module', 'test-function', 'test-limitation'),
252
                        ),
253
                        31
254
                    ),
255
                    32 => $this->createRole(
256
                        array(
257
                            array('test-module', 'test-function', 'test-limitation2'),
258
                        ),
259
                        32
260
                    ),
261
                ),
262
                array(
263
                    new RoleAssignment(
264
                        array(
265
                            'roleId' => 31,
266
                        )
267
                    ),
268
                    new RoleAssignment(
269
                        array(
270
                            'roleId' => 32,
271
                        )
272
                    ),
273
                ),
274
            ),
275
        );
276
    }
277
278
    /**
279
     * Test for the hasAccess() method.
@@ 363-412 (lines=50) @@
360
    /**
361
     * @return array
362
     */
363
    public function providerForTestHasAccessReturnsException()
364
    {
365
        return array(
366
            array(
367
                array(
368
                    31 => $this->createRole(
369
                        array(
370
                            array('test-module', 'test-function', 'notfound'),
371
                        ),
372
                        31
373
                    ),
374
                ),
375
                array(
376
                    new RoleAssignment(
377
                        array(
378
                            'roleId' => 31,
379
                        )
380
                    ),
381
                ),
382
            ),
383
            array(
384
                array(
385
                    31 => $this->createRole(
386
                        array(
387
                            array('test-module', 'test-function', 'test-limitation'),
388
                        ),
389
                        31
390
                    ),
391
                    32 => $this->createRole(
392
                        array(
393
                            array('test-module', 'test-function', 'notfound'),
394
                        ),
395
                        32
396
                    ),
397
                ),
398
                array(
399
                    new RoleAssignment(
400
                        array(
401
                            'roleId' => 31,
402
                        )
403
                    ),
404
                    new RoleAssignment(
405
                        array(
406
                            'roleId' => 32,
407
                        )
408
                    ),
409
                ),
410
            ),
411
        );
412
    }
413
414
    /**
415
     * Test for the hasAccess() method.
@@ 494-531 (lines=38) @@
491
        $repositoryMock->hasAccess('test-module', 'test-function');
492
    }
493
494
    public function providerForTestHasAccessReturnsPermissionSetsWithRoleLimitation()
495
    {
496
        return array(
497
            array(
498
                array(
499
                    32 => $this->createRole(
500
                        array(
501
                            array('test-module', 'test-function', 'test-limitation'),
502
                        ),
503
                        32
504
                    ),
505
                ),
506
                array(
507
                    new RoleAssignment(
508
                        array(
509
                            'roleId' => 32,
510
                            'limitationIdentifier' => 'test-role-limitation',
511
                            'values' => array('test-role-limitation-value'),
512
                        )
513
                    ),
514
                ),
515
            ),
516
            array(
517
                array(
518
                    33 => $this->createRole(array(array('*', '*', '*')), 33),
519
                ),
520
                array(
521
                    new RoleAssignment(
522
                        array(
523
                            'roleId' => 33,
524
                            'limitationIdentifier' => 'test-role-limitation',
525
                            'values' => array('test-role-limitation-value'),
526
                        )
527
                    ),
528
                ),
529
            ),
530
        );
531
    }
532
533
    /**
534
     * Test for the hasAccess() method.