public function pushAction() { $request = $this->getRequest(); $response = $this->getResponse(); $xml = $request->getContent(); if (empty($xml)) { $response->setStatusCode(202); return $response; } $this->notificationHandler->handle($xml); $response->setStatusCode(200); return $response; }
public function testNotificationHandler() { $xml = '<new_account_notification> <account> <account_code>1</account_code> <username nil="true"></username> <email>verena@example.com</email> <first_name>Verena</first_name> <last_name>Example</last_name> <company_name nil="true"></company_name> </account> </new_account_notification>'; $handler = new NotificationHandler(); $eventManager = $this->getEventManager(); $eventManager->expects($this->once())->method('trigger')->with('new_account_notification', $this->anything()); $handler->setEventManager($eventManager); $handler->handle($xml); }