Code Duplication    Length = 38-50 lines in 3 locations

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

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