private function setActionKilled() { $this->bot->onPrivateMessage("/killed/", function ($response) { //do validation to make sure it came from authorized user $this->bot->askStop(); }); }
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(); }