Author: Gawain Lynch (gawain.lynch@gmail.com)
Exemplo n.º 1
0
 public function testResetPasswordRequestSendFailure()
 {
     $app = $this->getApp();
     $this->addDefaultUser($app);
     $app['config']->set('general/mailoptions', ['transport' => 'smtp', 'spool' => true, 'host' => 'localhost', 'port' => '25']);
     $logger = $this->getMock('\\Bolt\\Logger\\FlashLogger', ['error']);
     $logger->expects($this->atLeastOnce())->method('error')->with($this->equalTo('Failed to send password request. Please check the email settings.'));
     $app['logger.flash'] = $logger;
     $logger = $this->getMock('\\Monolog\\Logger', ['error'], ['testlogger']);
     $logger->expects($this->atLeastOnce())->method('error')->with($this->equalTo("Failed to send password request sent to 'Admin'."));
     $app['logger.system'] = $logger;
     $mailer = $this->getMock('\\Swift_Mailer', ['send'], [$app['swiftmailer.transport']]);
     $mailer->expects($this->atLeastOnce())->method('send')->will($this->returnValue(false));
     $app['mailer'] = $mailer;
     $event = new AccessControlEvent(Request::createFromGlobals());
     $password = new Password($app);
     $result = $password->resetPasswordRequest('admin', '8.8.8.8', $event);
     $this->assertTrue($result);
 }
Exemplo n.º 2
0
 public function testResetPasswordRequestSendFailure()
 {
     $app = $this->getApp();
     $this->addDefaultUser($app);
     $app['config']->set('general/mailoptions', ['transport' => 'smtp', 'spool' => true, 'host' => 'localhost', 'port' => '25']);
     $logger = $this->getMock('\\Bolt\\Logger\\FlashLogger', ['error']);
     $logger->expects($this->atLeastOnce())->method('error');
     $app['logger.flash'] = $logger;
     $logger = $this->getMock('\\Monolog\\Logger', ['error'], ['testlogger']);
     $logger->expects($this->atLeastOnce())->method('error');
     $app['logger.system'] = $logger;
     $mailer = $this->getMock('\\Swift_Mailer', array('send'), array($app['swiftmailer.transport']));
     $mailer->expects($this->atLeastOnce())->method('send')->will($this->returnValue(false));
     $app['mailer'] = $mailer;
     $password = new Password($app);
     $result = $password->resetPasswordRequest('admin', '8.8.8.8');
     $this->assertTrue($result);
 }