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