浏览代码

Set debug transport by default in test mode.

mscherer 5 年之前
父节点
当前提交
e96a2630ae
共有 1 个文件被更改,包括 11 次插入0 次删除
  1. 11 0
      src/Mailer/Mailer.php

+ 11 - 0
src/Mailer/Mailer.php

@@ -40,6 +40,17 @@ class Mailer extends CakeMailer {
 	protected $debug = [];
 	protected $debug = [];
 
 
 	/**
 	/**
+	 * @param array|string|null $config Array of configs, or string to load configs from app.php
+	 */
+	public function __construct($config = null) {
+		if ($config === null && Configure::read('Config.live') === false) {
+			$config = 'test';
+		}
+
+		parent::__construct($config);
+	}
+
+	/**
 	 * Magic method to forward method class to Message instance.
 	 * Magic method to forward method class to Message instance.
 	 *
 	 *
 	 * @param string $method Method name.
 	 * @param string $method Method name.