Skip to content
Permalink
Browse files

Fix constructor options completely overwriting defaults.

Constructor arguments should augment not replace the defaults.
  • Loading branch information...
markstory committed Dec 31, 2012
1 parent 99a5f72 commit 37b9527a6ee48e28748fbc9f0bca66466ba9c38e
Showing with 8 additions and 3 deletions.
  1. +1 −1 lib/Cake/Network/Http/Client.php
  2. +7 −2 lib/Cake/Test/TestCase/Network/Http/ClientTest.php
@@ -129,7 +129,7 @@ public function __construct($config = []) {
$adapter = $config['adapter'];
unset($config['adapter']);
}
$this->_config = $config;
$this->config($config);
if (is_string($adapter)) {
$adapter = new $adapter();
@@ -34,7 +34,10 @@ public function testConstructConfig() {
'host' => 'example.org',
];
$http = new Client($config);
$this->assertEquals($config, $http->config());
$result = $http->config();
foreach ($config as $key => $val) {
$this->assertEquals($val, $result[$key]);
}
$result = $http->config([
'auth' => ['username' => 'mark', 'password' => 'secret']
@@ -47,7 +50,9 @@ public function testConstructConfig() {
'host' => 'example.org',
'auth' => ['username' => 'mark', 'password' => 'secret']
];
$this->assertEquals($expected, $result);
foreach ($config as $key => $val) {
$this->assertEquals($val, $result[$key]);
}
}
/**

0 comments on commit 37b9527

Please sign in to comment.
You can’t perform that action at this time.