_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:----ARhESmQTC7fjPrDEeAPekSxbS3pufw/wI/ELDZM2s2kz1YWv6VUlACsOI0eOB333Mgib3LtBD+AEY6Cp0maV/Q28/o5Hyfz9IHDNg9h7xjSDKbhlv38RnInkW6Ge1qm8DQwj8HUZcg2QS63VdfmGtGjggnV49Uqi8G/rqudTI5ld3f6YauaHBlHvk00/lo+/CMKi9JkOP4d5q74MHcmqi01t7e6wTqq04lyAMZlJRVK/PCqYTIm6AFcAoH+EIOj90v66QBI4faFDBpKKtsPyRBSBV96l4wptwwez6AiZUxi/a++2YYaD9yqM4BRx83GMQO9GzHv/Zoh7mVD5KPcsgt6JdTzv4wkhPpFo6JmFPd5vlvybH6aAr6svsgFveQuDdEnzcExSFCFKtUmsVrft03e7sdu8z6KBgI2pyPQ3UgFDf5BFZFORVJneha5/aNdhFCvU7T0sDvnD/WhpRmJZvxm2/G2+W5KhP7Mf5MPYHKYzr9UbXPFJUzuptGKYNxxf0NR0P5s72DWbGwQwLUAzGMbCesu1/QmBmHTKqaKPYkUkmUe55GegJyQNfwAmMBsw6TTsnDUt7eqQQO0XKdvCWLw5X+BA6rR85NbeXkXe9wqS4qPKDY5QCUjFsoYtGaLyW/rQvoKjsVfttZFfN4c4RjPMTy7FDgceuTmNDZl0bX4=----ATTACHMENT:----MzMxMTA3ODgwMjgzMjgzMyA3Nzc2NTY4ODI0MzY5OTM5IDYwMDAwNjg0Njk2ODE0MTY=