public function testonBeforeClientCreateForumTopic() { $parameters = array('ip' => '127.0.0.1', 'message' => 'TestUnit', 'client_id' => 1); $event = new Box_Event(null, 'any', $parameters, $this->api_admin); $event->setDi($this->di); $object = new \Box\Mod\Spamchecker\Service(); $object->onBeforeClientCreateForumTopic($event); }
public function testEvents() { $service = new \Box\Mod\Client\Service(); $service->setDi($this->di); $params = array('id' => 1, 'password' => 'qwerty123'); $event = new Box_Event(null, 'name', $params, $this->api_admin, $this->api_guest); $event->setDi($this->di); $bool = $service->onAfterClientSignUp($event); $this->assertTrue($bool); }
public function testEvents() { $service = new Box\Mod\Example\Service(); $params = array('ip' => '123.123.123.123'); $event = new Box_Event(null, 'name', $params, $this->api_admin, $this->api_guest); $event->setDi($this->di); $result = $service->onEventClientLoginFailed($event); $this->assertNull($result); $params = array('client_id' => 1, 'id' => 1); $event = new Box_Event(null, 'name', $params, $this->api_admin, $this->api_guest); $event->setDi($this->di); $result = $service->onAfterClientOrderCreate($event); $this->assertNull($result); }
public function testEvents() { $service = new \Box\Mod\Invoice\Service(); $service->setDi($this->di); $params = array('id' => 1); $event = new Box_Event(null, 'name', $params, $this->api_admin, $this->api_guest); $event->setDi($this->di); $bool = $service->onAfterAdminInvoicePaymentReceived($event); $this->assertTrue($bool); $params = array('id' => 1); $event = new Box_Event(null, 'name', $params, $this->api_admin, $this->api_guest); $event->setDi($this->di); $bool = $service->onAfterAdminInvoiceApprove($event); $this->assertTrue($bool); }
public function fire($data) { if (!isset($data['event']) || empty($data['event'])) { error_log('Invoked event call without providing event name'); return false; } $event = $data['event']; $subject = isset($data['subject']) ? $data['subject'] : null; $params = isset($data['params']) ? $data['params'] : null; if (BB_DEBUG) { $this->di['logger']->debug($event . ': ' . var_export($params, 1)); } $e = new Box_Event($subject, $event, $params); $e->setDi($this->di); $disp = new Box_EventDispatcher(); $this->_connectDatabaseHooks($disp, $e->getName()); $disp->notify($e); return $e->getReturnValue(); }