AclTest.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. <?php
  2. class Elgg_Access_AclTest extends PHPUnit_Framework_TestCase {
  3. /**
  4. * Ignoring access permissions globally shouldn't affect the results
  5. * when fetching the ACLs that user belongs to.
  6. */
  7. public function testIgnoringAccessDoesntAffectFetchingReadACLs() {
  8. /**
  9. * How to test:
  10. * 1. Create an ElggUser
  11. * 2. Create an ACL and add the user to it
  12. * 3. Create a second ACL that the user doesn't belong to
  13. * 4. Assert that fetching user's ACLs returns only the first ACL
  14. * 5. Set ACLs to be ignored
  15. * 6. Assert that fetching user's ACLs still return only the first ACL
  16. */
  17. $this->markTestIncomplete();
  18. }
  19. /**
  20. * Ignoring access permissions globally shouldn't affect the results
  21. * when checking whether a specific user has read access to an entity.
  22. */
  23. public function testIgnoringAccessDoesntAffectReadPermissionCheck() {
  24. /**
  25. * How to test:
  26. * 1. Create an ElggUser
  27. * 2. Create an ACL that the user doesn't belong to
  28. * 3. Create an entity that uses the ACL
  29. * 4. Assert that read permission check returns false for the user
  30. * 5. Set ACLs to be ignored
  31. * 6. Assert that read permission check still returns false for the user
  32. */
  33. $this->markTestIncomplete();
  34. }
  35. /**
  36. * Fetching ACLs that a user belongs to should return the same results
  37. * regardless if that particular user is logged in or not.
  38. */
  39. public function testReadAclsAreCorrectForLoggedOutUser() {
  40. /**
  41. * How to test:
  42. * 1. Create an ElggUser
  43. * 2. Create an ACL that the user belongs to
  44. * 3. Sign in the user
  45. * 4. Assert that fetching the user's ACLs returns the ACL
  46. * 5. Log out the user
  47. * 6. Assert that fetching the user's ACLs returns the ACL
  48. */
  49. $this->markTestIncomplete();
  50. }
  51. /**
  52. * Getting the readable name of a default access_id should return the expected value.
  53. */
  54. public function testAclReadableNameForDefaultAccessID() {
  55. /**
  56. * How to test:
  57. * 1. Use getReadableAccessLevel with access_id ACCESS_PRIVATE
  58. * 2. Assert that the output is elgg_echo('PRIVATE')
  59. */
  60. $this->markTestIncomplete();
  61. }
  62. /**
  63. * Getting the readable name of a custom access_id should return the expected value.
  64. */
  65. public function testAclReadableNameForCustomAccessID() {
  66. /**
  67. * How to test:
  68. * 1. Create a custom access list
  69. * 2. Use getReadableAccessLevel with access_id of the just create ACL
  70. * 3. Assert that the output is the same as the name of the just created ACL
  71. */
  72. $this->markTestIncomplete();
  73. }
  74. }