Skip to content

Give the API test emails a usable body - #358

Merged
escopecz merged 1 commit into
mautic:mainfrom
santhiprakash:fix/email-fixtures-usable-body
Nov 20, 2026
Merged

escopecz merged 1 commit into
mautic:mainfrom
santhiprakash:fix/email-fixtures-usable-body

Conversation

@santhiprakash

@santhiprakash santhiprakash commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Two fixtures create published emails that carry no body content at all:

  • CampaignsTest passes body in its email payload. body is not an
    email API property (the API exposes customHtml, plainText,
    template), so it is silently ignored and the created email has no
    content.
  • MessagesTest creates the email channel with only name and
    subject set.

Both emails end up published with no HTML, no plain text and no theme —
a state that no longer validates once mautic/mautic#17006 lands, where
an active email must have HTML or plain-text content and the error
surfaces through the regular API validation response.

The fix uses customHtml, the same field EmailsTest already uses, so
the fixtures describe the sendable email they were always meant to
create. Verified: customHtml is listed in
Email::loadApiMetadata() while body is not, and the change is a
no-op on current Mautic where no such validation exists yet.

Summary by CodeRabbit

  • Tests
    • Updated email test fixtures to use customHtml instead of body where applicable.

CampaignsTest creates its email with a 'body' key, which is not an email
API property and is silently ignored, so the published email carries no
content at all. MessagesTest creates the email channel with name and
subject only. Use customHtml in both fixtures so the emails describe a
real sendable email, as EmailsTest already does.

Refs mautic/mautic#17006, which validates on create/update that an
active email has HTML or plain-text content; these fixtures then
describe what they were always meant to describe.
@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The campaign and message API test fixtures now use customHtml for email payloads. Other fixture fields remain.

Changes: Email test fixtures

Layer / File(s) Summary
Update email fixture payloads
tests/Api/CampaignsTest.php, tests/Api/MessagesTest.php
The campaign fixture replaces body with customHtml. The message fixture adds customHtml with value test; other channel fields remain.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Suggested reviewers: escopecz

Merge Risk: Minimal · up to 0ab1d

This updates API test fixtures so the test emails have HTML content. It has no production behavior impact and is safe to merge.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Give the API test emails a usable body" matches the main change. The PR changes the email test fixtures in CampaignsTest and MessagesTest to use customHtml, so the emails have a usable HTML…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "Give the API test emails a usable body" matches the main change. The PR changes the email test fixtures in CampaignsTest and MessagesTest to use customHtml, so the emails have a usable HTML body. The title is specific, short, and describes the primary intent. It does not name the field (customHtml) or the mautic/mautic#17006 validation, but it does not need to cover every detail.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 24d4eec3-583a-4046-9406-141cc18b33d9
Commits

Reviewing files that changed from the base of the PR and between da215f1 and 0ab1d1b.

Files selected for processing: 2

  • tests/Api/CampaignsTest.php
  • tests/Api/MessagesTest.php

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

@santhiprakash

santhiprakash commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks for merging this, and for adding me to the contributors list. For the record: I closed it by mistake during a repository cleanup on my side, and you were right to reopen it - the change is small and the test is the whole point of it.

@escopecz

Copy link
Copy Markdown
Member

Hey, busy week here. I didn't get to this notification in time. If you don't mind I'll reopen and merge.

@escopecz escopecz reopened this Nov 20, 2026

@escopecz escopecz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good change. Just tests, no production file change.

@escopecz

Copy link
Copy Markdown
Member

@all-contributors please add @santhiprakash for code

@escopecz
escopecz merged commit 55747df into mautic:main Nov 20, 2026
5 checks passed
@allcontributors

Copy link
Copy Markdown
Contributor

@escopecz

I've put up a pull request to add @santhiprakash! 🎉

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