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
{
49 * This dataset describes various form values and what contact
50 * IDs should be selected when the form values are applied to the
51 * database in dataset.xml
54 // Include static group 3
56 'fv' => ['group' => '3'],
68 // Include static group 5
70 'fv' => ['group' => '5'],
82 // Include static groups 3 and 5
84 'fv' => ['group' => ['3', '5']],
100 // Include static groups 3 and 5 in legacy format
102 'fv' => ['group' => ['3' => 1, '5' => 1]],
120 'fv' => ['tag' => '7'],
134 'fv' => ['tag' => ['9' => 1]],
148 // Include tags 7 and 9
150 'fv' => ['tag' => ['7', '9']],
168 // Include tags 7 and 10
170 'fv' => ['tag' => ['7', '10']],
184 // Include tags 10 and 11
186 'fv' => ['tag' => ['10', '11']],
192 // gender_id 1 = 'Female'
194 'fv' => ['gender_id' => 1],
195 'id' => ['9', '20', '22'],
197 // prefix_id 2 = 'Ms.'
199 'fv' => ['prefix_id' => 2],
200 'id' => ['10', '13'],
204 'fv' => ['suffix_id' => 6],
205 'id' => ['16', '19', '20', '21'],
209 public function _construct() {
213 public function rewind() {
220 public function current() {
221 $count = count($this->dataset
[$this->i
]['id']);
222 $ids = $this->dataset
[$this->i
]['id'];
224 foreach ($this->dataset
[$this->i
]['id'] as $key => $value) {
226 'contact_id' => $value,
227 'contact_type' => 'Individual',
228 'sort_name' => "Test Contact $value",
231 return [$this->dataset
[$this->i
]['fv'], $count, $ids, $full];
237 public function key() {
241 public function next() {
248 public function valid() {
249 return isset($this->dataset
[$this->i
]);
253 // class CRM_Contact_BAO_QueryTestDataProvider