Yii2 module does not support useFileTransport for emails #3894

fillup opened this Issue Jan 4, 2017 · 1 comment


None yet

3 participants

fillup commented Jan 4, 2017 edited

What are you trying to achieve?

Before yiisoft/yii2-codeception was deprecated we used the Yii2 configuration option for usefileTransport to have messages written to disk so we can check contents and ensure as part of unit testing that it worked properly.

What do you get instead?

After migrating to Yii2 module of Codception our unit tests failed and after much debugging we found that the emails are no longer written to the filesystem. Looking at Codeception\Lib\Connector\Yii2\TestMailer it is clear the saveMessage method just calls the sendMessage method which stores the object in memory for later retrieval.

In the end, after refactoring my tests to use the $this->tester->grabSentEmails() method of getting the messages instead of reading from disk I am happier with this approach, but I wanted to open an issue in case this is not your intention or if it is to request that documentation is updated. It would be great if there was a "Migrating from yii2-codeception to Yii2 codeception module" guide.

### Details

* Codeception version: 2.2.7
* PHP Version: 7.0.8
* Operating System: Ubuntu 16.04
* Installation type: Composer

@DavertMik @samdark

@samdark samdark added the Yii label Jan 4, 2017

@fillup Hi, thanks for the report. Unfortunately I didn't work much with initial integration and so I wrote a new from scratch. There is no good reason to write emails to disk, as they are required only for a specific test. Sorry for breaking the implementation but as you tell this is a cleaner approach now.

It would be great if there was a "Migrating from yii2-codeception to Yii2 codeception module" guide.

Yes, and don't you mind if I suggest you to write this guide? Unlike me or @samdark you have a real experience migrating a tests codebase and you have an experience to share with community. Thanks.
Please write migration guide and send it to Yii or Codeception repository and we will try to publish wherever it would fit.


@DavertMik DavertMik closed this Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment