File tree Expand file tree Collapse file tree 4 files changed +29
-2
lines changed Expand file tree Collapse file tree 4 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ public function getPillDataForFilter(): array
1111        $ filters
1212
1313        foreach  ($ this getAppliedFiltersWithValuesForPills () as  $ filterKey$ value
14-             if  (! is_null ($ filter$ this getFilterByKey ($ filterKey
14+             if  (! is_null ($ filter$ this getFilterByKey ($ filterKey && ! $ filter -> isEmpty ( $ filter -> validate ( $ value )) ) {
1515                $ filters$ filtergetKey ()] = FilterPillData::make (
1616                    filterKey: $ filtergetKey (),
1717                    customPillBlade: $ filtergetCustomPillBlade () ?? null ,
Original file line number Diff line number Diff line change @@ -49,11 +49,13 @@ public function getAppliedFiltersWithValuesForPills(): array
4949            }
5050
5151            $ validatedValue$ filtervalidate ($ item
52+ 
5253            if  ($ filterinstanceof  BooleanFilter) {
5354                return  ! ($ filterisEmpty ($ validatedValue
54-             } elseif  ($ validatedValuenull  || $ validatedValue'null ' ) {
55+             } elseif  ($ validatedValuenull  || $ validatedValue'null '  ||  $ filter -> isEmpty ( $ validatedValue ) ) {
5556                return  false ;
5657            } elseif  (is_array ($ validatedValue
58+                 $ filterisEmpty ($ validatedValue
5759                if  (array_key_exists (0 , $ validatedValueis_null ($ validatedValue0 ]) || $ validatedValue0 ] == 'null ' )) {
5860                    return  false ;
5961                }
Original file line number Diff line number Diff line change @@ -198,6 +198,10 @@ public function getFilterPillValue($value): array|string|bool|null
198198
199199    public  function  isEmpty (array |string |null  $ valuebool 
200200    {
201+         if (is_null ($ valueempty ($ value
202+         {
203+             return  true ;
204+         }
201205        $ values
202206        if  (is_array ($ value
203207            if  (! isset ($ value'minDate ' ]) || ! isset ($ value'maxDate ' ])) {
Original file line number Diff line number Diff line change @@ -435,4 +435,25 @@ public function test_check_if_can_get_locale(): void
435435        $ this assertSame ('de ' , self ::$ filterInstancegetPillsLocale ());
436436        $ this assertTrue (self ::$ filterInstancehasPillsLocale ());
437437    }
438+ 
439+     public  function  test_can_check_validation_rejects_invalid_values_array (): void 
440+     {
441+         $ missingStartDateself ::$ filterInstancevalidate ([null ,'2020-01-01 ' ]);
442+         $ missingEndDateself ::$ filterInstancevalidate (['2020-01-01 ' , null ]);
443+         $ missingBothself ::$ filterInstancevalidate ([null ,null ]);
444+ 
445+         $ this assertFalse ($ missingStartDate
446+         $ this assertFalse ($ missingEndDate
447+         $ this assertFalse ($ missingBoth
448+         $ this assertTrue (self ::$ filterInstanceisEmpty ($ missingStartDate
449+         $ this assertTrue (self ::$ filterInstanceisEmpty ($ missingEndDate
450+         $ this assertTrue (self ::$ filterInstanceisEmpty ($ missingBoth
451+     }
452+ 
453+     public  function  test_can_check_validation_rejects_broken_values_array (): void 
454+     {
455+         $ this assertFalse (self ::$ filterInstancevalidate (['minDate '  => 'asdf ' , 'maxDate '  => '2020-02-02 ' ]));
456+     }
457+ 
458+ 
438459}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments