PageOwnerTest.php 827 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. class Elgg_PageOwnerTest extends PHPUnit_Framework_TestCase {
  3. /**
  4. * It should be possible to set and unset a page owner even if that results in no page owner at all.
  5. */
  6. public function testSetAndUnsetPageOwner() {
  7. /**
  8. * How to test:
  9. * 1. Set page owner
  10. * 2. Unset page owner
  11. * 3. Assert that fetching page owner results in the expected page owner
  12. */
  13. // check if setting to false returns 0
  14. elgg_set_page_owner_guid(1);
  15. $this->assertEquals(1, elgg_get_page_owner_guid());
  16. elgg_set_page_owner_guid(false);
  17. $this->assertEquals(0, elgg_get_page_owner_guid());
  18. // check if setting to null returns 0
  19. elgg_set_page_owner_guid(1);
  20. $this->assertEquals(1, elgg_get_page_owner_guid());
  21. elgg_set_page_owner_guid(null);
  22. $this->assertEquals(0, elgg_get_page_owner_guid());
  23. }
  24. }