Exemplo n.º 1
0
 private function setActionKilled()
 {
     $this->bot->onPrivateMessage("/killed/", function ($response) {
         //do validation to make sure it came from authorized user
         $this->bot->askStop();
     });
 }
Exemplo n.º 2
0
 public function testOnPrivate()
 {
     $this->if($dispatcher = new \mock\Symfony\Component\EventDispatcher\EventDispatcher())->and($object = new TestedClass(array(), $dispatcher))->and($pattern = uniqid())->and($callback = function () {
     })->and($listener = new \Philip\EventListener($pattern, $callback))->then->object($object->onPrivateMessage($pattern, $callback))->isIdenticalTo($object)->mock($dispatcher)->call('addListener')->withArguments('message.private', array($listener, 'testAndExecute'), 0)->once();
 }