Skip to content

[Fix] Test failing when mailpit enabled - #1179

Merged
RichardAnderson merged 1 commit into
vitodeploy:4.xfrom
RichardAnderson:fix/test-fail-mailpit
Jun 19, 2026
Merged

[Fix] Test failing when mailpit enabled#1179
RichardAnderson merged 1 commit into
vitodeploy:4.xfrom
RichardAnderson:fix/test-fail-mailpit

Conversation

@RichardAnderson

@RichardAnderson RichardAnderson commented Jun 19, 2026

Copy link
Copy Markdown
Member

A test was failing locally when the user had mailpit configured, as a connection to 127.0.0.1 was using the ENVs mail port, which may have been directed towards a mailpit server accepting connections.

Summary by CodeRabbit

  • Tests
    • Updated email notification testing procedures to ensure proper handling of SMTP connection failure scenarios.

@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

In NotificationChannelsTest, the test_cannot_add_email_channel SMTP failure configuration is updated: the host is changed to a loopback address and a new port 1 is added to ensure the SMTP connection always fails, even when a local mail catcher is running.

Changes

SMTP Connection Failure Test Fix

Layer / File(s) Summary
SMTP failure config update
tests/Feature/NotificationChannelsTest.php
mail.mailers.smtp.host is set to a loopback address and mail.mailers.smtp.port is set to 1 to reliably force a connection failure during the email channel test.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main issue: fixing a test that was failing when mailpit is enabled by changing SMTP configuration to use port 1 instead of environment variables.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/Feature/NotificationChannelsTest.php`:
- Around line 48-49: The test correctly configures SMTP to fail by setting the
port to a closed port, but it lacks an assertion to verify the error message
shown to the user. Add a session error assertion to validate that the
appropriate error message is stored and displayed, consistent with the pattern
used in the similar test methods test_cannot_add_slack_channel,
test_cannot_add_discord_channel, and test_cannot_add_telegram_channel. This
assertion should verify the error response contains the expected failure message
for SMTP connection issues.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 45a7e440-e922-4b62-9067-e3bb478ace8e

📥 Commits

Reviewing files that changed from the base of the PR and between e939e2f and 3d757a4.

📒 Files selected for processing (1)
  • tests/Feature/NotificationChannelsTest.php

Comment thread tests/Feature/NotificationChannelsTest.php
@RichardAnderson
RichardAnderson merged commit b2afb63 into vitodeploy:4.x Jun 19, 2026
4 checks passed
@RichardAnderson
RichardAnderson deleted the fix/test-fail-mailpit branch June 19, 2026 21:09
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