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
{
46 * This dataset describes various form values and what contact
47 * IDs should be selected when the form values are applied to the
48 * database in dataset.xml
50 private $dataset = array(
51 // Exclude static group 3
53 'fv' => array('excludeGroups' => array('3')),
66 // Include static group 3
68 'fv' => array('includeGroups' => array('3')),
82 // Include static group 5
84 'fv' => array('includeGroups' => array('5')),
96 // Include static groups 3 and 5
98 'fv' => array('includeGroups' => array('3', '5')),
116 // Include static group 3, exclude static group 5
119 'includeGroups' => array('3'),
120 'excludeGroups' => array('5'),
122 'id' => array('17', '18', '19', '20', '27', '28'),
126 'fv' => array('excludeTags' => array('7')),
141 'fv' => array('includeTags' => array('7')),
157 'fv' => array('includeTags' => array('9')),
169 // Include tags 7 and 9
171 'fv' => array('includeTags' => array('7', '9')),
189 // Include tag 7, exclude tag 9
192 'includeTags' => array('7'),
193 'excludeTags' => array('9'),
195 'id' => array('11', '15', '19', '23', '26', '28'),
197 // Include static group 3, include tag 7 (either)
200 'includeGroups' => array('3'),
201 'includeTags' => array('7'),
222 // Include static group 3, include tag 7 (both)
225 'includeGroups' => array('3'),
226 'includeTags' => array('7'),
229 'id' => array('19', '20', '23', '24', '28'),
231 // Include static group 3, exclude tag 7
234 'includeGroups' => array('3'),
235 'excludeTags' => array('7'),
237 'id' => array('17', '18', '21', '22', '27'),
239 // Include tag 9, exclude static group 5
242 'includeTags' => array('9'),
243 'excludeGroups' => array('5'),
245 'id' => array('10', '12', '18', '20'),
247 // Exclude tag 9, exclude static group 5
250 'excludeTags' => array('9'),
251 'excludeGroups' => array('5'),
263 // Include smart group 6
265 'fv' => array('includeGroups' => array('6')),
278 // Include smart group 4
280 'fv' => array('includeGroups' => array('4')),
294 // Include smart group 4 and static group 5
296 'fv' => array('includeGroups' => array('4', '5')),
316 public function _construct() {
320 public function rewind() {
327 public function current() {
328 $count = count($this->dataset
[$this->i
]['id']);
329 $ids = $this->dataset
[$this->i
]['id'];
331 foreach ($this->dataset
[$this->i
]['id'] as $key => $value) {
333 'contact_id' => $value,
334 'contact_type' => 'Individual',
335 'sort_name' => "Test Contact $value",
338 return array($this->dataset
[$this->i
]['fv'], $count, $ids, $full);
344 public function key() {
348 public function next() {
355 public function valid() {
356 return isset($this->dataset
[$this->i
]);