Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like RoleServiceTest often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use RoleServiceTest, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
38 | class RoleServiceTest extends BaseTest |
||
39 | { |
||
40 | /** |
||
41 | * Test for the newRoleCreateStruct() method. |
||
42 | * |
||
43 | * @see \eZ\Publish\API\Repository\RoleService::newRoleCreateStruct() |
||
44 | */ |
||
45 | public function testNewRoleCreateStruct() |
||
46 | { |
||
47 | $repository = $this->getRepository(); |
||
48 | |||
49 | $roleService = $repository->getRoleService(); |
||
50 | $roleCreate = $roleService->newRoleCreateStruct('roleName'); |
||
51 | |||
52 | $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\User\\RoleCreateStruct', $roleCreate); |
||
53 | } |
||
54 | |||
55 | /** |
||
56 | * Test for the newRoleCreateStruct() method. |
||
57 | * |
||
58 | * @see \eZ\Publish\API\Repository\RoleService::newRoleCreateStruct() |
||
59 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewRoleCreateStruct |
||
60 | */ |
||
61 | public function testNewRoleCreateStructSetsNamePropertyOnStruct() |
||
62 | { |
||
63 | $repository = $this->getRepository(); |
||
64 | |||
65 | /* BEGIN: Use Case */ |
||
66 | |||
67 | $roleService = $repository->getRoleService(); |
||
68 | $roleCreate = $roleService->newRoleCreateStruct('roleName'); |
||
69 | |||
70 | /* END: Use Case */ |
||
71 | |||
72 | $this->assertEquals('roleName', $roleCreate->identifier); |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * Test for the createRole() method. |
||
77 | * |
||
78 | * @see \eZ\Publish\API\Repository\RoleService::createRole() |
||
79 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewRoleCreateStruct |
||
80 | */ |
||
81 | public function testCreateRole() |
||
82 | { |
||
83 | $repository = $this->getRepository(); |
||
84 | |||
85 | /* BEGIN: Use Case */ |
||
86 | |||
87 | $roleService = $repository->getRoleService(); |
||
88 | $roleCreate = $roleService->newRoleCreateStruct('roleName'); |
||
89 | |||
90 | // @todo uncomment when support for multilingual names and descriptions is added EZP-24776 |
||
91 | // $roleCreate->mainLanguageCode = 'eng-US'; |
||
92 | |||
93 | $role = $roleService->createRole($roleCreate); |
||
94 | |||
95 | /* END: Use Case */ |
||
96 | |||
97 | $this->assertInstanceOf( |
||
98 | '\\eZ\\Publish\\API\\Repository\\Values\\User\\RoleDraft', |
||
99 | $role |
||
100 | ); |
||
101 | |||
102 | return [ |
||
103 | 'createStruct' => $roleCreate, |
||
104 | 'role' => $role, |
||
105 | ]; |
||
106 | } |
||
107 | |||
108 | /** |
||
109 | * Test for the createRole() method. |
||
110 | * |
||
111 | * @see \eZ\Publish\API\Repository\RoleService::createRole() |
||
112 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRole |
||
113 | */ |
||
114 | public function testRoleCreateStructValues(array $data) |
||
115 | { |
||
116 | $createStruct = $data['createStruct']; |
||
117 | $role = $data['role']; |
||
118 | |||
119 | $this->assertEquals( |
||
120 | [ |
||
121 | 'identifier' => $createStruct->identifier, |
||
122 | 'policies' => $createStruct->policies, |
||
123 | ], |
||
124 | [ |
||
125 | 'identifier' => $role->identifier, |
||
126 | 'policies' => $role->policies, |
||
127 | ] |
||
128 | ); |
||
129 | $this->assertNotNull($role->id); |
||
130 | |||
131 | return $data; |
||
132 | } |
||
133 | |||
134 | /** |
||
135 | * Test for the createRole() method. |
||
136 | * |
||
137 | * @see \eZ\Publish\API\Repository\RoleService::createRole() |
||
138 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewRoleCreateStruct |
||
139 | */ |
||
140 | public function testCreateRoleWithPolicy() |
||
141 | { |
||
142 | $repository = $this->getRepository(); |
||
143 | |||
144 | /* BEGIN: Use Case */ |
||
145 | |||
146 | $roleService = $repository->getRoleService(); |
||
147 | $roleCreate = $roleService->newRoleCreateStruct('roleName'); |
||
148 | |||
149 | // @todo uncomment when support for multilingual names and descriptions is added EZP-24776 |
||
150 | // $roleCreate->mainLanguageCode = 'eng-US'; |
||
151 | |||
152 | // Create new subtree limitation |
||
153 | $limitation = new SubtreeLimitation( |
||
154 | [ |
||
155 | 'limitationValues' => ['/1/2/'], |
||
156 | ] |
||
157 | ); |
||
158 | |||
159 | // Create policy create struct and add limitation to it |
||
160 | $policyCreate = $roleService->newPolicyCreateStruct('content', 'read'); |
||
161 | $policyCreate->addLimitation($limitation); |
||
162 | |||
163 | // Add policy create struct to role create struct |
||
164 | $roleCreate->addPolicy($policyCreate); |
||
165 | |||
166 | $role = $roleService->createRole($roleCreate); |
||
167 | |||
168 | /* END: Use Case */ |
||
169 | |||
170 | $this->assertInstanceOf( |
||
171 | '\\eZ\\Publish\\API\\Repository\\Values\\User\\RoleDraft', |
||
172 | $role |
||
173 | ); |
||
174 | |||
175 | return [ |
||
176 | 'createStruct' => $roleCreate, |
||
177 | 'role' => $role, |
||
178 | ]; |
||
179 | } |
||
180 | |||
181 | /** |
||
182 | * Test for the createRole() method. |
||
183 | * |
||
184 | * @see \eZ\Publish\API\Repository\RoleService::createRole() |
||
185 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleWithPolicy |
||
186 | */ |
||
187 | public function testRoleCreateStructValuesWithPolicy(array $data) |
||
188 | { |
||
189 | $createStruct = $data['createStruct']; |
||
190 | $role = $data['role']; |
||
191 | |||
192 | $this->assertEquals( |
||
193 | [ |
||
194 | 'identifier' => $createStruct->identifier, |
||
195 | 'policy_module' => $createStruct->policies[0]->module, |
||
196 | 'policy_function' => $createStruct->policies[0]->function, |
||
197 | 'policy_limitation' => array_values($createStruct->policies[0]->limitations), |
||
198 | ], |
||
199 | [ |
||
200 | 'identifier' => $role->identifier, |
||
201 | 'policy_module' => $role->policies[0]->module, |
||
202 | 'policy_function' => $role->policies[0]->function, |
||
203 | 'policy_limitation' => array_values($role->policies[0]->limitations), |
||
204 | ] |
||
205 | ); |
||
206 | $this->assertNotNull($role->id); |
||
207 | |||
208 | return $data; |
||
209 | } |
||
210 | |||
211 | /** |
||
212 | * Test creating a role with multiple policies. |
||
213 | * |
||
214 | * @covers \eZ\Publish\API\Repository\RoleService::createRole |
||
215 | */ |
||
216 | public function testCreateRoleWithMultiplePolicies() |
||
217 | { |
||
218 | $repository = $this->getRepository(); |
||
219 | $roleService = $repository->getRoleService(); |
||
220 | |||
221 | $limitation1 = new Limitation\ContentTypeLimitation(); |
||
222 | $limitation1->limitationValues = ['1', '3', '13']; |
||
223 | |||
224 | $limitation2 = new Limitation\SectionLimitation(); |
||
225 | $limitation2->limitationValues = ['2', '3']; |
||
226 | |||
227 | $limitation3 = new Limitation\OwnerLimitation(); |
||
228 | $limitation3->limitationValues = ['1', '2']; |
||
229 | |||
230 | $limitation4 = new Limitation\UserGroupLimitation(); |
||
231 | $limitation4->limitationValues = ['1']; |
||
232 | |||
233 | $policyCreateStruct1 = $roleService->newPolicyCreateStruct('content', 'read'); |
||
234 | $policyCreateStruct1->addLimitation($limitation1); |
||
235 | $policyCreateStruct1->addLimitation($limitation2); |
||
236 | |||
237 | $policyCreateStruct2 = $roleService->newPolicyCreateStruct('content', 'edit'); |
||
238 | $policyCreateStruct2->addLimitation($limitation3); |
||
239 | $policyCreateStruct2->addLimitation($limitation4); |
||
240 | |||
241 | $roleCreateStruct = $roleService->newRoleCreateStruct('ultimate_permissions'); |
||
242 | $roleCreateStruct->addPolicy($policyCreateStruct1); |
||
243 | $roleCreateStruct->addPolicy($policyCreateStruct2); |
||
244 | |||
245 | $createdRole = $roleService->createRole($roleCreateStruct); |
||
246 | |||
247 | self::assertInstanceOf(Role::class, $createdRole); |
||
248 | self::assertGreaterThan(0, $createdRole->id); |
||
249 | |||
250 | $this->assertPropertiesCorrect( |
||
251 | [ |
||
252 | 'identifier' => $roleCreateStruct->identifier, |
||
253 | ], |
||
254 | $createdRole |
||
255 | ); |
||
256 | |||
257 | self::assertCount(2, $createdRole->getPolicies()); |
||
258 | |||
259 | foreach ($createdRole->getPolicies() as $policy) { |
||
260 | self::assertInstanceOf(Policy::class, $policy); |
||
261 | self::assertGreaterThan(0, $policy->id); |
||
262 | self::assertEquals($createdRole->id, $policy->roleId); |
||
263 | |||
264 | self::assertCount(2, $policy->getLimitations()); |
||
265 | |||
266 | foreach ($policy->getLimitations() as $limitation) { |
||
267 | self::assertInstanceOf(Limitation::class, $limitation); |
||
268 | |||
269 | if ($policy->module == 'content' && $policy->function == 'read') { |
||
270 | View Code Duplication | switch ($limitation->getIdentifier()) { |
|
|
|||
271 | case Limitation::CONTENTTYPE: |
||
272 | self::assertEquals($limitation1->limitationValues, $limitation->limitationValues); |
||
273 | break; |
||
274 | |||
275 | case Limitation::SECTION: |
||
276 | self::assertEquals($limitation2->limitationValues, $limitation->limitationValues); |
||
277 | break; |
||
278 | |||
279 | default: |
||
280 | self::fail('Created role contains limitations not defined with create struct'); |
||
281 | } |
||
282 | } elseif ($policy->module == 'content' && $policy->function == 'edit') { |
||
283 | View Code Duplication | switch ($limitation->getIdentifier()) { |
|
284 | case Limitation::OWNER: |
||
285 | self::assertEquals($limitation3->limitationValues, $limitation->limitationValues); |
||
286 | break; |
||
287 | |||
288 | case Limitation::USERGROUP: |
||
289 | self::assertEquals($limitation4->limitationValues, $limitation->limitationValues); |
||
290 | break; |
||
291 | |||
292 | default: |
||
293 | self::fail('Created role contains limitations not defined with create struct'); |
||
294 | } |
||
295 | } else { |
||
296 | self::fail('Created role contains policy not defined with create struct'); |
||
297 | } |
||
298 | } |
||
299 | } |
||
300 | } |
||
301 | |||
302 | /** |
||
303 | * Test for the createRoleDraft() method. |
||
304 | * |
||
305 | * @see \eZ\Publish\API\Repository\RoleService::createRoleDraft() |
||
306 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewRoleCreateStruct |
||
307 | */ |
||
308 | View Code Duplication | public function testCreateRoleDraft() |
|
309 | { |
||
310 | $repository = $this->getRepository(); |
||
311 | |||
312 | /* BEGIN: Use Case */ |
||
313 | |||
314 | $roleService = $repository->getRoleService(); |
||
315 | $roleCreate = $roleService->newRoleCreateStruct('roleName'); |
||
316 | |||
317 | // @todo uncomment when support for multilingual names and descriptions is added EZP-24776 |
||
318 | // $roleCreate->mainLanguageCode = 'eng-US'; |
||
319 | |||
320 | $roleDraft = $roleService->createRole($roleCreate); |
||
321 | $roleService->publishRoleDraft($roleDraft); |
||
322 | $role = $roleService->loadRole($roleDraft->id); |
||
323 | $newRoleDraft = $roleService->createRoleDraft($role); |
||
324 | |||
325 | /* END: Use Case */ |
||
326 | |||
327 | $this->assertInstanceOf( |
||
328 | '\\eZ\\Publish\\API\\Repository\\Values\\User\\RoleDraft', |
||
329 | $newRoleDraft |
||
330 | ); |
||
331 | } |
||
332 | |||
333 | /** |
||
334 | * Test for the createRole() method. |
||
335 | * |
||
336 | * @see \eZ\Publish\API\Repository\RoleService::createRole() |
||
337 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRole |
||
338 | */ |
||
339 | public function testCreateRoleThrowsInvalidArgumentException() |
||
340 | { |
||
341 | $this->expectException(\eZ\Publish\API\Repository\Exceptions\InvalidArgumentException::class); |
||
342 | |||
343 | $repository = $this->getRepository(); |
||
344 | |||
345 | /* BEGIN: Use Case */ |
||
346 | |||
347 | $roleService = $repository->getRoleService(); |
||
348 | $roleCreate = $roleService->newRoleCreateStruct('Editor'); |
||
349 | |||
350 | // @todo uncomment when support for multilingual names and descriptions is added EZP-24776 |
||
351 | // $roleCreate->mainLanguageCode = 'eng-US'; |
||
352 | |||
353 | // This call will fail with an InvalidArgumentException, because Editor exists |
||
354 | $roleService->createRole($roleCreate); |
||
355 | |||
356 | /* END: Use Case */ |
||
357 | } |
||
358 | |||
359 | /** |
||
360 | * Test for the createRoleDraft() method. |
||
361 | * |
||
362 | * @see \eZ\Publish\API\Repository\RoleService::createRoleDraft() |
||
363 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleDraft |
||
364 | */ |
||
365 | View Code Duplication | public function testCreateRoleDraftThrowsInvalidArgumentException() |
|
366 | { |
||
367 | $this->expectException(\eZ\Publish\API\Repository\Exceptions\InvalidArgumentException::class); |
||
368 | |||
369 | $repository = $this->getRepository(); |
||
370 | |||
371 | /* BEGIN: Use Case */ |
||
372 | |||
373 | $roleService = $repository->getRoleService(); |
||
374 | $roleCreate = $roleService->newRoleCreateStruct('Editor'); |
||
375 | |||
376 | // @todo uncomment when support for multilingual names and descriptions is added EZP-24776 |
||
377 | // $roleCreate->mainLanguageCode = 'eng-US'; |
||
378 | |||
379 | $roleDraft = $roleService->createRole($roleCreate); |
||
380 | $roleService->publishRoleDraft($roleDraft); |
||
381 | $role = $roleService->loadRole($roleDraft->id); |
||
382 | $roleService->createRoleDraft($role); // First role draft |
||
383 | |||
384 | // This call will fail with an InvalidArgumentException, because there is already a draft |
||
385 | $roleService->createRoleDraft($role); |
||
386 | |||
387 | /* END: Use Case */ |
||
388 | } |
||
389 | |||
390 | /** |
||
391 | * Test for the createRole() method. |
||
392 | * |
||
393 | * @see \eZ\Publish\API\Repository\RoleService::createRole() |
||
394 | */ |
||
395 | View Code Duplication | public function testCreateRoleThrowsLimitationValidationException() |
|
396 | { |
||
397 | $this->expectException(\eZ\Publish\API\Repository\Exceptions\LimitationValidationException::class); |
||
398 | |||
399 | $repository = $this->getRepository(); |
||
400 | |||
401 | /* BEGIN: Use Case */ |
||
402 | $roleService = $repository->getRoleService(); |
||
403 | |||
404 | // Create new role create struct |
||
405 | $roleCreate = $roleService->newRoleCreateStruct('Lumberjack'); |
||
406 | |||
407 | // @todo uncomment when support for multilingual names and descriptions is added EZP-24776 |
||
408 | // $roleCreate->mainLanguageCode = 'eng-US'; |
||
409 | |||
410 | // Create new subtree limitation |
||
411 | $limitation = new SubtreeLimitation( |
||
412 | [ |
||
413 | 'limitationValues' => ['/mountain/forest/tree/42/'], |
||
414 | ] |
||
415 | ); |
||
416 | |||
417 | // Create policy create struct and add limitation to it |
||
418 | $policyCreate = $roleService->newPolicyCreateStruct('content', 'remove'); |
||
419 | $policyCreate->addLimitation($limitation); |
||
420 | |||
421 | // Add policy create struct to role create struct |
||
422 | $roleCreate->addPolicy($policyCreate); |
||
423 | |||
424 | // This call will fail with an LimitationValidationException, because subtree |
||
425 | // "/mountain/forest/tree/42/" does not exist |
||
426 | $roleService->createRole($roleCreate); |
||
427 | /* END: Use Case */ |
||
428 | } |
||
429 | |||
430 | /** |
||
431 | * Test for the createRole() method. |
||
432 | * |
||
433 | * @see \eZ\Publish\API\Repository\RoleService::createRole() |
||
434 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewRoleCreateStruct |
||
435 | */ |
||
436 | View Code Duplication | public function testCreateRoleInTransactionWithRollback() |
|
437 | { |
||
438 | $repository = $this->getRepository(); |
||
439 | |||
440 | /* BEGIN: Use Case */ |
||
441 | |||
442 | $roleService = $repository->getRoleService(); |
||
443 | |||
444 | $repository->beginTransaction(); |
||
445 | |||
446 | $roleCreate = $roleService->newRoleCreateStruct('roleName'); |
||
447 | |||
448 | // @todo uncomment when support for multilingual names and descriptions is added EZP-24776 |
||
449 | // $roleCreate->mainLanguageCode = 'eng-US'; |
||
450 | |||
451 | $createdRoleId = $roleService->createRole($roleCreate)->id; |
||
452 | |||
453 | $repository->rollback(); |
||
454 | |||
455 | try { |
||
456 | // This call will fail with a "NotFoundException" |
||
457 | $role = $roleService->loadRole($createdRoleId); |
||
458 | } catch (NotFoundException $e) { |
||
459 | return; |
||
460 | } |
||
461 | /* END: Use Case */ |
||
462 | |||
463 | $this->fail('Role object still exists after rollback.'); |
||
464 | } |
||
465 | |||
466 | /** |
||
467 | * Test for the createRoleDraft() method. |
||
468 | * |
||
469 | * @see \eZ\Publish\API\Repository\RoleService::createRoleDraft() |
||
470 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewRoleCreateStruct |
||
471 | */ |
||
472 | View Code Duplication | public function testCreateRoleDraftInTransactionWithRollback() |
|
473 | { |
||
474 | $repository = $this->getRepository(); |
||
475 | |||
476 | /* BEGIN: Use Case */ |
||
477 | |||
478 | $roleService = $repository->getRoleService(); |
||
479 | |||
480 | $repository->beginTransaction(); |
||
481 | |||
482 | $roleCreate = $roleService->newRoleCreateStruct('roleName'); |
||
483 | |||
484 | // @todo uncomment when support for multilingual names and descriptions is added EZP-24776 |
||
485 | // $roleCreate->mainLanguageCode = 'eng-US'; |
||
486 | |||
487 | $createdRoleId = $roleService->createRole($roleCreate)->id; |
||
488 | |||
489 | $repository->rollback(); |
||
490 | |||
491 | try { |
||
492 | // This call will fail with a "NotFoundException" |
||
493 | $role = $roleService->loadRoleDraft($createdRoleId); |
||
494 | } catch (NotFoundException $e) { |
||
495 | return; |
||
496 | } |
||
497 | /* END: Use Case */ |
||
498 | |||
499 | $this->fail('Role draft object still exists after rollback.'); |
||
500 | } |
||
501 | |||
502 | /** |
||
503 | * Test for the loadRole() method. |
||
504 | * |
||
505 | * @see \eZ\Publish\API\Repository\RoleService::loadRole() |
||
506 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRole |
||
507 | */ |
||
508 | View Code Duplication | public function testLoadRole() |
|
509 | { |
||
510 | $repository = $this->getRepository(); |
||
511 | |||
512 | /* BEGIN: Use Case */ |
||
513 | |||
514 | $roleService = $repository->getRoleService(); |
||
515 | $roleCreate = $roleService->newRoleCreateStruct('roleName'); |
||
516 | |||
517 | // @todo uncomment when support for multilingual names and descriptions is added EZP-24776 |
||
518 | // $roleCreate->mainLanguageCode = 'eng-US'; |
||
519 | |||
520 | $roleDraft = $roleService->createRole($roleCreate); |
||
521 | $roleService->publishRoleDraft($roleDraft); |
||
522 | |||
523 | // Load the newly created role by its ID |
||
524 | $role = $roleService->loadRole($roleDraft->id); |
||
525 | |||
526 | /* END: Use Case */ |
||
527 | |||
528 | $this->assertEquals('roleName', $role->identifier); |
||
529 | } |
||
530 | |||
531 | /** |
||
532 | * Test for the loadRoleDraft() method. |
||
533 | * |
||
534 | * @see \eZ\Publish\API\Repository\RoleService::loadRoleDraft() |
||
535 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleDraft |
||
536 | */ |
||
537 | public function testLoadRoleDraft() |
||
538 | { |
||
539 | $repository = $this->getRepository(); |
||
540 | |||
541 | /* BEGIN: Use Case */ |
||
542 | |||
543 | $roleService = $repository->getRoleService(); |
||
544 | $roleCreate = $roleService->newRoleCreateStruct('roleName'); |
||
545 | |||
546 | // @todo uncomment when support for multilingual names and descriptions is added EZP-24776 |
||
547 | // $roleCreate->mainLanguageCode = 'eng-US'; |
||
548 | |||
549 | $roleDraft = $roleService->createRole($roleCreate); |
||
550 | |||
551 | // Load the newly created role by its ID |
||
552 | $role = $roleService->loadRoleDraft($roleDraft->id); |
||
553 | |||
554 | /* END: Use Case */ |
||
555 | |||
556 | $this->assertEquals('roleName', $role->identifier); |
||
557 | } |
||
558 | |||
559 | public function testLoadRoleDraftByRoleId() |
||
584 | |||
585 | /** |
||
586 | * Test for the loadRole() method. |
||
587 | * |
||
588 | * @see \eZ\Publish\API\Repository\RoleService::loadRole() |
||
589 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRole |
||
590 | */ |
||
591 | public function testLoadRoleThrowsNotFoundException() |
||
592 | { |
||
593 | $this->expectException(\eZ\Publish\API\Repository\Exceptions\NotFoundException::class); |
||
594 | |||
595 | $repository = $this->getRepository(); |
||
596 | |||
597 | $nonExistingRoleId = $this->generateId('role', self::DB_INT_MAX); |
||
598 | /* BEGIN: Use Case */ |
||
599 | |||
607 | |||
608 | /** |
||
609 | * Test for the loadRoleDraft() method. |
||
610 | * |
||
611 | * @see \eZ\Publish\API\Repository\RoleService::loadRoleDraft() |
||
612 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleDraft |
||
613 | */ |
||
614 | public function testLoadRoleDraftThrowsNotFoundException() |
||
630 | |||
631 | public function testLoadRoleDraftByRoleIdThrowsNotFoundException() |
||
647 | |||
648 | /** |
||
649 | * Test for the loadRoleByIdentifier() method. |
||
650 | * |
||
651 | * @see \eZ\Publish\API\Repository\RoleService::loadRoleByIdentifier() |
||
652 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRole |
||
653 | */ |
||
654 | View Code Duplication | public function testLoadRoleByIdentifier() |
|
676 | |||
677 | /** |
||
678 | * Test for the loadRoleByIdentifier() method. |
||
679 | * |
||
680 | * @see \eZ\Publish\API\Repository\RoleService::loadRoleByIdentifier() |
||
681 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleByIdentifier |
||
682 | */ |
||
683 | public function testLoadRoleByIdentifierThrowsNotFoundException() |
||
698 | |||
699 | /** |
||
700 | * Test for the loadRoles() method. |
||
701 | * |
||
702 | * @see \eZ\Publish\API\Repository\RoleService::loadRoles() |
||
703 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRole |
||
704 | */ |
||
705 | public function testLoadRoles() |
||
734 | |||
735 | /** |
||
736 | * Test for the loadRoles() method. |
||
737 | * |
||
738 | * @see \eZ\Publish\API\Repository\RoleService::loadRoles() |
||
739 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoles |
||
740 | */ |
||
741 | public function testLoadRolesReturnsExpectedSetOfDefaultRoles() |
||
767 | |||
768 | /** |
||
769 | * Test for the newRoleUpdateStruct() method. |
||
770 | * |
||
771 | * @see \eZ\Publish\API\Repository\RoleService::newRoleUpdateStruct() |
||
772 | */ |
||
773 | public function testNewRoleUpdateStruct() |
||
784 | |||
785 | /** |
||
786 | * Test for the updateRoleDraft() method. |
||
787 | * |
||
788 | * @see \eZ\Publish\API\Repository\RoleService::updateRoleDraft() |
||
789 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewRoleUpdateStruct |
||
790 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleDraft |
||
791 | */ |
||
792 | public function testUpdateRoleDraft() |
||
816 | |||
817 | /** |
||
818 | * Test for the updateRoleDraft() method. |
||
819 | * |
||
820 | * @see \eZ\Publish\API\Repository\RoleService::updateRoleDraft() |
||
821 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testUpdateRoleDraft |
||
822 | */ |
||
823 | public function testUpdateRoleDraftThrowsInvalidArgumentException() |
||
845 | |||
846 | /** |
||
847 | * Test for the deleteRole() method. |
||
848 | * |
||
849 | * @see \eZ\Publish\API\Repository\RoleService::deleteRole() |
||
850 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRole |
||
851 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoles |
||
852 | */ |
||
853 | public function testDeleteRole() |
||
873 | |||
874 | /** |
||
875 | * Test for the deleteRoleDraft() method. |
||
876 | * |
||
877 | * @see \eZ\Publish\API\Repository\RoleService::deleteRoleDraft() |
||
878 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleDraft |
||
879 | */ |
||
880 | public function testDeleteRoleDraft() |
||
901 | |||
902 | /** |
||
903 | * Test for the newPolicyCreateStruct() method. |
||
904 | * |
||
905 | * @see \eZ\Publish\API\Repository\RoleService::newPolicyCreateStruct() |
||
906 | */ |
||
907 | public function testNewPolicyCreateStruct() |
||
918 | |||
919 | /** |
||
920 | * Test for the newPolicyCreateStruct() method. |
||
921 | * |
||
922 | * @see \eZ\Publish\API\Repository\RoleService::newPolicyCreateStruct() |
||
923 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewPolicyCreateStruct |
||
924 | */ |
||
925 | public function testNewPolicyCreateStructSetsStructProperties() |
||
939 | |||
940 | /** |
||
941 | * Test for the addPolicyByRoleDraft() method. |
||
942 | * |
||
943 | * @see \eZ\Publish\API\Repository\RoleService::addPolicyByRoleDraft() |
||
944 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleDraft |
||
945 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewPolicyCreateStruct |
||
946 | */ |
||
947 | public function testAddPolicyByRoleDraft() |
||
999 | |||
1000 | /** |
||
1001 | * Test for the addPolicyByRoleDraft() method. |
||
1002 | * |
||
1003 | * @return array [\eZ\Publish\API\Repository\Values\User\RoleDraft, \eZ\Publish\API\Repository\Values\User\Policy] |
||
1004 | * |
||
1005 | * @see \eZ\Publish\API\Repository\RoleService::addPolicyByRoleDraft() |
||
1006 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAddPolicyByRoleDraft |
||
1007 | */ |
||
1008 | public function testAddPolicyByRoleDraftUpdatesRole() |
||
1040 | |||
1041 | /** |
||
1042 | * Test for the addPolicyByRoleDraft() method. |
||
1043 | * |
||
1044 | * @param array $roleAndPolicy |
||
1045 | * |
||
1046 | * @see \eZ\Publish\API\Repository\RoleService::addPolicyByRoleDraft() |
||
1047 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAddPolicyByRoleDraftUpdatesRole |
||
1048 | */ |
||
1049 | public function testAddPolicyByRoleDraftSetsPolicyProperties($roleAndPolicy) |
||
1058 | |||
1059 | /** |
||
1060 | * Test for the addPolicyByRoleDraft() method. |
||
1061 | * |
||
1062 | * @see \eZ\Publish\API\Repository\RoleService::addPolicyByRoleDraft() |
||
1063 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewPolicyCreateStruct |
||
1064 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleDraft |
||
1065 | */ |
||
1066 | View Code Duplication | public function testAddPolicyByRoleDraftThrowsLimitationValidationException() |
|
1098 | |||
1099 | /** |
||
1100 | * Test for the createRole() method. |
||
1101 | * |
||
1102 | * @see \eZ\Publish\API\Repository\RoleService::createRole() |
||
1103 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAddPolicyByRoleDraftUpdatesRole |
||
1104 | */ |
||
1105 | public function testCreateRoleWithAddPolicy() |
||
1158 | |||
1159 | /** |
||
1160 | * Test for the createRoleDraft() method. |
||
1161 | * |
||
1162 | * @see \eZ\Publish\API\Repository\RoleService::createRoleDraft() |
||
1163 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAddPolicyByRoleDraftUpdatesRole |
||
1164 | */ |
||
1165 | public function testCreateRoleDraftWithAddPolicy() |
||
1215 | |||
1216 | /** |
||
1217 | * Test for the newPolicyUpdateStruct() method. |
||
1218 | * |
||
1219 | * @see \eZ\Publish\API\Repository\RoleService::newPolicyUpdateStruct() |
||
1220 | */ |
||
1221 | public function testNewPolicyUpdateStruct() |
||
1235 | |||
1236 | public function testUpdatePolicyByRoleDraftNoLimitation() |
||
1289 | |||
1290 | /** |
||
1291 | * @return array |
||
1292 | * |
||
1293 | * @see \eZ\Publish\API\Repository\RoleService::updatePolicyByRoleDraft() |
||
1294 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAddPolicyByRoleDraft |
||
1295 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewPolicyUpdateStruct |
||
1296 | */ |
||
1297 | public function testUpdatePolicyByRoleDraft() |
||
1366 | |||
1367 | /** |
||
1368 | * @param array $roleAndPolicy |
||
1369 | * |
||
1370 | * @see \eZ\Publish\API\Repository\RoleService::testUpdatePolicyByRoleDraft() |
||
1371 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testUpdatePolicyByRoleDraft |
||
1372 | */ |
||
1373 | public function testUpdatePolicyUpdatesLimitations($roleAndPolicy) |
||
1390 | |||
1391 | /** |
||
1392 | * Test for the updatePolicy() method. |
||
1393 | * |
||
1394 | * @param \eZ\Publish\API\Repository\Values\User\Role $role |
||
1395 | * |
||
1396 | * @see \eZ\Publish\API\Repository\RoleService::updatePolicyByRoleDraft() |
||
1397 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testUpdatePolicyUpdatesLimitations |
||
1398 | */ |
||
1399 | public function testUpdatePolicyUpdatesRole($role) |
||
1422 | |||
1423 | /** |
||
1424 | * Test for the updatePolicy() method. |
||
1425 | * |
||
1426 | * @see \eZ\Publish\API\Repository\RoleService::updatePolicyByRoleDraft() |
||
1427 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAddPolicyByRoleDraft |
||
1428 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewPolicyCreateStruct |
||
1429 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewPolicyUpdateStruct |
||
1430 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testNewRoleCreateStruct |
||
1431 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRole |
||
1432 | */ |
||
1433 | public function testUpdatePolicyByRoleDraftThrowsLimitationValidationException() |
||
1495 | |||
1496 | /** |
||
1497 | * Test for the removePolicyByRoleDraft() method. |
||
1498 | * |
||
1499 | * @see \eZ\Publish\API\Repository\RoleService::removePolicyByRoleDraft() |
||
1500 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAddPolicyByRoleDraft |
||
1501 | */ |
||
1502 | View Code Duplication | public function testRemovePolicyByRoleDraft() |
|
1534 | |||
1535 | /** |
||
1536 | * Test for the addPolicyByRoleDraft() method. |
||
1537 | * |
||
1538 | * @see \eZ\Publish\API\Repository\RoleService::addPolicyByRoleDraft() |
||
1539 | */ |
||
1540 | public function testAddPolicyWithRoleAssignment() |
||
1579 | |||
1580 | /** |
||
1581 | * Test loading user/group role assignments. |
||
1582 | * |
||
1583 | * @return \eZ\Publish\API\Repository\Values\User\UserGroupRoleAssignment |
||
1584 | * |
||
1585 | * @covers \eZ\Publish\API\Repository\RoleService::loadRoleAssignment |
||
1586 | */ |
||
1587 | public function testLoadRoleAssignment() |
||
1632 | |||
1633 | /** |
||
1634 | * Test for the getRoleAssignments() method. |
||
1635 | * |
||
1636 | * @return \eZ\Publish\API\Repository\Values\User\RoleAssignment[] |
||
1637 | * |
||
1638 | * @see \eZ\Publish\API\Repository\RoleService::getRoleAssignments() |
||
1639 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleByIdentifier |
||
1640 | */ |
||
1641 | public function testGetRoleAssignments() |
||
1668 | |||
1669 | /** |
||
1670 | * Test for the getRoleAssignments() method. |
||
1671 | * |
||
1672 | * @param \eZ\Publish\API\Repository\Values\User\RoleAssignment[] $roleAssignments |
||
1673 | * |
||
1674 | * @see \eZ\Publish\API\Repository\RoleService::getRoleAssignments() |
||
1675 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testGetRoleAssignments |
||
1676 | */ |
||
1677 | public function testGetRoleAssignmentsContainExpectedLimitation(array $roleAssignments) |
||
1684 | |||
1685 | /** |
||
1686 | * Test for the assignRoleToUser() method. |
||
1687 | * |
||
1688 | * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUser() |
||
1689 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testGetRoleAssignments |
||
1690 | */ |
||
1691 | View Code Duplication | public function testAssignRoleToUser() |
|
1712 | |||
1713 | /** |
||
1714 | * Test for the assignRoleToUser() method. |
||
1715 | * |
||
1716 | * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUser($role, $user, $roleLimitation) |
||
1717 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser |
||
1718 | */ |
||
1719 | View Code Duplication | public function testAssignRoleToUserWithRoleLimitation() |
|
1817 | |||
1818 | /** |
||
1819 | * Test for the assignRoleToUser() method. |
||
1820 | * |
||
1821 | * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUser($role, $user, $roleLimitation) |
||
1822 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser |
||
1823 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleByIdentifier |
||
1824 | */ |
||
1825 | public function testAssignRoleToUserWithRoleLimitationThrowsLimitationValidationException() |
||
1856 | |||
1857 | /** |
||
1858 | * Test for the assignRoleToUser() method. |
||
1859 | * |
||
1860 | * Makes sure assigning role several times throws. |
||
1861 | * |
||
1862 | * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUser($role, $user, $roleLimitation) |
||
1863 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser |
||
1864 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleByIdentifier |
||
1865 | */ |
||
1866 | public function testAssignRoleToUserThrowsInvalidArgumentException() |
||
1901 | |||
1902 | /** |
||
1903 | * Test for the assignRoleToUser() method. |
||
1904 | * |
||
1905 | * Makes sure assigning role several times with same limitations throws. |
||
1906 | * |
||
1907 | * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUser($role, $user, $roleLimitation) |
||
1908 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser |
||
1909 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleByIdentifier |
||
1910 | */ |
||
1911 | public function testAssignRoleToUserWithRoleLimitationThrowsInvalidArgumentException() |
||
1956 | |||
1957 | /** |
||
1958 | * Test for the removeRoleAssignment() method. |
||
1959 | * |
||
1960 | * @see \eZ\Publish\API\Repository\RoleService::removeRoleAssignment() |
||
1961 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser |
||
1962 | */ |
||
1963 | View Code Duplication | public function testRemoveRoleAssignment() |
|
1991 | |||
1992 | /** |
||
1993 | * Test for the getRoleAssignmentsForUser() method. |
||
1994 | * |
||
1995 | * @see \eZ\Publish\API\Repository\RoleService::getRoleAssignmentsForUser() |
||
1996 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser |
||
1997 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleWithAddPolicy |
||
1998 | */ |
||
1999 | public function testGetRoleAssignmentsForUserDirect() |
||
2046 | |||
2047 | /** |
||
2048 | * Test for the getRoleAssignmentsForUser() method. |
||
2049 | * |
||
2050 | * @see \eZ\Publish\API\Repository\RoleService::getRoleAssignmentsForUser() |
||
2051 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser |
||
2052 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleWithAddPolicy |
||
2053 | */ |
||
2054 | View Code Duplication | public function testGetRoleAssignmentsForUserEmpty() |
|
2070 | |||
2071 | /** |
||
2072 | * Test for the getRoleAssignmentsForUser() method. |
||
2073 | * |
||
2074 | * @see \eZ\Publish\API\Repository\RoleService::getRoleAssignmentsForUser() |
||
2075 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser |
||
2076 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleWithAddPolicy |
||
2077 | */ |
||
2078 | public function testGetRoleAssignmentsForUserInherited() |
||
2098 | |||
2099 | /** |
||
2100 | * Test for the assignRoleToUserGroup() method. |
||
2101 | * |
||
2102 | * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUserGroup() |
||
2103 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testGetRoleAssignments |
||
2104 | */ |
||
2105 | View Code Duplication | public function testAssignRoleToUserGroup() |
|
2126 | |||
2127 | /** |
||
2128 | * Test for the assignRoleToUserGroup() method. |
||
2129 | * |
||
2130 | * Related issue: EZP-29113 |
||
2131 | * |
||
2132 | * @covers \eZ\Publish\API\Repository\RoleService::assignRoleToUserGroup() |
||
2133 | */ |
||
2134 | public function testAssignRoleToUserGroupAffectsRoleAssignmentsForUser() |
||
2156 | |||
2157 | /** |
||
2158 | * Test for the assignRoleToUserGroup() method. |
||
2159 | * |
||
2160 | * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUserGroup($role, $userGroup, $roleLimitation) |
||
2161 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup |
||
2162 | */ |
||
2163 | View Code Duplication | public function testAssignRoleToUserGroupWithRoleLimitation() |
|
2257 | |||
2258 | /** |
||
2259 | * Test for the assignRoleToUserGroup() method. |
||
2260 | * |
||
2261 | * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUserGroup($role, $userGroup, $roleLimitation) |
||
2262 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleByIdentifier |
||
2263 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup |
||
2264 | */ |
||
2265 | View Code Duplication | public function testAssignRoleToUserGroupWithRoleLimitationThrowsLimitationValidationException() |
|
2297 | |||
2298 | /** |
||
2299 | * Test for the assignRoleToUserGroup() method. |
||
2300 | * |
||
2301 | * Makes sure assigning role several times throws. |
||
2302 | * |
||
2303 | * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUserGroup($role, $userGroup, $roleLimitation) |
||
2304 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleByIdentifier |
||
2305 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup |
||
2306 | */ |
||
2307 | View Code Duplication | public function testAssignRoleToUserGroupThrowsInvalidArgumentException() |
|
2343 | |||
2344 | /** |
||
2345 | * Test for the assignRoleToUserGroup() method. |
||
2346 | * |
||
2347 | * Makes sure assigning role several times with same limitations throws. |
||
2348 | * |
||
2349 | * @see \eZ\Publish\API\Repository\RoleService::assignRoleToUserGroup($role, $userGroup, $roleLimitation) |
||
2350 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testLoadRoleByIdentifier |
||
2351 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup |
||
2352 | */ |
||
2353 | public function testAssignRoleToUserGroupWithRoleLimitationThrowsInvalidArgumentException() |
||
2399 | |||
2400 | /** |
||
2401 | * Test for the removeRoleAssignment() method. |
||
2402 | * |
||
2403 | * @see \eZ\Publish\API\Repository\RoleService::removeRoleAssignment() |
||
2404 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup |
||
2405 | */ |
||
2406 | public function testRemoveRoleAssignmentFromUserGroup() |
||
2436 | |||
2437 | /** |
||
2438 | * Test unassigning role by assignment. |
||
2439 | * |
||
2440 | * @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment |
||
2441 | */ |
||
2442 | public function testUnassignRoleByAssignment() |
||
2461 | |||
2462 | /** |
||
2463 | * Test unassigning role by assignment. |
||
2464 | * |
||
2465 | * But on current admin user so he lacks access to read roles. |
||
2466 | * |
||
2467 | * @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment |
||
2468 | */ |
||
2469 | View Code Duplication | public function testUnassignRoleByAssignmentThrowsUnauthorizedException() |
|
2488 | |||
2489 | /** |
||
2490 | * Test unassigning role by non-existing assignment. |
||
2491 | * |
||
2492 | * @covers \eZ\Publish\API\Repository\RoleService::removeRoleAssignment |
||
2493 | */ |
||
2494 | View Code Duplication | public function testUnassignRoleByAssignmentThrowsNotFoundException() |
|
2513 | |||
2514 | /** |
||
2515 | * Test for the getRoleAssignmentsForUserGroup() method. |
||
2516 | * |
||
2517 | * @see \eZ\Publish\API\Repository\RoleService::getRoleAssignmentsForUserGroup() |
||
2518 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup |
||
2519 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleWithAddPolicy |
||
2520 | */ |
||
2521 | public function testGetRoleAssignmentsForUserGroup() |
||
2563 | |||
2564 | /** |
||
2565 | * Test for the getRoleAssignmentsForUser() method. |
||
2566 | * |
||
2567 | * @see \eZ\Publish\API\Repository\RoleService::getRoleAssignmentsForUser() |
||
2568 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUser |
||
2569 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAssignRoleToUserGroup |
||
2570 | */ |
||
2571 | public function testLoadPoliciesByUserId() |
||
2640 | |||
2641 | /** |
||
2642 | * Test for the publishRoleDraft() method. |
||
2643 | * |
||
2644 | * @see \eZ\Publish\API\Repository\RoleService::publishRoleDraft() |
||
2645 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleDraft |
||
2646 | */ |
||
2647 | View Code Duplication | public function testPublishRoleDraft() |
|
2677 | |||
2678 | /** |
||
2679 | * Test for the publishRoleDraft() method. |
||
2680 | * |
||
2681 | * @see \eZ\Publish\API\Repository\RoleService::publishRoleDraft() |
||
2682 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testCreateRoleDraft |
||
2683 | * @depends eZ\Publish\API\Repository\Tests\RoleServiceTest::testAddPolicyByRoleDraft |
||
2684 | */ |
||
2685 | public function testPublishRoleDraftAddPolicies() |
||
2739 | |||
2740 | /** |
||
2741 | * Create a user group fixture in a variable named <b>$userGroup</b>,. |
||
2742 | * |
||
2743 | * @return \eZ\Publish\API\Repository\Values\User\UserGroup |
||
2744 | */ |
||
2745 | private function createUserGroupVersion1() |
||
2772 | } |
||
2773 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.