Skip to content

Conversation

@simonLeary42
Copy link
Collaborator

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds test coverage for non-admin users attempting to access admin pages. The implementation modifies error handling methods to accept user-facing messages and updates the test framework to capture and verify page output.

Key changes:

  • Enhanced UnityHTTPD error methods (badRequest, forbidden, internalServerError) to accept optional user messages
  • Modified test helper function http_get to return output for verification
  • Added test cases verifying non-admin users receive appropriate error messages when accessing admin pages

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
resources/lib/UnityHTTPD.php Added optional user_message parameter to error methods and simplified die() method
webroot/admin/user-mgmt.php Updated forbidden() call to include user-facing error message
webroot/admin/pi-mgmt.php Updated forbidden() call to include user-facing error message
webroot/admin/notices.php Updated forbidden() call to include user-facing error message
webroot/admin/content.php Updated forbidden() call to include user-facing error message
webroot/admin/ajax/get_page_contents.php Updated forbidden() call to include user-facing error message
webroot/admin/ajax/get_group_members.php Updated forbidden() call to include user-facing error message
test/phpunit-bootstrap.php Changed http_get return type from void to string to capture output
test/functional/PageLoadTest.php Enhanced tests to verify page content with regex matching and added non-admin access test cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@simonLeary42 simonLeary42 changed the title add tests for non admin attempt to access admin page add more page loading tests Jan 5, 2026
@simonLeary42 simonLeary42 marked this pull request as ready for review January 5, 2026 17:01
@simonLeary42 simonLeary42 merged commit 3eaf305 into main Jan 5, 2026
3 checks passed
@simonLeary42 simonLeary42 deleted the page-load-test2 branch January 5, 2026 17:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants