Browse Source

Merge pull request #7467 from davidyell/default-email-config

Fixed the reading of the default email profile
ADmad 10 years ago
parent
commit
5909354857
2 changed files with 3 additions and 1 deletions
  1. 1 1
      src/Mailer/Email.php
  2. 2 0
      tests/TestCase/Mailer/EmailTest.php

+ 1 - 1
src/Mailer/Email.php

@@ -346,7 +346,7 @@ class Email implements JsonSerializable, Serializable
             ->helpers(['Html']);
 
         if ($config === null) {
-            $config = Configure::read('Email.default');
+            $config = static::config('default');
         }
         if ($config) {
             $this->profile($config);

+ 2 - 0
tests/TestCase/Mailer/EmailTest.php

@@ -987,9 +987,11 @@ class EmailTest extends TestCase
     {
         $config = ['test' => 'ok', 'test2' => true];
         Configure::write('Email.default', $config);
+        Email::config(Configure::consume('Email'));
         $Email = new Email();
         $this->assertSame($Email->profile(), $config);
         Configure::delete('Email');
+        Email::drop('default');
     }
 
     /**