1515
1616use App \Http \Utils \Filters \DoctrineInFilterMapping ;
1717use App \Http \Utils \Filters \DoctrineNotInFilterMapping ;
18+ use App \Models \Foundation \Summit \PromoCodes \PromoCodesConstants ;
19+ use App \Rules \Boolean ;
1820use Doctrine \ORM \Query \Expr \Join ;
1921use models \summit \Presentation ;
2022use models \summit \PresentationType ;
@@ -755,4 +757,52 @@ public function testFilterRegistrationInvitations(){
755757 $ this ->assertEquals ("SELECT DISTINCT e FROM models\summit\SummitRegistrationInvitation e WHERE ( ( e.hash is not null ) ) AND e.id NOT IN ( :value_1 ) AND e.id IN ( :value_2 ) " , $ dql );
756758 $ res = $ query ->getQuery ()->getResult ();
757759 }
760+
761+ public function testDuplicateCriteria (){
762+ $ filter = FilterParser::parse ([
763+ 'owner_email==cespin+174@gmail.com ' ,
764+ 'code=@cespin+174@gmail.com,creator=@cespin+174@gmail.com,creator_email=@cespin+174@gmail.com,owner=@cespin+174@gmail.com,owner_email=@cespin+174@gmail.com,speaker=@cespin+174@gmail.com,speaker_email=@cespin+174@gmail.com,sponsor_company_name=@cespin+174@gmail.com '
765+ ],
766+ [
767+ 'code ' => ['@@ ' , '=@ ' , '== ' ],
768+ 'description ' => ['@@ ' , '=@ ' ],
769+ 'notes ' => ['@@ ' , '=@ ' ],
770+ 'creator ' => ['@@ ' , '=@ ' , '== ' ],
771+ 'creator_email ' => ['@@ ' , '=@ ' , '== ' ],
772+ 'owner ' => ['@@ ' , '=@ ' , '== ' ],
773+ 'owner_email ' => ['@@ ' , '=@ ' , '== ' ],
774+ 'speaker ' => ['@@ ' , '=@ ' , '== ' ],
775+ 'speaker_email ' => ['@@ ' , '=@ ' , '== ' ],
776+ 'class_name ' => ['== ' ],
777+ 'type ' => ['== ' ],
778+ 'tag ' => ['@@ ' ,'=@ ' , '== ' ],
779+ 'tag_id ' => ['== ' ],
780+ 'sponsor_company_name ' => ['@@ ' , '=@ ' , '== ' ],
781+ 'sponsor_id ' => ['== ' ],
782+ 'contact_email ' => ['@@ ' , '=@ ' , '== ' ],
783+ 'tier_name ' => ['@@ ' , '=@ ' , '== ' ],
784+ 'email_sent ' => ['== ' ],
785+ ]);
786+
787+ $ filter ->validate ([
788+ 'class_name ' => sprintf ('sometimes|required|in:%s ' , implode (', ' , PromoCodesConstants::$ valid_class_names )),
789+ 'code ' => 'sometimes|string ' ,
790+ 'description ' => 'sometimes|string ' ,
791+ 'notes ' => 'sometimes|string ' ,
792+ 'creator ' => 'sometimes|string ' ,
793+ 'creator_email ' => 'sometimes|string ' ,
794+ 'owner ' => 'sometimes|string ' ,
795+ 'owner_email ' => 'sometimes|string ' ,
796+ 'speaker ' => 'sometimes|string ' ,
797+ 'speaker_email ' => 'sometimes|string ' ,
798+ 'type ' => sprintf ('sometimes|in:%s ' , implode (', ' , PromoCodesConstants::getValidTypes ())),
799+ 'tag ' => 'sometimes|required|string ' ,
800+ 'tag_id ' => 'sometimes|integer ' ,
801+ 'sponsor_company_name ' => 'sometimes|string ' ,
802+ 'contact_email ' => 'sometimes|string ' ,
803+ 'sponsor_id ' => 'sometimes|integer ' ,
804+ 'tier_name ' => 'sometimes|string ' ,
805+ 'email_sent ' => ['sometimes ' , new Boolean ()],
806+ ]);
807+ }
758808}
0 commit comments