Exemplo n.º 1
0
 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));
 }
Exemplo n.º 2
0
 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));
     }
 }
Exemplo n.º 3
0
 /**
  * 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());
 }
Exemplo n.º 4
0
 /**
  * Set this user's alert setting
  * 
  * @param integer $setting
  * @return User
  */
 public function setAlertSetting($setting)
 {
     AlertSetting::isValid($setting);
     $this->alertSetting = $setting;
     return $this;
 }