/**
  * @test
  * @group security
  * @group security1
  */
 public function testIsGrantedToProcess()
 {
     //Nouvelle demande
     $demand = new Demand();
     //On récupère le service security
     $security = $this->container->get('grdf.defaultbundle.security');
     //On récupère le service
     $this->assertNotEquals(true, $security->hasDemandStatus($demand, array(DemandStatusEnum::TO_VALIDATE)));
     //Ensuite on rend la demande à valider
     $demand->setStatus(DemandStatusEnum::getKey(DemandStatusEnum::TO_VALIDATE));
     //On voit maintenant si c'est égal
     $this->assertEquals(true, $security->hasDemandStatus($demand, array(DemandStatusEnum::TO_VALIDATE)));
     //On teste maintenant si la demande à des valideurs, operateurs etc...
     $this->assertNotEquals(true, $security->isValideur($demand));
     $this->assertNotEquals(true, $security->isOperateur($demand));
 }
 private function prepareDemandsWithAlert()
 {
     $dmds = array();
     $dmds[] = $this->createDemand('@toutPrisca', DemandStatusEnum::getKey(DemandStatusEnum::TO_VALIDATE));
     $dmds[] = $this->createDemand('ATLAS', DemandStatusEnum::getKey(DemandStatusEnum::TO_PROCESS));
     $dmds[] = $this->createDemand('ATLAS', DemandStatusEnum::getKey(DemandStatusEnum::TO_PROCESS));
     $dmds[] = $this->createDemand('RAPSODIE', DemandStatusEnum::getKey(DemandStatusEnum::TO_ANALYZE));
     $dmds[] = $this->createDemand('RAPSODIE', DemandStatusEnum::getKey(DemandStatusEnum::TO_ANALYZE));
     $dmds[] = $this->createDemand('RAPSODIE', DemandStatusEnum::getKey(DemandStatusEnum::TO_ANALYZE));
     $dmds[0]->getLogAlert()->setAlertToValidateAdmin(1)->setUpdatedAt(new \DateTime());
     $dmds[1]->getLogAlert()->setAlertToProcessAdmin(1)->setUpdatedAt(new \DateTime());
     $dmds[2]->getLogAlert()->setAlertToProcessPOA(1)->setUpdatedAt(new \DateTime());
     $dmds[3]->getLogAlert()->setAlertToAnalyzePOA(1)->setUpdatedAt(new \DateTime());
     $dmds[4]->getLogAlert()->setAlertToAnalyzePOA(1)->setUpdatedAt(new \DateTime());
     $dmds[5]->getLogAlert()->setAlertToAnalyzeAdmin(1)->setUpdatedAt(new \DateTime());
     foreach ($dmds as $dmd) {
         $this->em->persist($dmd);
     }
     $this->em->flush();
 }