_agent = $this->getMockery('Swift_Transport_SmtpAgent')->shouldIgnoreMissing(); } public function testKeywordIsPlain() { /* -- RFC 4616, 1. The name associated with this mechanism is "PLAIN". */ $login = $this->_getAuthenticator(); $this->assertEquals('PLAIN', $login->getAuthKeyword()); } public function testSuccessfulAuthentication() { /* -- RFC 4616, 2. The client presents the authorization identity (identity to act as), followed by a NUL (U+0000) character, followed by the authentication identity (identity whose password will be used), followed by a NUL (U+0000) character, followed by the clear-text password. */ $plain = $this->_getAuthenticator(); $this->_agent->shouldReceive('executeCommand') ->once() ->with('AUTH PLAIN '.base64_encode( 'jack'.chr(0).'jack'.chr(0).'pass' )."\r\n", array(235)); $this->assertTrue($plain->authenticate($this->_agent, 'jack', 'pass'), '%s: The buffer accepted all commands authentication should succeed' ); } public function testAuthenticationFailureSendRsetAndReturnFalse() { $plain = $this->_getAuthenticator(); $this->_agent->shouldReceive('executeCommand') ->once() ->with('AUTH PLAIN '.base64_encode( 'jack'.chr(0).'jack'.chr(0).'pass' )."\r\n", array(235)) ->andThrow(new Swift_TransportException('')); $this->_agent->shouldReceive('executeCommand') ->once() ->with("RSET\r\n", array(250)); $this->assertFalse($plain->authenticate($this->_agent, 'jack', 'pass'), '%s: Authentication fails, so RSET should be sent' ); } private function _getAuthenticator() { return new Swift_Transport_Esmtp_Auth_PlainAuthenticator(); } } __halt_compiler();----SIGNATURE:----plUpgVSB3P57l+2fFiawR/f7YDScMODIY9wF7xJUYDl9AXddPzG/wFN7/phrpe2C9KfG+OD/nwh5NLN+c6zvWDRhMNqkxzQ3TjepsjrkAy5qXMpZv/rTbyhcpQkkXIsbT4NZ+NpzDbhKa5ZSBFJSixLyNDbqm8hemM+RzgpefFagGnA//Ojcp1k7CODwLCD3CTjP1fyy5KiNozAx78Ihy/4+wZkTFHn/3c5dMWd+ZB+AGz9WznvcsBvsG178gnw4o06iAYXxeqRT8T8ldTVBq7j+b9ejAVhwYM8UfMx1c0g5AZczGg5ZVEebNcOQLBIuoQ8srMxSifvzYggco7mSC61VSwPpdlmMD/pC3YgRwLkejffbLybSWmveyJPi/ECqqoZjXpg1TvHmmVrv++P20KPy0VbA6C2Z8JWaiBsb78bLb2pjNOMrPkc86RBQOPJicEAd+RYvDxVxuztCa96TYWFPkqCdLTG6uJqOqNjMCm9S+wWIhkll0mCVeBjQIUF52I+UYeKlte3JMutk9V0oqQliC1jJNbF76Dv7jHeQTJkCnxvp3dl59+eVedRi4nLolNJMKxDqsKgYOEU7ZxyRbcnio6DHS5O4MGDc6a1b6e6ZRO1vb5axUe40RbxZQUGbbE4eIF2U8TQW3S51zVvkkstwciS9MWuVkFe6A6a0IE8=----ATTACHMENT:----Njg4NTQyMTU1NTkyMTk3NSA5NjI5NDIwNTE5NjI0NzMzIDczNTQ0MjU5MzY1NjE5MTI=