/** * Create the objects against which you will test. */ protected function setUp() { parent::setUp(); Yii::$app->mailer->fileTransportCallback = function ($mailer, $message) { return 'testing_message.eml'; }; }