From 0c3a02fa00f0df5d46294cd1469fe792c0a9f1fb Mon Sep 17 00:00:00 2001 From: Matthew Weier O'Phinney Date: Tue, 5 Feb 2013 10:50:28 -0600 Subject: [PATCH] [zendframework/zf2#3645] Added unit test - Added unit test verifying that quit() gets called --- test/Protocol/SmtpTest.php | 6 ++++++ test/TestAsset/SmtpProtocolSpy.php | 2 ++ 2 files changed, 8 insertions(+) diff --git a/test/Protocol/SmtpTest.php b/test/Protocol/SmtpTest.php index aaa19830..1784996f 100644 --- a/test/Protocol/SmtpTest.php +++ b/test/Protocol/SmtpTest.php @@ -60,4 +60,10 @@ public function testSendMinimalMail() $this->assertEquals($expectedMessage, $this->connection->getLog()); } + + public function testDisconnectCallsQuit() + { + $this->connection->disconnect(); + $this->assertTrue($this->connection->calledQuit); + } } diff --git a/test/TestAsset/SmtpProtocolSpy.php b/test/TestAsset/SmtpProtocolSpy.php index 0fcdb4d5..86877e62 100644 --- a/test/TestAsset/SmtpProtocolSpy.php +++ b/test/TestAsset/SmtpProtocolSpy.php @@ -21,6 +21,7 @@ */ class SmtpProtocolSpy extends Smtp { + public $calledQuit = false; protected $connect = false; protected $mail; protected $rcptTest = array(); @@ -44,6 +45,7 @@ public function helo($serverName = '127.0.0.1') public function quit() { + $this->calledQuit = true; parent::quit(); }