4 * File for the CRM_Contact_Form_Search_Custom_GroupTestDataProvider class
8 * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
9 * @copyright Copyright CiviCRM LLC (C) 2009
10 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
11 * GNU Affero General Public License version 3
12 * @version $Id: GroupTestDataProvider.php 44314 2012-12-19 11:12:49Z kurund $
15 * This file is part of CiviCRM
17 * CiviCRM is free software; you can redistribute it and/or
18 * modify it under the terms of the GNU Affero General Public License
19 * as published by the Free Software Foundation; either version 3 of
20 * the License, or (at your option) any later version.
22 * CiviCRM is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Affero General Public License for more details.
27 * You should have received a copy of the GNU Affero General Public
28 * License along with this program. If not, see
29 * <http://www.gnu.org/licenses/>.
33 * Provide data to the CRM_Contact_Form_Search_Custom_GroupTest class
37 class CRM_Contact_Form_Search_Custom_GroupTestDataProvider
implements Iterator
{
48 * This dataset describes various form values and what contact
49 * IDs should be selected when the form values are applied to the
50 * database in dataset.xml
53 // Exclude static group 3
55 'fv' => ['excludeGroups' => ['3']],
68 // Include static group 3
70 'fv' => ['includeGroups' => ['3']],
84 // Include static group 5
86 'fv' => ['includeGroups' => ['5']],
98 // Include static groups 3 and 5
100 'fv' => ['includeGroups' => ['3', '5']],
118 // Include static group 3, exclude static group 5
121 'includeGroups' => ['3'],
122 'excludeGroups' => ['5'],
124 'id' => ['17', '18', '19', '20', '27', '28'],
128 'fv' => ['excludeTags' => ['7']],
143 'fv' => ['includeTags' => ['7']],
159 'fv' => ['includeTags' => ['9']],
171 // Include tags 7 and 9
173 'fv' => ['includeTags' => ['7', '9']],
191 // Include tag 7, exclude tag 9
194 'includeTags' => ['7'],
195 'excludeTags' => ['9'],
197 'id' => ['11', '15', '19', '23', '26', '28'],
199 // Include static group 3, include tag 7 (either)
202 'includeGroups' => ['3'],
203 'includeTags' => ['7'],
224 // Include static group 3, include tag 7 (both)
227 'includeGroups' => ['3'],
228 'includeTags' => ['7'],
231 'id' => ['19', '20', '23', '24', '28'],
233 // Include static group 3, exclude tag 7
236 'includeGroups' => ['3'],
237 'excludeTags' => ['7'],
239 'id' => ['17', '18', '21', '22', '27'],
241 // Include tag 9, exclude static group 5
244 'includeTags' => ['9'],
245 'excludeGroups' => ['5'],
247 'id' => ['10', '12', '18', '20'],
249 // Exclude tag 9, exclude static group 5
252 'excludeTags' => ['9'],
253 'excludeGroups' => ['5'],
265 // Include smart group 6
267 'fv' => ['includeGroups' => ['6']],
280 // Include smart group 4
282 'fv' => ['includeGroups' => ['4']],
296 // Include smart group 4 and static group 5
298 'fv' => ['includeGroups' => ['4', '5']],
318 public function _construct() {
322 public function rewind() {
329 public function current() {
330 $count = count($this->dataset
[$this->i
]['id']);
331 $ids = $this->dataset
[$this->i
]['id'];
333 foreach ($this->dataset
[$this->i
]['id'] as $key => $value) {
335 'contact_id' => $value,
336 'contact_type' => 'Individual',
337 'sort_name' => "Test Contact $value",
340 return [$this->dataset
[$this->i
]['fv'], $count, $ids, $full];
346 public function key() {
350 public function next() {
357 public function valid() {
358 return isset($this->dataset
[$this->i
]);