_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:----dCex0qMCAYd7r04EiWnANmLTd6J5qqutHuLNk+LuqByBf2JeVVyGHIaqPK0ERinIgIBvP7BrwdsJxcgjaPaY8ZDQ179M4o8PqsrgVnoqCERn1ECHKNgEDl0ZgKdlWv4L+bkijAhruxn6MXa1ASgAMvkv8wLfoM3xrHovlYCCwBsXg9394e5aPL2yFOeHE+05eLp+ynrxZIrtPx7xq2+vhRbIX50NSaQ4vJ1WdoKDm+7GIcHennoOpW6YwUDeO9wQq9cQvqWL/s6Vf2Ky2jPRPh+KOa/PwAUCsf35t+Ou/XAo5lGJBU5G7sEKdxuhKo+a+suN88FxYsLvWtVCzoTqc35Z4KruRmeqrlx+B2jSthBsS+kFMks5rd5NhS+Dt+dAa6sYNU54/QyCcQi6A9W0iMBkD8KmHqgujWXu06DFJnwXjeyQBKScvhc42HuJC4HCbKsiPXfd5seTtB6TJDNbl/7u24bFlG/eenZ5xI+cCSo26T7BBtiGd2HDYOcV2OAPyvimG74XWfwUOAEDl5ijVjAv2L7B86kIFfMHHLVclbYQyMu7ebr+BdnJkYELDeI1+Bv4FlWP8ZBkagkGbLrnOqj2nMjkwUiqULtssoJM55qtDoXwfGvlSqsQfcd2+7beZPzbmRPA0iFp+s7h6iob6HgHlbcCIr8110s0ftfA/zs=----ATTACHMENT:----NzEzMDQzMzc2OTA1MzQ2MCA2MTg5NzQ5OTE0ODQ1OTYyIDMzNTMxNTMwNjkxNTE3MDg=