public function testGetAlertSettings() { $this->logIn("ROLE_USER"); $this->client->request('GET', '/api/alertSettings'); $this->assertJsonResponse($this->client->getResponse()); $this->assertJsonStringEqualsJsonString(json_encode(AlertSetting::getAll()), $this->getResponseContent(TRUE)); }
public function testShouldBeAlertedWithUserNotInResultGroup() { $result = $this->getMockResult(TRUE, FALSE); $result->setStatus(ResultStatus::FAILED)->setInfo("Stahp shut up and take my money scumbag stacy trollface."); foreach (AlertSetting::getAll() as $setting => $description) { $this->user->setAlertSetting($setting); $this->assertFalse($this->user->shouldBeAlerted($result)); } }
/** * Returns the list of possible alert settings * * @Route("/alertSettings") * @Method({"GET"}) * @ApiDoc( * resource=true, * tags={ * "Super Admin" = "#ff1919", * "Admin" = "#ffff33", * "User" = "#75ff47" * } * ) */ public function getAlertSettings() { return new JsonResponse(AlertSetting::getAll()); }
/** * Set this user's alert setting * * @param integer $setting * @return User */ public function setAlertSetting($setting) { AlertSetting::isValid($setting); $this->alertSetting = $setting; return $this; }