mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 09:06:17 +00:00
Skipping EmailTest::testBadSmtpSend() and EmailTest::testSmtpSend() if suite can not connect to smtp
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@5396 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
16332140bf
commit
b2805cff95
1 changed files with 18 additions and 12 deletions
|
@ -49,21 +49,27 @@ class EmailTest extends CakeTestCase {
|
|||
}
|
||||
|
||||
function testBadSmtpSend() {
|
||||
$this->Controller->Email->smtpOptions['host'] = 'blah';
|
||||
$this->assertFalse($this->Controller->Email->send('Should not work'));
|
||||
if(@fsockopen('localhost', 25)) {
|
||||
$this->skipUnless(@fsockopen('localhost', 25), 'Must be able to connect to localhost port');
|
||||
$this->Controller->Email->smtpOptions['host'] = 'blah';
|
||||
$this->assertFalse($this->Controller->Email->send('Should not work'));
|
||||
} else {
|
||||
$this->skipUnless(@fsockopen('localhost', 25), 'Must be able to connect to localhost port');
|
||||
}
|
||||
}
|
||||
|
||||
function testSmtpSend() {
|
||||
$this->assertTrue(@fsockopen('localhost', 25), "Local mail server is running");
|
||||
$this->Controller->Email->reset();
|
||||
$this->Controller->Email->to = 'chartjes@localhost';
|
||||
$this->Controller->Email->subject = 'Cake SMTP test';
|
||||
$this->Controller->Email->replyTo = 'noreply@example.com';
|
||||
$this->Controller->Email->from = 'noreply@example.com';
|
||||
$this->Controller->Email->delivery = 'smtp';
|
||||
$this->Controller->Email->template = null;
|
||||
$this->assertTrue($this->Controller->Email->send("This is the body of the message"));
|
||||
if(@fsockopen('localhost', 25)) {
|
||||
$this->assertTrue(@fsockopen('localhost', 25), "Local mail server is running");
|
||||
$this->Controller->Email->reset();
|
||||
$this->Controller->Email->to = 'chartjes@localhost';
|
||||
$this->Controller->Email->subject = 'Cake SMTP test';
|
||||
$this->Controller->Email->replyTo = 'noreply@example.com';
|
||||
$this->Controller->Email->from = 'noreply@example.com';
|
||||
$this->Controller->Email->delivery = 'smtp';
|
||||
$this->Controller->Email->template = null;
|
||||
$this->assertTrue($this->Controller->Email->send("This is the body of the message"));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
Loading…
Add table
Reference in a new issue