コード例 #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));
 }
コード例 #2
0
ファイル: UserTest.php プロジェクト: amyboyd/overwatch
 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));
     }
 }
コード例 #3
0
ファイル: ApiController.php プロジェクト: amyboyd/overwatch
 /**
  * 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());
 }
コード例 #4
0
ファイル: User.php プロジェクト: amyboyd/overwatch
 /**
  * Set this user's alert setting
  * 
  * @param integer $setting
  * @return User
  */
 public function setAlertSetting($setting)
 {
     AlertSetting::isValid($setting);
     $this->alertSetting = $setting;
     return $this;
 }