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:
phpnut 2007-07-08 02:03:52 +00:00
parent 16332140bf
commit b2805cff95

View file

@ -49,11 +49,17 @@ class EmailTest extends CakeTestCase {
}
function testBadSmtpSend() {
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() {
if(@fsockopen('localhost', 25)) {
$this->assertTrue(@fsockopen('localhost', 25), "Local mail server is running");
$this->Controller->Email->reset();
$this->Controller->Email->to = 'chartjes@localhost';
@ -64,6 +70,6 @@ class EmailTest extends CakeTestCase {
$this->Controller->Email->template = null;
$this->assertTrue($this->Controller->Email->send("This is the body of the message"));
}
}
}
?>