Skip to content

Commit 923bf6b

Browse files
authored
Merge pull request #5 from koehnlein/feature/readme
Update readme
2 parents e3548ff + ff589cd commit 923bf6b

File tree

1 file changed

+38
-11
lines changed

1 file changed

+38
-11
lines changed

README.md

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ This codeception module is based on [oqq/codeception-email-mailhog](https://gith
99
(wich is a fork of [ericmartel/codeception-email-mailhog](https://github.com/ericmartel/codeception-email-mailhog)) and
1010
brings nearly the same functionality for Mailpit as the mentioned modules did for MailHog.
1111

12-
### Installation
12+
## Installation
1313
Through composer, require the package:
14-
```
14+
```shell
1515
composer req koehnlein/codeception-email-mailpit --dev
1616
```
1717
Then turn it on in your Codeception suite yaml file
18-
```
18+
```yaml
1919
class_name: FunctionalTester
2020
modules:
2121
enabled:
@@ -28,32 +28,33 @@ modules:
2828
Additional parameters can be fed directly to the Guzzle connection using the `guzzleRequestOptions` variable.
2929

3030
The variable `deleteEmailsAfterScenario` can be set to true to ensure that all emails are deleted at the end of each scenario, but it is turned off by default.
31-
### Added Methods
31+
32+
## Added Methods
3233
This Module adds a few public methods for the user, such as:
33-
```
34+
```php
3435
deleteAllEmails()
3536
```
3637
Deletes all emails in Mailpit
37-
```
38+
```php
3839
fetchEmails()
3940
```
4041
Fetches all email headers from Mialpit, sorts them by timestamp and assigns them to the current and unread inboxes
41-
```
42+
```php
4243
accessInboxFor($address)
4344
```
4445
Filters emails to only keep those that are received by the provided address
45-
```
46+
```php
4647
openNextUnreadEmail()
4748
```
4849
Pops the most recent unread email and assigns it as the email to conduct tests on
49-
```
50+
```php
5051
openNextAttachmentInOpenedEmail()
5152
```
5253
Pops the next attachment and assigns it as the attachment to conduct tests on
5354

54-
### Example Test
55+
## Example Test
5556
Here is a simple scenario where we test the content of an email. For a detailed list of all available test methods, please refer to the [Codeception Email Testing Framework][CodeceptionEmailTestingFramework].
56-
```
57+
```php
5758
<?php
5859
$I = new FunctionalTester($scenario);
5960
$I->am('a member');
@@ -100,3 +101,29 @@ $I->grabContentTypeFromOpenedAttachment();
100101
$I->grabSizeFromOpenedAttachment();
101102
```
102103

104+
## Migrate from MailHog Codeception Module
105+
In case you want to switch from `codeception-email-mailhog` to this module, you need to follow these small steps:
106+
107+
### Remove old MailHog module
108+
Depending on which fork of `codeception-email-mailhog` you have installed, you can uninstall it with
109+
```shell
110+
composer remove oqq/codeception-email-mailhog --dev
111+
```
112+
or
113+
```shell
114+
composer remove ericmartal/codeception-email-mailhog --dev
115+
```
116+
or maybe any other package name of the fork, you use.
117+
118+
### Add new Mailpit module instead
119+
```shell
120+
composer req koehnlein/codeception-email-mailpit --dev
121+
```
122+
123+
### Update Codeception configuration:
124+
Change module name in Codeception configuration file(s) from `MailHog` to `Mailpit`.
125+
126+
### Refactor your Cests:
127+
128+
* Search for all `$I->...EmailBody(...)` occurrences and refactor to `$I->...EmailTextBody(...)` and/or `$I->...EmailHtmlBody(...)`
129+
* The name in `$I->canSeeInOpenedEmailSender` is now encapsulated in double quotes. So if you used `$I->canSeeInOpenedEmailSender('My Name <[email protected]>')` before replace it with `$I->canSeeInOpenedEmailSender('"My Name" <[email protected]>');`

0 commit comments

Comments
 (0)