2 // vim: set si ai expandtab tabstop=4 shiftwidth=4 softtabstop=4:
5 * File for the CRM_Contact_BAO_Query class
9 * @author Walt Haas <walt@dharmatech.org> (801) 534-1262
10 * @copyright Copyright CiviCRM LLC (C) 2009
11 * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html
12 * GNU Affero General Public License version 3
13 * @version $Id: GroupTestDataProvider.php 23715 2009-09-21 06:35:47Z shot $
16 * This file is part of CiviCRM
18 * CiviCRM is free software; you can redistribute it and/or
19 * modify it under the terms of the GNU Affero General Public License
20 * as published by the Free Software Foundation; either version 3 of
21 * the License, or (at your option) any later version.
23 * CiviCRM is distributed in the hope that it will be useful,
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU Affero General Public License for more details.
28 * You should have received a copy of the GNU Affero General Public
29 * License along with this program. If not, see
30 * <http://www.gnu.org/licenses/>.
34 * Provide data to the CRM_Contact_BAO_QueryTest class
38 class CRM_Contact_BAO_QueryTestDataProvider
implements Iterator
{
47 * This dataset describes various form values and what contact
48 * IDs should be selected when the form values are applied to the
49 * database in dataset.xml
51 private $dataset = array(
52 // Include static group 3
54 'fv' => array('group' => array('3' => 1)),
56 '17', '18', '19', '20', '21',
60 // Include static group 5
62 'fv' => array('group' => array('5' => 1)),
64 '13', '14', '15', '16', '21',
68 // Include static groups 3 and 5
70 'fv' => array('group' => array('3' => 1, '5' => 1)),
72 '13', '14', '15', '16', '17', '18',
73 '19', '20', '21', '22', '23', '24',
78 'fv' => array('tag' => array('7' => 1)),
80 '11', '12', '15', '16',
81 '19', '20', '23', '24',
86 'fv' => array('tag' => array('9' => 1)),
88 '10', '12', '14', '16',
89 '18', '20', '22', '24',
92 // Include tags 7 and 9
94 'fv' => array('tag' => array('7' => 1, '9' => 1)),
96 '10', '11', '12', '14', '15', '16',
97 '18', '19', '20', '22', '23', '24',
101 // gender_id 1 = 'Female'
103 'fv' => array('gender_id' => 1),
104 'id' => array('9', '20', '22'),
106 // prefix_id 2 = 'Ms.'
108 'fv' => array('prefix_id' => 2),
109 'id' => array('10', '13'),
113 'fv' => array('suffix_id' => 6),
114 'id' => array('16', '19', '20', '21'),
118 public function _construct() {
122 public function rewind() {
129 public function current() {
130 $count = count($this->dataset
[$this->i
]['id']);
131 $ids = $this->dataset
[$this->i
]['id'];
133 foreach ($this->dataset
[$this->i
]['id'] as $key => $value) {
135 'contact_id' => $value,
136 'contact_type' => 'Individual',
137 'sort_name' => "Test Contact $value",
140 return array($this->dataset
[$this->i
]['fv'], $count, $ids, $full);
146 public function key() {
150 public function next() {
157 public function valid() {
158 return isset($this->dataset
[$this->i
]);
161 // class CRM_Contact_BAO_QueryTestDataProvider