@@ -30,13 +30,13 @@ public function data()
3030VERSION:3.0
3131ORG:Company;
3232TITLE:Title
33+ ITEM4.TEL:(111) 11 11 11
34+ ITEM5.TEL:(6) 66 66 66 66
35+ ITEM6.TEL:(77) 777 77 77
3336TEL;TYPE=IPHONE;TYPE=pref:(222) 22 22 22
3437TEL;TYPE=HOME:(33) 333 66 66
3538TEL;TYPE=WORK:(444) 44 44 44
3639TEL;TYPE=MAIN:(55) 555 55 55
37- ITEM4.TEL:(111) 11 11 11
38- ITEM5.TEL:(6) 66 66 66 66
39- ITEM6.TEL:(77) 777 77 77
4040UID:3151DE6A-BC35-4612-B340-B53A034A2B27
4141ITEM1.EMAIL:1111@111.com
4242ITEM2.EMAIL:bbbbb@bbbb.com
@@ -133,19 +133,36 @@ public function data()
133133 $ filter14 ['text-matches ' ][0 ]['value ' ] = 'bing ' ;
134134 $ filter14 ['text-matches ' ][0 ]['negate-condition ' ] = true ;
135135
136+ // Check if there is an EMAIL address that does not have the 111.com domain
137+ $ filterEmailWithoutSpecificDomain = $ filter11 ;
138+ $ filterEmailWithoutSpecificDomain ['name ' ] = 'email ' ;
139+ $ filterEmailWithoutSpecificDomain ['text-matches ' ][0 ]['value ' ] = '@111.com ' ;
140+ $ filterEmailWithoutSpecificDomain ['text-matches ' ][0 ]['negate-condition ' ] = true ;
141+
136142 // Param filter with text
143+ // Check there is a TEL;TYPE that contains WORK
137144 $ filter15 = $ filter5 ;
138145 $ filter15 ['param-filters ' ][0 ]['text-match ' ] = [
139146 'match-type ' => 'contains ' ,
140147 'value ' => 'WORK ' ,
141148 'collation ' => 'i;octet ' ,
142149 'negate-condition ' => false ,
143150 ];
151+
152+ // Check if there is a TEL;TYPE that does not contain WORK
144153 $ filter16 = $ filter15 ;
145154 $ filter16 ['param-filters ' ][0 ]['text-match ' ]['negate-condition ' ] = true ;
146155
156+ // Check there is a TEL;TYPE that does not contain OTHER
157+ // All TEL properties with a TYPE parameter match this
158+ $ filterNoTelWithTypeOther = $ filter16 ;
159+ $ filterNoTelWithTypeOther ['param-filters ' ][0 ]['text-match ' ]['value ' ] = 'OTHER ' ;
160+
147161 // Param filter + text filter
148162 $ filter17 = $ filter5 ;
163+
164+ // Matches if the VCard contains a TEL property that either has a TYPE property defined (-> true),
165+ // or that has a value containing 444 (true)
149166 $ filter17 ['test ' ] = 'anyof ' ;
150167 $ filter17 ['text-matches ' ][] = [
151168 'match-type ' => 'contains ' ,
@@ -154,6 +171,8 @@ public function data()
154171 'negate-condition ' => false ,
155172 ];
156173
174+ // Matches if the VCard contains a TEL property that has a TYPE property defined
175+ // AND that has a value NOT containing 444 -> there is 3 properties matching these criteria
157176 $ filter18 = $ filter17 ;
158177 $ filter18 ['text-matches ' ][0 ]['negate-condition ' ] = true ;
159178
@@ -179,7 +198,7 @@ public function data()
179198 [$ body1 , [$ filter6 ], 'anyof ' , false , 'TEL;FOO is not defined, so this should return false ' ],
180199
181200 [$ body1 , [$ filter7 ], 'anyof ' , false , 'TEL;TYPE is defined, so this should return false ' ],
182- [$ body1 , [$ filter8 ], 'anyof ' , true , 'TEL;TYPE is not defined, so this should return true ' ],
201+ [$ body1 , [$ filter8 ], 'anyof ' , true , 'TEL;FOO is not defined, so this should return true ' ],
183202
184203 // Combined parameters
185204 [$ body1 , [$ filter9 ], 'anyof ' , true ],
@@ -190,15 +209,16 @@ public function data()
190209 [$ body1 , [$ filter12 ], 'anyof ' , false ],
191210 [$ body1 , [$ filter13 ], 'anyof ' , false ],
192211 [$ body1 , [$ filter14 ], 'anyof ' , true ],
212+ [$ body1 , [$ filterEmailWithoutSpecificDomain ], 'anyof ' , true , 'EMAIL properties with other domain exists, so this should return true ' ],
193213
194214 // Param filter with text-match
195- [$ body1 , [$ filter15 ], 'anyof ' , true ],
196- [$ body1 , [$ filter16 ], 'anyof ' , false ],
215+ [$ body1 , [$ filter15 ], 'anyof ' , true , 'TEL;TYPE with value WORK exists, so this should return true ' ],
216+ [$ body1 , [$ filter16 ], 'anyof ' , true , 'Some TEL;TYPE that do not match WORK exist. Match result is inverted, so this should return true ' ],
217+ [$ body1 , [$ filterNoTelWithTypeOther ], 'anyof ' , true , 'No TEL;TYPE contains OTHER. Match result is inverted, so this should return true ' ],
197218
198219 // Param filter + text filter
199220 [$ body1 , [$ filter17 ], 'anyof ' , true ],
200- [$ body1 , [$ filter18 ], 'anyof ' , false ],
201- [$ body1 , [$ filter18 ], 'anyof ' , false ],
221+ [$ body1 , [$ filter18 ], 'anyof ' , true ],
202222 ];
203223 }
204224}
0 commit comments