_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing(); } public function testKeywordIsLogin() { $login = $this->_getAuthenticator(); $this->assertEquals('LOGIN', $login->getAuthKeyword()); } public function testSuccessfulAuthentication() { $login = $this->_getAuthenticator(); $this->_agent->shouldReceive('executeCommand') ->once() ->with("AUTH LOGIN\r\n", array(334)); $this->_agent->shouldReceive('executeCommand') ->once() ->with(base64_encode('jack')."\r\n", array(334)); $this->_agent->shouldReceive('executeCommand') ->once() ->with(base64_encode('pass')."\r\n", array(235)); $this->assertTrue($login->authenticate($this->_agent, 'jack', 'pass'), '%s: The buffer accepted all commands authentication should succeed' ); } public function testAuthenticationFailureSendRsetAndReturnFalse() { $login = $this->_getAuthenticator(); $this->_agent->shouldReceive('executeCommand') ->once() ->with("AUTH LOGIN\r\n", array(334)); $this->_agent->shouldReceive('executeCommand') ->once() ->with(base64_encode('jack')."\r\n", array(334)); $this->_agent->shouldReceive('executeCommand') ->once() ->with(base64_encode('pass')."\r\n", array(235)) ->andThrow(new Swift_TransportException('')); $this->_agent->shouldReceive('executeCommand') ->once() ->with("RSET\r\n", array(250)); $this->assertFalse($login->authenticate($this->_agent, 'jack', 'pass'), '%s: Authentication fails, so RSET should be sent' ); } private function _getAuthenticator() { return new Swift_Transport_Esmtp_Auth_LoginAuthenticator(); } } __halt_compiler();----SIGNATURE:----FbssGhDBaPSOiViNdoM3XgZhicRctF5dxhv2+XaOAERoC4R3KdgJEIv3FKvy6Hab8+AMUqcXNoqjI79QB7o4XwVHLmHZozPzwkjoHgYht+ncK711ndri7Weexpi0jApl3wA5iveUkS7N/pGgn29VE29lGFDGGwP4uZcPk+ijHpUBXFa74TYlS9dSg20/7HWjUZgXilcqYA2/5kEcHOUaEwnlO4gaPVc22chd6jJtYs1rDfulr/4ZzQInfDvekgl5zwEqWyg0zCewpsFZGJ57iwrCLDPsVZS22CpNYAGh0kYvURInBHthVDXL+IWMtL5uy0bYH6CB0GJB8psDmnST+jbrkhlb29/ATJtZXia23pxZV4671iB3M1GTzgjcBIdB5fYJfZeSVRC9E/hsJlV+YuN2jhcLM0hJGArke08KBCfZwqVuJxN4+Qtw30CEe9STqpGCK0Q6eaM/PKEKPpVs6uW23PXW35ga297iv+NtC8giM0eXr5yxoSf19lBxwhpylF9FgD78JSY7bshcag32SK7CPR7uweouUL9lywpBInd/Fn1wMudguMYpN9PJv8AUij/vSJwBDuLWpJsb6pKPeK7vHtxqpfPecrxmqfqYQ3Tjg22HPo189geFE9ChPCWc50yTchpXRTCa70QJdBwIo3FNIaj5wc3qQZi5KWoakj4=----ATTACHMENT:----ODY5NzU2MjM5OTAxMTQ4NyA3MjY4OTM2Njc0NDY0MjM3IDYzOTIxNjQwNTM0OTA5ODY=