Skip to content
Permalink
Browse files

Apply ADmad's patch and update testConfig method according to a new s…

…pecification.
  • Loading branch information...
fuga committed Aug 13, 2013
1 parent 303261e commit 245611424fd39e727ec3e53d7fedf60187755533
Showing with 45 additions and 1 deletion.
  1. +45 −1 lib/Cake/Test/Case/Network/Email/CakeEmailTest.php
@@ -95,6 +95,20 @@ class EmailConfig {
'helpers' => array('Html', 'Form'),
);
/**
* test config 2
*
* @var string
*/
public $test2 = array(
'from' => array('some@example.com' => 'My website'),
'to' => array('test@example.com' => 'Testname'),
'subject' => 'Test mail subject',
'transport' => 'Smtp',
'host' => 'cakephp.org',
'timeout' => 60
);
}
/*
@@ -726,12 +740,13 @@ public function testConfig() {
$this->assertSame($this->CakeEmail->config(), $config);
$this->CakeEmail->config(array());
$this->assertSame($transportClass->config(), array());
$this->assertSame($transportClass->config(), $config);
$config = array('test' => 'test@example.com');
$this->CakeEmail->config($config);
$expected = array('test' => 'test@example.com', 'test2' => true);
$this->assertSame($expected, $this->CakeEmail->config());
$this->assertSame($expected, $transportClass->config());
}
/**
@@ -765,6 +780,35 @@ public function testConfigString() {
$this->assertEquals($configs->test['helpers'], $result);
}
/**
* Test updating config doesn't reset transport's config.
*
* @return void
*/
public function testConfigMerge() {
$this->CakeEmail->config('test2');
$expected = array(
'host' => 'cakephp.org',
'port' => 25,
'timeout' => 60,
'username' => null,
'password' => null,
'client' => null,
'tls' => false
);
$this->assertEquals($expected, $this->CakeEmail->transportClass()->config());
$this->CakeEmail->config(array('log' => true));
$result = $this->CakeEmail->transportClass()->config();
$expected += array('log' => true);
$this->assertEquals($expected, $this->CakeEmail->transportClass()->config());
$this->CakeEmail->config(array('timeout' => 45));
$result = $this->CakeEmail->transportClass()->config();
$this->assertEquals(45, $result['timeout']);
}
/**
* testSendWithContent method
*

0 comments on commit 2456114

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