-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
1,125 additions
and
521 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,28 @@ | ||
# MailHog Service Provider for the Codeception Email Testing Framework | ||
# Mailpit Module for the Codeception Testing Framework | ||
|
||
This Codeception Module implements the required methods to test emails using the [Codeception Email Testing Framework][CodeceptionEmailTestingFramework] with [MailHog] | ||
This codeception module can be used to run tests against your [Mailpit](https://github.com/axllent/mailpit) instance. | ||
|
||
Mailpit was inspired by MailHog, which is not developed anymore. Because it is not a 1:1 replacement, the API changed | ||
and existing MailHog codeception modules cannot be used anymore. | ||
|
||
This codeception module is based on [oqq/codeception-email-mailhog](https://github.com/oqq/codeception-email-mailhog) | ||
(wich is a fork of [ericmartel/codeception-email-mailhog](https://github.com/ericmartel/codeception-email-mailhog)) and | ||
brings nearly the same functionality for Mailpit as the mentioned modules did for MailHog. | ||
|
||
### Installation | ||
Through composer, require the package: | ||
``` | ||
"require-dev": { | ||
"oqq/codeception-email-mailhog": "^2.0" | ||
} | ||
composer req koehnlein/codeception-email-mailpit --dev | ||
``` | ||
Then turn it on in your Codeception suite yaml file | ||
``` | ||
class_name: FunctionalTester | ||
modules: | ||
enabled: | ||
- MailHog | ||
- Mailpit | ||
config: | ||
MailHog: | ||
url: 'http://mailhog.dev' | ||
Mailpit: | ||
url: 'http://mailpit.dev' | ||
port: '8025' | ||
``` | ||
Additional parameters can be fed directly to the Guzzle connection using the `guzzleRequestOptions` variable. | ||
|
@@ -28,11 +33,11 @@ This Module adds a few public methods for the user, such as: | |
``` | ||
deleteAllEmails() | ||
``` | ||
Deletes all emails in MailHog | ||
Deletes all emails in Mailpit | ||
``` | ||
fetchEmails() | ||
``` | ||
Fetches all email headers from MailHog, sorts them by timestamp and assigns them to the current and unread inboxes | ||
Fetches all email headers from Mialpit, sorts them by timestamp and assigns them to the current and unread inboxes | ||
``` | ||
accessInboxFor($address) | ||
``` | ||
|
@@ -50,13 +55,13 @@ $I = new FunctionalTester($scenario); | |
$I->am('a member'); | ||
$I->wantTo('request a reset password link'); | ||
// First, remove all existing emails in the MailHog inbox | ||
// First, remove all existing emails in the Mailpit inbox | ||
$I->deleteAllEmails(); | ||
// Implementation is up to the user, use this as an example | ||
$I->requestAPasswordResetLink(); | ||
// Query MailHog and fetch all available emails | ||
// Query Mailpit and fetch all available emails | ||
$I->fetchEmails(); | ||
// This is optional, but will filter the emails in case you're sending multiple emails or use the BCC field | ||
|
@@ -74,32 +79,8 @@ $I->dontHaveUnreadEmails(); | |
// Validate the content of the opened email, all of these operations are performed on the same email | ||
$I->seeInOpenedEmailSubject('Your Password Reset Link'); | ||
$I->seeInOpenedEmailBody('Follow this link to reset your password'); | ||
$I->seeInOpenedEmailTextBody('Follow this link to reset your password'); | ||
$I->seeInOpenedEmailHtmlBody('<a href="https://www.example.org/">Follow this link to reset your password</a>'); | ||
$I->seeInOpenedEmailRecipients('[email protected]'); | ||
``` | ||
|
||
### License | ||
Copyright (c) 2015-2016 Eric Martel, http://github.com/ericmartel <[email protected]> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. | ||
|
||
[MailHog]: https://github.com/mailhog/MailHog | ||
[CodeceptionEmailTestingFramework]: https://github.com/ericmartel/codeception-email | ||
|
||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "oqq/codeception-email-mailhog", | ||
"description": "Provides test helpers for Codeception when testing email functionality with MailHog", | ||
"name": "koehnlein/codeception-email-mailpit", | ||
"description": "Provides test helpers for Codeception when testing email functionality with Mailpit", | ||
"license": "MIT", | ||
"authors": [ | ||
{ | ||
|
@@ -14,17 +14,21 @@ | |
{ | ||
"name": "Eric Braun", | ||
"email": "[email protected]" | ||
}, | ||
{ | ||
"name": "Albrecht Köhnlein", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"require": { | ||
"php": "8.1.* | 8.2.*", | ||
"ext-json": "*", | ||
"ericmartel/codeception-email": "^1.0.3", | ||
"guzzlehttp/guzzle": "^6.1 | ^7.0" | ||
}, | ||
"require-dev": { | ||
"codeception/codeception": "^5.0", | ||
"friendsofphp/php-cs-fixer": "^3.0", | ||
"http-interop/http-factory-guzzle": "^1.2", | ||
"phpunit/phpunit": "^9.5", | ||
"roave/security-advisories": "dev-latest" | ||
}, | ||
|
Oops, something went wrong.