Author: Chris Corbyn
Inheritance: implements Swift_Events_SendListener, implements Swift_Plugins_Sleeper
コード例 #1
0
 public function testPluginCanSleepDuringRestart()
 {
     $sleeper = $this->_createSleeper();
     $transport = $this->_createTransport();
     $evt = $this->_createSendEvent($transport);
     $this->_checking(Expectations::create()->one($sleeper)->sleep(10)->one($transport)->start()->one($transport)->stop()->ignoring($transport));
     $plugin = new Swift_Plugins_AntiFloodPlugin(99, 10, $sleeper);
     for ($i = 0; $i < 101; $i++) {
         $plugin->sendPerformed($evt);
     }
 }
コード例 #2
0
 public function testPluginCanSleepDuringRestart()
 {
     $sleeper = $this->getMockBuilder('Swift_Plugins_Sleeper')->getMock();
     $sleeper->expects($this->once())->method('sleep')->with(10);
     $transport = $this->createTransport();
     $transport->expects($this->once())->method('start');
     $transport->expects($this->once())->method('stop');
     $evt = $this->createSendEvent($transport);
     $plugin = new Swift_Plugins_AntiFloodPlugin(99, 10, $sleeper);
     for ($i = 0; $i < 101; ++$i) {
         $plugin->sendPerformed($evt);
     }
 }