From ca1f9e800e1199797b8af5b4076ad6fd755bdc07 Mon Sep 17 00:00:00 2001 From: mark_story Date: Thu, 23 May 2013 09:47:24 -0400 Subject: [PATCH] Make CakeEmail::config() merge configuration. This allows you to incremementally overwrite configuration and better matches other config methods in CakePHP. Fixes #3848 --- lib/Cake/Network/Email/CakeEmail.php | 2 +- lib/Cake/Test/Case/Network/Email/CakeEmailTest.php | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Network/Email/CakeEmail.php b/lib/Cake/Network/Email/CakeEmail.php index e06ff6c5c..27849c148 100644 --- a/lib/Cake/Network/Email/CakeEmail.php +++ b/lib/Cake/Network/Email/CakeEmail.php @@ -1138,7 +1138,7 @@ class CakeEmail { } $config = $configs->{$config}; } - $this->_config += $config; + $this->_config = array_merge($this->_config, $config); if (!empty($config['charset'])) { $this->charset = $config['charset']; } diff --git a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php index 41878f138..87be7d57e 100644 --- a/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php +++ b/lib/Cake/Test/Case/Network/Email/CakeEmailTest.php @@ -718,6 +718,11 @@ class CakeEmailTest extends CakeTestCase { $this->CakeEmail->config(array()); $this->assertSame($transportClass->config(), array()); + + $config = array('test' => 'test@example.com'); + $this->CakeEmail->config($config); + $expected = array('test' => 'test@example.com', 'test2' => true); + $this->assertSame($expected, $this->CakeEmail->config()); } /**