3 +--------------------------------------------------------------------+
4 | CiviCRM version 4.7 |
5 +--------------------------------------------------------------------+
6 | Copyright CiviCRM LLC (c) 2004-2017 |
7 +--------------------------------------------------------------------+
8 | This file is a part of CiviCRM. |
10 | CiviCRM is free software; you can copy, modify, and distribute it |
11 | under the terms of the GNU Affero General Public License |
12 | Version 3, 19 November 2007 and the CiviCRM Licensing Exception. |
14 | CiviCRM is distributed in the hope that it will be useful, but |
15 | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
17 | See the GNU Affero General Public License for more details. |
19 | You should have received a copy of the GNU Affero General Public |
20 | License and the CiviCRM Licensing Exception along |
21 | with this program; if not, contact CiviCRM LLC |
22 | at info[AT]civicrm[DOT]org. If you have questions about the |
23 | GNU Affero General Public License or the licensing of CiviCRM, |
24 | see the CiviCRM license FAQ at http://civicrm.org/licensing |
25 +--------------------------------------------------------------------+
29 * Provide data to the CRM_Contact_Form_Search_Custom_SampleTest class
33 class CRM_Contact_Form_Search_Custom_SampleTestDataProvider
implements Iterator
{
42 * This dataset describes various form values and what contact
43 * IDs should be selected when the form values are applied to the
44 * database in dataset.xml
46 private $dataset = array(
47 // Search by Household name: 'Household 9'
49 'fv' => array('household_name' => 'Household 9'),
54 // Search by Household name: 'Household'
56 'fv' => array('household_name' => 'Household'),
64 // Search by State: California
66 'fv' => array('state_province_id' => '1004'),
72 // Search by State: New York
74 'fv' => array('state_province_id' => '1031'),
81 public function _construct() {
85 public function rewind() {
92 public function current() {
93 $count = count($this->dataset
[$this->i
]['id']);
94 $ids = $this->dataset
[$this->i
]['id'];
96 foreach ($this->dataset
[$this->i
]['id'] as $key => $value) {
98 'contact_id' => $value,
99 'contact_type' => 'Household',
100 'household_name' => "Household $value",
103 return array($this->dataset
[$this->i
]['fv'], $count, $ids, $full);
109 public function key() {
113 public function next() {
120 public function valid() {
121 return isset($this->dataset
[$this->i
]);