test: add unit test coverage for simple events, cache and parser#12576
Merged
test: add unit test coverage for simple events, cache and parser#12576
Conversation
There was a problem hiding this comment.
Pull request overview
Adds PHPUnit unit test coverage for several small “value object” style classes in the Mail app (events + cache helpers) and for the HTML parser utility.
Changes:
- Add unit tests for
OCA\Mail\Html\Parser::parseToDomDocument()across a few representative HTML inputs. - Add unit tests asserting constructor/getter behavior for multiple
OCA\Mail\Events\*event classes. - Add unit tests for cache helpers (
CachedMailbox,HordeSyncToken,HordeSyncTokenParser).
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/Html/ParserTest.php | Covers Parser::parseToDomDocument() with minimal/malformed/complex HTML inputs. |
| tests/Unit/Events/SynchronizationEventTest.php | Verifies SynchronizationEvent constructor + getters. |
| tests/Unit/Events/SaveDraftEventTest.php | Verifies SaveDraftEvent constructor + getters (with/without draft). |
| tests/Unit/Events/OutboxMessageCreatedEventTest.php | Verifies OutboxMessageCreatedEvent constructor + getters. |
| tests/Unit/Events/NewMessagesSynchronizedTest.php | Verifies NewMessagesSynchronized constructor + getters (incl. empty messages). |
| tests/Unit/Events/NewMessageReceivedEventTest.php | Verifies NewMessageReceivedEvent URI getter. |
| tests/Unit/Events/MessageSentEventTest.php | Verifies MessageSentEvent constructor + getters. |
| tests/Unit/Events/MessageFlaggedEventTest.php | Verifies MessageFlaggedEvent constructor + getters for set/unset cases. |
| tests/Unit/Events/MessageDeletedEventTest.php | Verifies MessageDeletedEvent constructor + getters. |
| tests/Unit/Events/MailboxesSynchronizedEventTest.php | Verifies MailboxesSynchronizedEvent account getter. |
| tests/Unit/Events/DraftSavedEventTest.php | Verifies DraftSavedEvent optional parameter combinations. |
| tests/Unit/Events/DraftMessageCreatedEventTest.php | Verifies DraftMessageCreatedEvent constructor + getters. |
| tests/Unit/Events/BeforeMessageDeletedEventTest.php | Verifies BeforeMessageDeletedEvent constructor + getters. |
| tests/Unit/Events/BeforeImapClientCreatedTest.php | Verifies BeforeImapClientCreated account getter. |
| tests/Unit/Cache/HordeSyncTokenTest.php | Verifies HordeSyncToken getters for full/null/partial inputs. |
| tests/Unit/Cache/HordeSyncTokenParserTest.php | Verifies HordeSyncTokenParser::parseSyncToken() for multiple token shapes. |
| tests/Unit/Cache/CachedMailboxTest.php | Verifies CachedMailbox defaults and setter/getter behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
This comment was marked as resolved.
This comment was marked as resolved.
AI-assisted: OpenCode + Claude Haiku 4.5 Signed-off-by: Christoph Wurst <1374172+ChristophWurst@users.noreply.github.com>
c634652 to
fc4cc9f
Compare
kesselb
approved these changes
Mar 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated tests for simple, boring code
AI-assisted: OpenCode + Claude Haiku 4.5