Completed
Branch dependabot/npm_and_yarn/@wordp... (e9f48b)
by
unknown
60:52 queued 52:34
created
core/domain/entities/contexts/ContextInterface.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
 interface ContextInterface
19 19
 {
20 20
 
21
-    /**
22
-     * @return string
23
-     */
24
-    public function slug();
21
+	/**
22
+	 * @return string
23
+	 */
24
+	public function slug();
25 25
 
26 26
 
27
-    /**
28
-     * @return string
29
-     */
30
-    public function description();
27
+	/**
28
+	 * @return string
29
+	 */
30
+	public function description();
31 31
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Question.model.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
      * Gets an array for converting between QST_system and QST_IDs for system questions. Eg, if you want to know
365 365
      * which system question QST_ID corresponds to the QST_system 'city', use EEM_Question::instance()->get_Question_ID_from_system_string('city');
366 366
      * @param $QST_system
367
-     * @return int of QST_ID for the question that corresponds to that QST_system
367
+     * @return string of QST_ID for the question that corresponds to that QST_system
368 368
      */
369 369
     public function get_Question_ID_from_system_string($QST_system)
370 370
     {
@@ -425,7 +425,7 @@  discard block
 block discarded – undo
425 425
 
426 426
 
427 427
     /**
428
-     * @return array
428
+     * @return EEM_Question
429 429
      */
430 430
     public function question_descriptions()
431 431
     {
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -213,10 +213,10 @@  discard block
 block discarded – undo
213 213
             'Question_Group_Question' => new EE_Has_Many_Relation()
214 214
         );
215 215
         // this model is generally available for reading
216
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
217
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system');
218
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system');
219
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system');
216
+        $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
217
+        $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Reg_Form('QST_system');
218
+        $this->_cap_restriction_generators[EEM_Base::caps_edit] = new EE_Restriction_Generator_Reg_Form('QST_system');
219
+        $this->_cap_restriction_generators[EEM_Base::caps_delete] = new EE_Restriction_Generator_Reg_Form('QST_system');
220 220
         parent::__construct($timezone);
221 221
     }
222 222
 
@@ -256,10 +256,10 @@  discard block
 block discarded – undo
256 256
      */
257 257
     public function question_type_is_in_category($question_type, $category)
258 258
     {
259
-        if (!isset($this->_question_type_categories[ $category ])) {
259
+        if ( ! isset($this->_question_type_categories[$category])) {
260 260
             return false;
261 261
         }
262
-        return in_array($question_type, $this->_question_type_categories[ $category ]);
262
+        return in_array($question_type, $this->_question_type_categories[$category]);
263 263
     }
264 264
 
265 265
 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
      */
271 271
     public function question_types_in_category($category)
272 272
     {
273
-        if (isset($this->_question_type_categories[ $category ])) {
274
-            return $this->_question_type_categories[ $category ];
273
+        if (isset($this->_question_type_categories[$category])) {
274
+            return $this->_question_type_categories[$category];
275 275
         }
276 276
         return array();
277 277
     }
@@ -410,8 +410,8 @@  discard block
 block discarded – undo
410 410
     public function absolute_max_for_system_question($system_question_value)
411 411
     {
412 412
         $maxes = $this->system_question_maxes();
413
-        if (isset($maxes[ $system_question_value ])) {
414
-            return $maxes[ $system_question_value ];
413
+        if (isset($maxes[$system_question_value])) {
414
+            return $maxes[$system_question_value];
415 415
         } else {
416 416
             return EE_INF;
417 417
         }
Please login to merge, or discard this patch.
Indentation   +425 added lines, -425 removed lines patch added patch discarded remove patch
@@ -10,429 +10,429 @@
 block discarded – undo
10 10
 class EEM_Question extends EEM_Soft_Delete_Base
11 11
 {
12 12
 
13
-    // constant used to indicate that the question type is COUNTRY
14
-    const QST_type_country = 'COUNTRY';
15
-
16
-    // constant used to indicate that the question type is DATE
17
-    const QST_type_date = 'DATE';
18
-
19
-    // constant used to indicate that the question type is DROPDOWN
20
-    const QST_type_dropdown = 'DROPDOWN';
21
-
22
-    // constant used to indicate that the question type is CHECKBOX
23
-    const QST_type_checkbox = 'CHECKBOX';
24
-
25
-    // constant used to indicate that the question type is RADIO_BTN
26
-    const QST_type_radio = 'RADIO_BTN';
27
-
28
-    // constant used to indicate that the question type is STATE
29
-    const QST_type_state = 'STATE';
30
-
31
-    // constant used to indicate that the question type is TEXT
32
-    const QST_type_text = 'TEXT';
33
-
34
-    // constant used to indicate that the question type is TEXTAREA
35
-    const QST_type_textarea = 'TEXTAREA';
36
-
37
-    // constant used to indicate that the question type is a TEXTAREA that allows simple html
38
-    const QST_type_html_textarea = 'HTML_TEXTAREA';
39
-
40
-    // constant used to indicate that the question type is an email input
41
-    const QST_type_email = 'EMAIL';
42
-
43
-    // constant used to indicate that the question type is a US-formatted phone number
44
-    const QST_type_us_phone = 'US_PHONE';
45
-
46
-    // constant used to indicate that the question type is an integer (whole number)
47
-    const QST_type_int = 'INTEGER';
48
-
49
-    // constant used to indicate that the question type is a decimal (float)
50
-    const QST_type_decimal = 'DECIMAL';
51
-
52
-    // constant used to indicate that the question type is a valid URL
53
-    const QST_type_url = 'URL';
54
-
55
-    // constant used to indicate that the question type is a YEAR
56
-    const QST_type_year = 'YEAR';
57
-
58
-    // constant used to indicate that the question type is a multi-select
59
-    const QST_type_multi_select = 'MULTI_SELECT';
60
-
61
-    /**
62
-     * Question types that are interchangeable, even after answers have been provided for them.
63
-     * Top-level keys are category slugs, next level is an array of question types. If question types
64
-     * aren't in this array, it is assumed they AREN'T interchangeable with any other question types.
65
-     *
66
-     * @access protected
67
-     * @var array $_question_type_categories {
68
-     * @type string $text
69
-     * @type string $single -answer-enum
70
-     * @type string $multi -answer-enum
71
-     *                    }
72
-     */
73
-    protected $_question_type_categories = array();
74
-
75
-    /**
76
-     * lists all the question types which should be allowed. Ideally, this will be extensible.
77
-     *
78
-     * @access protected
79
-     * @var array $_allowed_question_types
80
-     */
81
-    protected $_allowed_question_types = array();
82
-
83
-    /**
84
-     * brief descriptions for all the question types
85
-     *
86
-     * @access protected
87
-     * @var EEM_Question $_instance
88
-     */
89
-    protected $_question_descriptions;
90
-
91
-
92
-    /**
93
-     * Question types that should have an admin-defined max input length
94
-     * @var array
95
-     */
96
-    protected $question_types_with_max_lengh;
97
-
98
-
99
-    // private instance of the Attendee object
100
-    protected static $_instance = null;
101
-
102
-
103
-    /**
104
-     * EEM_Question constructor.
105
-     *
106
-     * @param null $timezone
107
-     */
108
-    protected function __construct($timezone = null)
109
-    {
110
-        $this->singular_item = __('Question', 'event_espresso');
111
-        $this->plural_item = __('Questions', 'event_espresso');
112
-        $this->_allowed_question_types = apply_filters(
113
-            'FHEE__EEM_Question__construct__allowed_question_types',
114
-            array(
115
-                EEM_Question::QST_type_text => __('Text', 'event_espresso'),
116
-                EEM_Question::QST_type_textarea => __('Textarea', 'event_espresso'),
117
-                EEM_Question::QST_type_checkbox => __('Checkboxes', 'event_espresso'),
118
-                EEM_Question::QST_type_radio => __('Radio Buttons', 'event_espresso'),
119
-                EEM_Question::QST_type_dropdown => __('Dropdown', 'event_espresso'),
120
-                EEM_Question::QST_type_state => __('State/Province Dropdown', 'event_espresso'),
121
-                EEM_Question::QST_type_country => __('Country Dropdown', 'event_espresso'),
122
-                EEM_Question::QST_type_date => __('Date Picker', 'event_espresso'),
123
-                EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'),
124
-                EEM_Question::QST_type_email => __('Email', 'event_espresso'),
125
-                EEM_Question::QST_type_us_phone => __('USA - Format Phone', 'event_espresso'),
126
-                EEM_Question::QST_type_decimal => __('Number', 'event_espresso'),
127
-                EEM_Question::QST_type_int => __('Whole Number', 'event_espresso'),
128
-                EEM_Question::QST_type_url => __('URL', 'event_espresso'),
129
-                EEM_Question::QST_type_year => __('Year', 'event_espresso'),
130
-                EEM_Question::QST_type_multi_select => __('Multi Select', 'event_espresso')
131
-            )
132
-        );
133
-        $this->_question_descriptions = apply_filters(
134
-            'FHEE__EEM_Question__construct__question_descriptions',
135
-            array(
136
-                EEM_Question::QST_type_text => __('A single line text input field', 'event_espresso'),
137
-                EEM_Question::QST_type_textarea => __('A multi line text input field', 'event_espresso'),
138
-                EEM_Question::QST_type_checkbox => __('Allows multiple preset options to be selected', 'event_espresso'),
139
-                EEM_Question::QST_type_radio => __('Allows a single preset option to be selected', 'event_espresso'),
140
-                EEM_Question::QST_type_dropdown => __('A dropdown that allows a single selection', 'event_espresso'),
141
-                EEM_Question::QST_type_state => __('A dropdown that lists states/provinces', 'event_espresso'),
142
-                EEM_Question::QST_type_country => __('A dropdown that lists countries', 'event_espresso'),
143
-                EEM_Question::QST_type_date => __('A popup calendar that allows date selections', 'event_espresso'),
144
-                EEM_Question::QST_type_html_textarea => __('A multi line text input field that allows HTML', 'event_espresso'),
145
-                EEM_Question::QST_type_email => __('A text field that must contain a valid Email address', 'event_espresso'),
146
-                EEM_Question::QST_type_us_phone => __('A text field that must contain a valid US phone number', 'event_espresso'),
147
-                EEM_Question::QST_type_decimal => __('A text field that allows number values with decimals', 'event_espresso'),
148
-                EEM_Question::QST_type_int => __('A text field that only allows whole numbers (no decimals)', 'event_espresso'),
149
-                EEM_Question::QST_type_url => __('A text field that must contain a valid URL', 'event_espresso'),
150
-                EEM_Question::QST_type_year => __('A dropdown that lists the last 100 years', 'event_espresso'),
151
-                EEM_Question::QST_type_multi_select => __('A dropdown that allows multiple selections', 'event_espresso')
152
-            )
153
-        );
154
-        $this->_question_type_categories = (array) apply_filters(
155
-            'FHEE__EEM_Question__construct__question_type_categories',
156
-            array(
157
-                'text' => array(
158
-                    EEM_Question::QST_type_text,
159
-                    EEM_Question::QST_type_textarea,
160
-                    EEM_Question::QST_type_date,
161
-                    EEM_Question::QST_type_html_textarea,
162
-                    EEM_Question::QST_type_email,
163
-                    EEM_Question::QST_type_us_phone,
164
-                    EEM_Question::QST_type_decimal,
165
-                    EEM_Question::QST_type_int,
166
-                    EEM_Question::QST_type_url,
167
-                    EEM_Question::QST_type_year
168
-                ),
169
-                'single-answer-enum' => array(
170
-                    EEM_Question::QST_type_radio,
171
-                    EEM_Question::QST_type_dropdown
172
-                ),
173
-                'multi-answer-enum' => array(
174
-                    EEM_Question::QST_type_checkbox,
175
-                    EEM_Question::QST_type_multi_select
176
-                )
177
-            )
178
-        );
179
-        $this->question_types_with_max_lengh = apply_filters(
180
-            'FHEE__EEM_Question___construct__question_types_with_max_length',
181
-            array(
182
-                EEM_Question::QST_type_text,
183
-                EEM_Question::QST_type_textarea,
184
-                EEM_Question::QST_type_html_textarea
185
-            )
186
-        );
187
-
188
-        $this->_tables = array(
189
-            'Question' => new EE_Primary_Table('esp_question', 'QST_ID')
190
-        );
191
-        $this->_fields = array(
192
-            'Question' => array(
193
-                'QST_ID' => new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')),
194
-                'QST_display_text' => new EE_Post_Content_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''),
195
-                'QST_admin_label' => new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''),
196
-                'QST_system' => new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), false, ''),
197
-                'QST_type' => new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types),
198
-                'QST_required' => new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false),
199
-                'QST_required_text' => new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''),
200
-                'QST_order' => new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0),
201
-                'QST_admin_only' => new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false),
202
-                'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF),
203
-                'QST_wp_user' => new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false),
204
-                'QST_deleted' => new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false)
205
-            )
206
-        );
207
-        $this->_model_relations = array(
208
-            'Question_Group' => new EE_HABTM_Relation('Question_Group_Question'),
209
-            'Question_Option' => new EE_Has_Many_Relation(),
210
-            'Answer' => new EE_Has_Many_Relation(),
211
-            'WP_User' => new EE_Belongs_To_Relation(),
212
-            // for QST_order column
213
-            'Question_Group_Question' => new EE_Has_Many_Relation()
214
-        );
215
-        // this model is generally available for reading
216
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
217
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system');
218
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system');
219
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system');
220
-        parent::__construct($timezone);
221
-    }
222
-
223
-    /**
224
-     * Returns the list of allowed question types, which are normally: 'TEXT','TEXTAREA','RADIO_BTN','DROPDOWN','CHECKBOX','DATE'
225
-     * but they can be extended
226
-     * @return string[]
227
-     */
228
-    public function allowed_question_types()
229
-    {
230
-        return $this->_allowed_question_types;
231
-    }
232
-
233
-    /**
234
-     * Gets all the question types in the same category
235
-     * @param string $question_type one of EEM_Question::allowed_question_types(
236
-     * @return string[] like EEM_Question::allowed_question_types()
237
-     */
238
-    public function question_types_in_same_category($question_type)
239
-    {
240
-        $question_types = array($question_type);
241
-        foreach ($this->_question_type_categories as $category => $question_types_in_category) {
242
-            if (in_array($question_type, $question_types_in_category)) {
243
-                $question_types = $question_types_in_category;
244
-                break;
245
-            }
246
-        }
247
-
248
-        return array_intersect_key($this->allowed_question_types(), array_flip($question_types));
249
-    }
250
-
251
-    /**
252
-     * Determines if the given question type is in the given question type category
253
-     * @param string $question_type one of EEM_Question::allowed_question_types()
254
-     * @param string $category one of the top-level keys of EEM_Question::question_type_categories()
255
-     * @return boolean
256
-     */
257
-    public function question_type_is_in_category($question_type, $category)
258
-    {
259
-        if (!isset($this->_question_type_categories[ $category ])) {
260
-            return false;
261
-        }
262
-        return in_array($question_type, $this->_question_type_categories[ $category ]);
263
-    }
264
-
265
-
266
-    /**
267
-     * Returns all the question types in the given category
268
-     * @param string $category
269
-     * @return array|mixed
270
-     */
271
-    public function question_types_in_category($category)
272
-    {
273
-        if (isset($this->_question_type_categories[ $category ])) {
274
-            return $this->_question_type_categories[ $category ];
275
-        }
276
-        return array();
277
-    }
278
-
279
-
280
-    /**
281
-     * Returns all the question types that should have question options
282
-     * @return array
283
-     */
284
-    public function question_types_with_options()
285
-    {
286
-        return array_merge(
287
-            $this->question_types_in_category('single-answer-enum'),
288
-            $this->question_types_in_category('multi-answer-enum')
289
-        );
290
-    }
291
-
292
-    /**
293
-     * Returns the question type categories 2d array
294
-     * @return array see EEM_Question::_question_type_categories
295
-     */
296
-    public function question_type_categories()
297
-    {
298
-        return $this->_question_type_categories;
299
-    }
300
-
301
-    /**
302
-     * Returns an array of all the QST_system values that can be allowed in the system question group
303
-     * identified by $system_question_group_id
304
-     * @param string $system_question_group_id QSG_system
305
-     * @return array of system question names (QST_system)
306
-     */
307
-    public function allowed_system_questions_in_system_question_group($system_question_group_id)
308
-    {
309
-        $question_system_ids = array();
310
-        switch ($system_question_group_id) {
311
-            case EEM_Question_Group::system_personal:
312
-                $question_system_ids = array(
313
-                    EEM_Attendee::system_question_fname,
314
-                    EEM_Attendee::system_question_lname,
315
-                    EEM_Attendee::system_question_email,
316
-                    EEM_Attendee::system_question_phone
317
-                );
318
-                break;
319
-            case EEM_Question_Group::system_address:
320
-                $question_system_ids = array(
321
-                    EEM_Attendee::system_question_address,
322
-                    EEM_Attendee::system_question_address2,
323
-                    EEM_Attendee::system_question_city,
324
-                    EEM_Attendee::system_question_state,
325
-                    EEM_Attendee::system_question_country,
326
-                    EEM_Attendee::system_question_zip,
327
-                    EEM_Attendee::system_question_phone
328
-                );
329
-                break;
330
-        }
331
-        return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id);
332
-    }
333
-
334
-    /**
335
-     * Returns an array of all the QST_system values that are required in the system question group
336
-     * identified by $system_question_group_id
337
-     * @param string $system_question_group_id QSG_system
338
-     * @return array of system question names (QST_system)
339
-     */
340
-    public function required_system_questions_in_system_question_group($system_question_group_id)
341
-    {
342
-        $question_system_ids = null;
343
-        switch ($system_question_group_id) {
344
-            case EEM_Question_Group::system_personal:
345
-                $question_system_ids = array(
346
-                    EEM_Attendee::system_question_fname,
347
-                    EEM_Attendee::system_question_email,
348
-                );
349
-                break;
350
-            default:
351
-                $question_system_ids = array();
352
-        }
353
-        return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id);
354
-    }
355
-
356
-
357
-    /**
358
-     * Gets an array for converting between QST_system and QST_IDs for system questions. Eg, if you want to know
359
-     * which system question QST_ID corresponds to the QST_system 'city', use EEM_Question::instance()->get_Question_ID_from_system_string('city');
360
-     * @param $QST_system
361
-     * @return int of QST_ID for the question that corresponds to that QST_system
362
-     */
363
-    public function get_Question_ID_from_system_string($QST_system)
364
-    {
365
-        return $this->get_var(array(array('QST_system' => $QST_system)));
366
-    }
367
-
368
-
369
-    /**
370
-     * searches the db for the question with the latest question order and returns that value.
371
-     * @access public
372
-     * @return int
373
-     */
374
-    public function get_latest_question_order()
375
-    {
376
-        $columns_to_select = array(
377
-            'max_order' => array("MAX(QST_order)", "%d")
378
-        );
379
-        $max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select);
380
-        return isset($max[0], $max[0]['max_order']) ? $max[0]['max_order'] : 0;
381
-    }
382
-
383
-    /**
384
-     * Returns an array where keys are system question QST_system values,
385
-     * and values are the highest question max the admin can set on the question
386
-     * (aka the "max max"; eg, a site admin can change the zip question to have a max
387
-     * of 5, but no larger than 12)
388
-     * @return array
389
-     */
390
-    public function system_question_maxes()
391
-    {
392
-        return array(
393
-            'fname' => 45,
394
-            'lname' => 45,
395
-            'address' => 255,
396
-            'address2' => 255,
397
-            'city' => 45,
398
-            'zip' => 12,
399
-            'email' => 255,
400
-            'phone' => 45,
401
-        );
402
-    }
403
-
404
-    /**
405
-     * Given a QST_system value, gets the question's largest allowable max input.
406
-     * @see Registration_Form_Admin_Page::system_question_maxes()
407
-     * @param string $system_question_value
408
-     * @return int|float
409
-     */
410
-    public function absolute_max_for_system_question($system_question_value)
411
-    {
412
-        $maxes = $this->system_question_maxes();
413
-        if (isset($maxes[ $system_question_value ])) {
414
-            return $maxes[ $system_question_value ];
415
-        } else {
416
-            return EE_INF;
417
-        }
418
-    }
419
-
420
-
421
-    /**
422
-     * @return array
423
-     */
424
-    public function question_descriptions()
425
-    {
426
-        return $this->_question_descriptions;
427
-    }
428
-
429
-
430
-    /**
431
-     * Returns all the question types that should have an admin-defined max input length
432
-     * @return array
433
-     */
434
-    public function questionTypesWithMaxLength()
435
-    {
436
-        return (array) $this->question_types_with_max_lengh;
437
-    }
13
+	// constant used to indicate that the question type is COUNTRY
14
+	const QST_type_country = 'COUNTRY';
15
+
16
+	// constant used to indicate that the question type is DATE
17
+	const QST_type_date = 'DATE';
18
+
19
+	// constant used to indicate that the question type is DROPDOWN
20
+	const QST_type_dropdown = 'DROPDOWN';
21
+
22
+	// constant used to indicate that the question type is CHECKBOX
23
+	const QST_type_checkbox = 'CHECKBOX';
24
+
25
+	// constant used to indicate that the question type is RADIO_BTN
26
+	const QST_type_radio = 'RADIO_BTN';
27
+
28
+	// constant used to indicate that the question type is STATE
29
+	const QST_type_state = 'STATE';
30
+
31
+	// constant used to indicate that the question type is TEXT
32
+	const QST_type_text = 'TEXT';
33
+
34
+	// constant used to indicate that the question type is TEXTAREA
35
+	const QST_type_textarea = 'TEXTAREA';
36
+
37
+	// constant used to indicate that the question type is a TEXTAREA that allows simple html
38
+	const QST_type_html_textarea = 'HTML_TEXTAREA';
39
+
40
+	// constant used to indicate that the question type is an email input
41
+	const QST_type_email = 'EMAIL';
42
+
43
+	// constant used to indicate that the question type is a US-formatted phone number
44
+	const QST_type_us_phone = 'US_PHONE';
45
+
46
+	// constant used to indicate that the question type is an integer (whole number)
47
+	const QST_type_int = 'INTEGER';
48
+
49
+	// constant used to indicate that the question type is a decimal (float)
50
+	const QST_type_decimal = 'DECIMAL';
51
+
52
+	// constant used to indicate that the question type is a valid URL
53
+	const QST_type_url = 'URL';
54
+
55
+	// constant used to indicate that the question type is a YEAR
56
+	const QST_type_year = 'YEAR';
57
+
58
+	// constant used to indicate that the question type is a multi-select
59
+	const QST_type_multi_select = 'MULTI_SELECT';
60
+
61
+	/**
62
+	 * Question types that are interchangeable, even after answers have been provided for them.
63
+	 * Top-level keys are category slugs, next level is an array of question types. If question types
64
+	 * aren't in this array, it is assumed they AREN'T interchangeable with any other question types.
65
+	 *
66
+	 * @access protected
67
+	 * @var array $_question_type_categories {
68
+	 * @type string $text
69
+	 * @type string $single -answer-enum
70
+	 * @type string $multi -answer-enum
71
+	 *                    }
72
+	 */
73
+	protected $_question_type_categories = array();
74
+
75
+	/**
76
+	 * lists all the question types which should be allowed. Ideally, this will be extensible.
77
+	 *
78
+	 * @access protected
79
+	 * @var array $_allowed_question_types
80
+	 */
81
+	protected $_allowed_question_types = array();
82
+
83
+	/**
84
+	 * brief descriptions for all the question types
85
+	 *
86
+	 * @access protected
87
+	 * @var EEM_Question $_instance
88
+	 */
89
+	protected $_question_descriptions;
90
+
91
+
92
+	/**
93
+	 * Question types that should have an admin-defined max input length
94
+	 * @var array
95
+	 */
96
+	protected $question_types_with_max_lengh;
97
+
98
+
99
+	// private instance of the Attendee object
100
+	protected static $_instance = null;
101
+
102
+
103
+	/**
104
+	 * EEM_Question constructor.
105
+	 *
106
+	 * @param null $timezone
107
+	 */
108
+	protected function __construct($timezone = null)
109
+	{
110
+		$this->singular_item = __('Question', 'event_espresso');
111
+		$this->plural_item = __('Questions', 'event_espresso');
112
+		$this->_allowed_question_types = apply_filters(
113
+			'FHEE__EEM_Question__construct__allowed_question_types',
114
+			array(
115
+				EEM_Question::QST_type_text => __('Text', 'event_espresso'),
116
+				EEM_Question::QST_type_textarea => __('Textarea', 'event_espresso'),
117
+				EEM_Question::QST_type_checkbox => __('Checkboxes', 'event_espresso'),
118
+				EEM_Question::QST_type_radio => __('Radio Buttons', 'event_espresso'),
119
+				EEM_Question::QST_type_dropdown => __('Dropdown', 'event_espresso'),
120
+				EEM_Question::QST_type_state => __('State/Province Dropdown', 'event_espresso'),
121
+				EEM_Question::QST_type_country => __('Country Dropdown', 'event_espresso'),
122
+				EEM_Question::QST_type_date => __('Date Picker', 'event_espresso'),
123
+				EEM_Question::QST_type_html_textarea => __('HTML Textarea', 'event_espresso'),
124
+				EEM_Question::QST_type_email => __('Email', 'event_espresso'),
125
+				EEM_Question::QST_type_us_phone => __('USA - Format Phone', 'event_espresso'),
126
+				EEM_Question::QST_type_decimal => __('Number', 'event_espresso'),
127
+				EEM_Question::QST_type_int => __('Whole Number', 'event_espresso'),
128
+				EEM_Question::QST_type_url => __('URL', 'event_espresso'),
129
+				EEM_Question::QST_type_year => __('Year', 'event_espresso'),
130
+				EEM_Question::QST_type_multi_select => __('Multi Select', 'event_espresso')
131
+			)
132
+		);
133
+		$this->_question_descriptions = apply_filters(
134
+			'FHEE__EEM_Question__construct__question_descriptions',
135
+			array(
136
+				EEM_Question::QST_type_text => __('A single line text input field', 'event_espresso'),
137
+				EEM_Question::QST_type_textarea => __('A multi line text input field', 'event_espresso'),
138
+				EEM_Question::QST_type_checkbox => __('Allows multiple preset options to be selected', 'event_espresso'),
139
+				EEM_Question::QST_type_radio => __('Allows a single preset option to be selected', 'event_espresso'),
140
+				EEM_Question::QST_type_dropdown => __('A dropdown that allows a single selection', 'event_espresso'),
141
+				EEM_Question::QST_type_state => __('A dropdown that lists states/provinces', 'event_espresso'),
142
+				EEM_Question::QST_type_country => __('A dropdown that lists countries', 'event_espresso'),
143
+				EEM_Question::QST_type_date => __('A popup calendar that allows date selections', 'event_espresso'),
144
+				EEM_Question::QST_type_html_textarea => __('A multi line text input field that allows HTML', 'event_espresso'),
145
+				EEM_Question::QST_type_email => __('A text field that must contain a valid Email address', 'event_espresso'),
146
+				EEM_Question::QST_type_us_phone => __('A text field that must contain a valid US phone number', 'event_espresso'),
147
+				EEM_Question::QST_type_decimal => __('A text field that allows number values with decimals', 'event_espresso'),
148
+				EEM_Question::QST_type_int => __('A text field that only allows whole numbers (no decimals)', 'event_espresso'),
149
+				EEM_Question::QST_type_url => __('A text field that must contain a valid URL', 'event_espresso'),
150
+				EEM_Question::QST_type_year => __('A dropdown that lists the last 100 years', 'event_espresso'),
151
+				EEM_Question::QST_type_multi_select => __('A dropdown that allows multiple selections', 'event_espresso')
152
+			)
153
+		);
154
+		$this->_question_type_categories = (array) apply_filters(
155
+			'FHEE__EEM_Question__construct__question_type_categories',
156
+			array(
157
+				'text' => array(
158
+					EEM_Question::QST_type_text,
159
+					EEM_Question::QST_type_textarea,
160
+					EEM_Question::QST_type_date,
161
+					EEM_Question::QST_type_html_textarea,
162
+					EEM_Question::QST_type_email,
163
+					EEM_Question::QST_type_us_phone,
164
+					EEM_Question::QST_type_decimal,
165
+					EEM_Question::QST_type_int,
166
+					EEM_Question::QST_type_url,
167
+					EEM_Question::QST_type_year
168
+				),
169
+				'single-answer-enum' => array(
170
+					EEM_Question::QST_type_radio,
171
+					EEM_Question::QST_type_dropdown
172
+				),
173
+				'multi-answer-enum' => array(
174
+					EEM_Question::QST_type_checkbox,
175
+					EEM_Question::QST_type_multi_select
176
+				)
177
+			)
178
+		);
179
+		$this->question_types_with_max_lengh = apply_filters(
180
+			'FHEE__EEM_Question___construct__question_types_with_max_length',
181
+			array(
182
+				EEM_Question::QST_type_text,
183
+				EEM_Question::QST_type_textarea,
184
+				EEM_Question::QST_type_html_textarea
185
+			)
186
+		);
187
+
188
+		$this->_tables = array(
189
+			'Question' => new EE_Primary_Table('esp_question', 'QST_ID')
190
+		);
191
+		$this->_fields = array(
192
+			'Question' => array(
193
+				'QST_ID' => new EE_Primary_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso')),
194
+				'QST_display_text' => new EE_Post_Content_Field('QST_display_text', __('Question Text', 'event_espresso'), true, ''),
195
+				'QST_admin_label' => new EE_Plain_Text_Field('QST_admin_label', __('Question Label (admin-only)', 'event_espresso'), true, ''),
196
+				'QST_system' => new EE_Plain_Text_Field('QST_system', __('Internal string ID for question', 'event_espresso'), false, ''),
197
+				'QST_type' => new EE_Enum_Text_Field('QST_type', __('Question Type', 'event_espresso'), false, 'TEXT', $this->_allowed_question_types),
198
+				'QST_required' => new EE_Boolean_Field('QST_required', __('Required Question?', 'event_espresso'), false, false),
199
+				'QST_required_text' => new EE_Simple_HTML_Field('QST_required_text', __('Text to Display if Not Provided', 'event_espresso'), true, ''),
200
+				'QST_order' => new EE_Integer_Field('QST_order', __('Question Order', 'event_espresso'), false, 0),
201
+				'QST_admin_only' => new EE_Boolean_Field('QST_admin_only', __('Admin-Only Question?', 'event_espresso'), false, false),
202
+				'QST_max' => new EE_Infinite_Integer_Field('QST_max', __('Max Size', 'event_espresso'), false, EE_INF),
203
+				'QST_wp_user' => new EE_WP_User_Field('QST_wp_user', __('Question Creator ID', 'event_espresso'), false),
204
+				'QST_deleted' => new EE_Trashed_Flag_Field('QST_deleted', __('Flag Indicating question was deleted', 'event_espresso'), false, false)
205
+			)
206
+		);
207
+		$this->_model_relations = array(
208
+			'Question_Group' => new EE_HABTM_Relation('Question_Group_Question'),
209
+			'Question_Option' => new EE_Has_Many_Relation(),
210
+			'Answer' => new EE_Has_Many_Relation(),
211
+			'WP_User' => new EE_Belongs_To_Relation(),
212
+			// for QST_order column
213
+			'Question_Group_Question' => new EE_Has_Many_Relation()
214
+		);
215
+		// this model is generally available for reading
216
+		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
217
+		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Reg_Form('QST_system');
218
+		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = new EE_Restriction_Generator_Reg_Form('QST_system');
219
+		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = new EE_Restriction_Generator_Reg_Form('QST_system');
220
+		parent::__construct($timezone);
221
+	}
222
+
223
+	/**
224
+	 * Returns the list of allowed question types, which are normally: 'TEXT','TEXTAREA','RADIO_BTN','DROPDOWN','CHECKBOX','DATE'
225
+	 * but they can be extended
226
+	 * @return string[]
227
+	 */
228
+	public function allowed_question_types()
229
+	{
230
+		return $this->_allowed_question_types;
231
+	}
232
+
233
+	/**
234
+	 * Gets all the question types in the same category
235
+	 * @param string $question_type one of EEM_Question::allowed_question_types(
236
+	 * @return string[] like EEM_Question::allowed_question_types()
237
+	 */
238
+	public function question_types_in_same_category($question_type)
239
+	{
240
+		$question_types = array($question_type);
241
+		foreach ($this->_question_type_categories as $category => $question_types_in_category) {
242
+			if (in_array($question_type, $question_types_in_category)) {
243
+				$question_types = $question_types_in_category;
244
+				break;
245
+			}
246
+		}
247
+
248
+		return array_intersect_key($this->allowed_question_types(), array_flip($question_types));
249
+	}
250
+
251
+	/**
252
+	 * Determines if the given question type is in the given question type category
253
+	 * @param string $question_type one of EEM_Question::allowed_question_types()
254
+	 * @param string $category one of the top-level keys of EEM_Question::question_type_categories()
255
+	 * @return boolean
256
+	 */
257
+	public function question_type_is_in_category($question_type, $category)
258
+	{
259
+		if (!isset($this->_question_type_categories[ $category ])) {
260
+			return false;
261
+		}
262
+		return in_array($question_type, $this->_question_type_categories[ $category ]);
263
+	}
264
+
265
+
266
+	/**
267
+	 * Returns all the question types in the given category
268
+	 * @param string $category
269
+	 * @return array|mixed
270
+	 */
271
+	public function question_types_in_category($category)
272
+	{
273
+		if (isset($this->_question_type_categories[ $category ])) {
274
+			return $this->_question_type_categories[ $category ];
275
+		}
276
+		return array();
277
+	}
278
+
279
+
280
+	/**
281
+	 * Returns all the question types that should have question options
282
+	 * @return array
283
+	 */
284
+	public function question_types_with_options()
285
+	{
286
+		return array_merge(
287
+			$this->question_types_in_category('single-answer-enum'),
288
+			$this->question_types_in_category('multi-answer-enum')
289
+		);
290
+	}
291
+
292
+	/**
293
+	 * Returns the question type categories 2d array
294
+	 * @return array see EEM_Question::_question_type_categories
295
+	 */
296
+	public function question_type_categories()
297
+	{
298
+		return $this->_question_type_categories;
299
+	}
300
+
301
+	/**
302
+	 * Returns an array of all the QST_system values that can be allowed in the system question group
303
+	 * identified by $system_question_group_id
304
+	 * @param string $system_question_group_id QSG_system
305
+	 * @return array of system question names (QST_system)
306
+	 */
307
+	public function allowed_system_questions_in_system_question_group($system_question_group_id)
308
+	{
309
+		$question_system_ids = array();
310
+		switch ($system_question_group_id) {
311
+			case EEM_Question_Group::system_personal:
312
+				$question_system_ids = array(
313
+					EEM_Attendee::system_question_fname,
314
+					EEM_Attendee::system_question_lname,
315
+					EEM_Attendee::system_question_email,
316
+					EEM_Attendee::system_question_phone
317
+				);
318
+				break;
319
+			case EEM_Question_Group::system_address:
320
+				$question_system_ids = array(
321
+					EEM_Attendee::system_question_address,
322
+					EEM_Attendee::system_question_address2,
323
+					EEM_Attendee::system_question_city,
324
+					EEM_Attendee::system_question_state,
325
+					EEM_Attendee::system_question_country,
326
+					EEM_Attendee::system_question_zip,
327
+					EEM_Attendee::system_question_phone
328
+				);
329
+				break;
330
+		}
331
+		return apply_filters('FHEE__EEM_Question__system_questions_allowed_in_system_question_group__return', $question_system_ids, $system_question_group_id);
332
+	}
333
+
334
+	/**
335
+	 * Returns an array of all the QST_system values that are required in the system question group
336
+	 * identified by $system_question_group_id
337
+	 * @param string $system_question_group_id QSG_system
338
+	 * @return array of system question names (QST_system)
339
+	 */
340
+	public function required_system_questions_in_system_question_group($system_question_group_id)
341
+	{
342
+		$question_system_ids = null;
343
+		switch ($system_question_group_id) {
344
+			case EEM_Question_Group::system_personal:
345
+				$question_system_ids = array(
346
+					EEM_Attendee::system_question_fname,
347
+					EEM_Attendee::system_question_email,
348
+				);
349
+				break;
350
+			default:
351
+				$question_system_ids = array();
352
+		}
353
+		return apply_filters('FHEE__EEM_Question__system_questions_required_in_system_question_group', $question_system_ids, $system_question_group_id);
354
+	}
355
+
356
+
357
+	/**
358
+	 * Gets an array for converting between QST_system and QST_IDs for system questions. Eg, if you want to know
359
+	 * which system question QST_ID corresponds to the QST_system 'city', use EEM_Question::instance()->get_Question_ID_from_system_string('city');
360
+	 * @param $QST_system
361
+	 * @return int of QST_ID for the question that corresponds to that QST_system
362
+	 */
363
+	public function get_Question_ID_from_system_string($QST_system)
364
+	{
365
+		return $this->get_var(array(array('QST_system' => $QST_system)));
366
+	}
367
+
368
+
369
+	/**
370
+	 * searches the db for the question with the latest question order and returns that value.
371
+	 * @access public
372
+	 * @return int
373
+	 */
374
+	public function get_latest_question_order()
375
+	{
376
+		$columns_to_select = array(
377
+			'max_order' => array("MAX(QST_order)", "%d")
378
+		);
379
+		$max = $this->_get_all_wpdb_results(array(), ARRAY_A, $columns_to_select);
380
+		return isset($max[0], $max[0]['max_order']) ? $max[0]['max_order'] : 0;
381
+	}
382
+
383
+	/**
384
+	 * Returns an array where keys are system question QST_system values,
385
+	 * and values are the highest question max the admin can set on the question
386
+	 * (aka the "max max"; eg, a site admin can change the zip question to have a max
387
+	 * of 5, but no larger than 12)
388
+	 * @return array
389
+	 */
390
+	public function system_question_maxes()
391
+	{
392
+		return array(
393
+			'fname' => 45,
394
+			'lname' => 45,
395
+			'address' => 255,
396
+			'address2' => 255,
397
+			'city' => 45,
398
+			'zip' => 12,
399
+			'email' => 255,
400
+			'phone' => 45,
401
+		);
402
+	}
403
+
404
+	/**
405
+	 * Given a QST_system value, gets the question's largest allowable max input.
406
+	 * @see Registration_Form_Admin_Page::system_question_maxes()
407
+	 * @param string $system_question_value
408
+	 * @return int|float
409
+	 */
410
+	public function absolute_max_for_system_question($system_question_value)
411
+	{
412
+		$maxes = $this->system_question_maxes();
413
+		if (isset($maxes[ $system_question_value ])) {
414
+			return $maxes[ $system_question_value ];
415
+		} else {
416
+			return EE_INF;
417
+		}
418
+	}
419
+
420
+
421
+	/**
422
+	 * @return array
423
+	 */
424
+	public function question_descriptions()
425
+	{
426
+		return $this->_question_descriptions;
427
+	}
428
+
429
+
430
+	/**
431
+	 * Returns all the question types that should have an admin-defined max input length
432
+	 * @return array
433
+	 */
434
+	public function questionTypesWithMaxLength()
435
+	{
436
+		return (array) $this->question_types_with_max_lengh;
437
+	}
438 438
 }
Please login to merge, or discard this patch.
acceptance_tests/tests/b-TestRegistrationSummaryCept.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
 
15 15
 //need the MER plugin active for this test (we'll deactivate it after).
16 16
 $I->ensurePluginActive(
17
-    'event-espresso-mer-multi-event-registration',
18
-    'activated'
17
+	'event-espresso-mer-multi-event-registration',
18
+	'activated'
19 19
 );
20 20
 
21 21
 //k now we need to make sure the registration multi-status message type is active because it isn't by default
@@ -73,38 +73,38 @@  discard block
 block discarded – undo
73 73
 $I->loginAsAdmin();
74 74
 $I->amOnMessagesActivityListTablePage();
75 75
 $I->see(
76
-    '[email protected]',
77
-    MessagesAdmin::messagesActivityListTableCellSelectorFor(
78
-        'to',
79
-        'Registration Multi-status Summary',
80
-        MessagesAdmin::MESSAGE_STATUS_SENT,
81
-        '',
82
-        'Primary Registrant'
83
-    )
76
+	'[email protected]',
77
+	MessagesAdmin::messagesActivityListTableCellSelectorFor(
78
+		'to',
79
+		'Registration Multi-status Summary',
80
+		MessagesAdmin::MESSAGE_STATUS_SENT,
81
+		'',
82
+		'Primary Registrant'
83
+	)
84 84
 );
85 85
 $I->see(
86
-    '[email protected]',
87
-    MessagesAdmin::messagesActivityListTableCellSelectorFor(
88
-        'to',
89
-        'Registration Multi-status Summary',
90
-        MessagesAdmin::MESSAGE_STATUS_SENT
91
-    )
86
+	'[email protected]',
87
+	MessagesAdmin::messagesActivityListTableCellSelectorFor(
88
+		'to',
89
+		'Registration Multi-status Summary',
90
+		MessagesAdmin::MESSAGE_STATUS_SENT
91
+	)
92 92
 );
93 93
 //verify count
94 94
 $I->verifyMatchingCountofTextInMessageActivityListTableFor(
95
-    1,
96
-    '[email protected]',
97
-    'to',
98
-    'Registration Multi-status Summary',
99
-    MessagesAdmin::MESSAGE_STATUS_SENT,
100
-    'Email',
101
-    'Primary Registrant'
95
+	1,
96
+	'[email protected]',
97
+	'to',
98
+	'Registration Multi-status Summary',
99
+	MessagesAdmin::MESSAGE_STATUS_SENT,
100
+	'Email',
101
+	'Primary Registrant'
102 102
 );
103 103
 $I->verifyMatchingCountofTextInMessageActivityListTableFor(
104
-    1,
105
-    '[email protected]',
106
-    'to',
107
-    'Registration Multi-status Summary'
104
+	1,
105
+	'[email protected]',
106
+	'to',
107
+	'Registration Multi-status Summary'
108 108
 );
109 109
 
110 110
 //okay now let's do some registrations for just the first event and verify that registration multi-status summary is NOT
@@ -134,25 +134,25 @@  discard block
 block discarded – undo
134 134
 $I->loginAsAdmin();
135 135
 $I->amOnMessagesActivityListTablePage();
136 136
 $I->dontSee(
137
-    '[email protected]',
138
-    MessagesAdmin::messagesActivityListTableCellSelectorFor(
139
-        'to',
140
-        'Registration Multi-status Summary',
141
-        MessagesAdmin::MESSAGE_STATUS_SENT,
142
-        '',
143
-        'Primary Registrant'
144
-    )
137
+	'[email protected]',
138
+	MessagesAdmin::messagesActivityListTableCellSelectorFor(
139
+		'to',
140
+		'Registration Multi-status Summary',
141
+		MessagesAdmin::MESSAGE_STATUS_SENT,
142
+		'',
143
+		'Primary Registrant'
144
+	)
145 145
 );
146 146
 //there should still only be one admin multi-status summary thing.
147 147
 $I->verifyMatchingCountofTextInMessageActivityListTableFor(
148
-    1,
149
-    '[email protected]',
150
-    'to',
151
-    'Registration Multi-status Summary'
148
+	1,
149
+	'[email protected]',
150
+	'to',
151
+	'Registration Multi-status Summary'
152 152
 );
153 153
 
154 154
 //deactivate MER plugin so its not active for future tests
155 155
 $I->ensurePluginDeactivated(
156
-    'event-espresso-mer-multi-event-registration',
157
-    'plugins deactivated'
156
+	'event-espresso-mer-multi-event-registration',
157
+	'plugins deactivated'
158 158
 );
159 159
\ No newline at end of file
Please login to merge, or discard this patch.
acceptance_tests/tests/c-TestCustomMessageTemplateCept.php 1 patch
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@  discard block
 block discarded – undo
18 18
 $event_one_link = $event_two_link = $event_three_link = '';
19 19
 
20 20
 $I->wantTo(
21
-    'Test that when registrations for multiple events are completed, and those events share the same custom'
22
-    . 'template, that that custom template will be used.'
21
+	'Test that when registrations for multiple events are completed, and those events share the same custom'
22
+	. 'template, that that custom template will be used.'
23 23
 );
24 24
 
25 25
 //need the MER plugin active for this test (we'll deactivate it after).
26 26
 $I->ensurePluginActive(
27
-    'event-espresso-mer-multi-event-registration',
28
-    'activated'
27
+	'event-espresso-mer-multi-event-registration',
28
+	'activated'
29 29
 );
30 30
 
31 31
 $I->loginAsAdmin();
@@ -80,9 +80,9 @@  discard block
 block discarded – undo
80 80
 
81 81
 
82 82
 $test_registration_details = array(
83
-    'fname' => 'CTGuy',
84
-    'lname' => 'Dude',
85
-    'email' => '[email protected]'
83
+	'fname' => 'CTGuy',
84
+	'lname' => 'Dude',
85
+	'email' => '[email protected]'
86 86
 );
87 87
 
88 88
 $I->amGoingTo('Register for Event One and Event Two and verify Custom Template A was used.');
@@ -108,23 +108,23 @@  discard block
 block discarded – undo
108 108
 $I->loginAsAdmin();
109 109
 $I->amOnMessagesActivityListTablePage();
110 110
 $I->viewMessageInMessagesListTableFor(
111
-    'Registration Approved',
112
-    MessagesAdmin::MESSAGE_STATUS_SENT,
113
-    'Email',
114
-    'Registrant'
111
+	'Registration Approved',
112
+	MessagesAdmin::MESSAGE_STATUS_SENT,
113
+	'Email',
114
+	'Registrant'
115 115
 );
116 116
 $I->seeTextInViewMessageModal($custom_template_a_label);
117 117
 $I->dismissMessageModal();
118 118
 $I->deleteMessageInMessagesListTableFor(
119
-    'Registration Approved',
120
-    MessagesAdmin::MESSAGE_STATUS_SENT,
121
-    'Email',
122
-    'Registrant'
119
+	'Registration Approved',
120
+	MessagesAdmin::MESSAGE_STATUS_SENT,
121
+	'Email',
122
+	'Registrant'
123 123
 );
124 124
 
125 125
 //verify admin context
126 126
 $I->viewMessageInMessagesListTableFor(
127
-    'Registration Approved'
127
+	'Registration Approved'
128 128
 );
129 129
 $I->seeTextInViewMessageModal($custom_template_a_label);
130 130
 $I->dismissMessageModal();
@@ -153,25 +153,25 @@  discard block
 block discarded – undo
153 153
 $I->loginAsAdmin();
154 154
 $I->amOnMessagesActivityListTablePage();
155 155
 $I->viewMessageInMessagesListTableFor(
156
-    'Registration Approved',
157
-    MessagesAdmin::MESSAGE_STATUS_SENT,
158
-    'Email',
159
-    'Registrant'
156
+	'Registration Approved',
157
+	MessagesAdmin::MESSAGE_STATUS_SENT,
158
+	'Email',
159
+	'Registrant'
160 160
 );
161 161
 $I->waitForElementVisible(MessagesAdmin::MESSAGES_LIST_TABLE_VIEW_MESSAGE_DIALOG_CONTAINER_SELECTOR);
162 162
 $I->dontSeeTextInViewMessageModal($custom_template_a_label);
163 163
 $I->dontSeeTextInViewMessageModal($custom_template_b_label);
164 164
 $I->dismissMessageModal();
165 165
 $I->deleteMessageInMessagesListTableFor(
166
-    'Registration Approved',
167
-    MessagesAdmin::MESSAGE_STATUS_SENT,
168
-    'Email',
169
-    'Registrant'
166
+	'Registration Approved',
167
+	MessagesAdmin::MESSAGE_STATUS_SENT,
168
+	'Email',
169
+	'Registrant'
170 170
 );
171 171
 
172 172
 //verify admin context
173 173
 $I->viewMessageInMessagesListTableFor(
174
-    'Registration Approved'
174
+	'Registration Approved'
175 175
 );
176 176
 $I->waitForElementVisible(MessagesAdmin::MESSAGES_LIST_TABLE_VIEW_MESSAGE_DIALOG_CONTAINER_SELECTOR);
177 177
 $I->dontSee($custom_template_a_label);
@@ -183,6 +183,6 @@  discard block
 block discarded – undo
183 183
 
184 184
 //deactivate MER plugin so its not active for future tests
185 185
 $I->ensurePluginDeactivated(
186
-    'event-espresso-mer-multi-event-registration',
187
-    'plugins deactivated'
186
+	'event-espresso-mer-multi-event-registration',
187
+	'plugins deactivated'
188 188
 );
189 189
\ No newline at end of file
Please login to merge, or discard this patch.
acceptance_tests/Helpers/RegistrationsAdmin.php 1 patch
Indentation   +134 added lines, -134 removed lines patch added patch discarded remove patch
@@ -15,139 +15,139 @@
 block discarded – undo
15 15
 trait RegistrationsAdmin
16 16
 {
17 17
 
18
-    /**
19
-     * This will select all checkboxes on a registration list table for the given array of
20
-     * registration ids.
21
-     * Assumes the actor is on a list table page for registrations.
22
-     * @param $registration_ids
23
-     */
24
-    public function selectBulkActionCheckboxesForRegistrationIds(array $registration_ids)
25
-    {
26
-        foreach ($registration_ids as $registration_id) {
27
-            $this->actor()->checkOption(
28
-                RegistrationsAdminPage::listTableCheckBoxSelectorForRegistrationId($registration_id)
29
-            );
30
-        }
31
-    }
32
-
33
-
34
-    /**
35
-     * Navigates the actor to the default registration list table page.
36
-     * @param string $additional_params
37
-     */
38
-    public function amOnDefaultRegistrationsListTableAdminPage($additional_params = '')
39
-    {
40
-        $this->actor()->amOnAdminPage(
41
-            RegistrationsAdminPage::registrationsDefaultAdminListTableUrl($additional_params)
42
-        );
43
-        //wait for page to fully load
44
-        $this->actor()->wait(5);
45
-    }
46
-
47
-
48
-    /**
49
-     * Will enter the provided value in the registration list table search field and execute a search for that value.
50
-     * @param string $search_text
51
-     */
52
-    public function searchForRegistrationOnRegistrationListTableWithText($search_text)
53
-    {
54
-        $this->amOnDefaultRegistrationsListTableAdminPage();
55
-        $this->actor()->fillField(RegistrationsAdminPage::SEARCH_INPUT_SELECTOR_LIST_TABLE_REGISTRATION, $search_text);
56
-        $this->actor()->click(CoreAdmin::LIST_TABLE_SEARCH_SUBMIT_SELECTOR);
57
-        $this->actor()->waitForText('Displaying search results for');
58
-    }
59
-
60
-
61
-
62
-    /**
63
-     * This will filter the registration list table to view registrations for the given event id.
64
-     * Assumption is made that you are logged into the admin but you do not need to be on the registration list table
65
-     * page.
66
-     *
67
-     * @param int $event_id  The id of the event viewing registrations for.
68
-     */
69
-    public function amViewingRegistrationsForEvent($event_id)
70
-    {
71
-        $this->actor()->amOnDefaultEventsListTablePage();
72
-        $this->actor()->click(EventsAdmin::listTableActionLinkRegistrationsForEvent($event_id));
73
-        $this->actor()->waitForText('Viewing registrations for the event');
74
-    }
75
-
76
-
77
-    /**
78
-     * This helper will initiate registering for the given event via the backend.
79
-     * @param int $event_id  The event to initiate registration for.
80
-     */
81
-    public function amOnAdminRegistrationPageForEvent($event_id)
82
-    {
83
-        $this->actor()->amViewingRegistrationsForEvent($event_id);
84
-        $this->actor()->click(RegistrationsAdminPage::BUTTON_ADD_NEW_REGISTRATION);
85
-        $this->actor()->waitForText('Adding Registration For');
86
-    }
87
-
88
-
89
-
90
-    /**
91
-     * This clicks the View Details Link for Registration with the given Id
92
-     * @param $registration_id
93
-     */
94
-    public function clickViewDetailsLinkForRegistrationWithId($registration_id)
95
-    {
96
-        $this->actor()->click(RegistrationsAdminPage::viewDetailsLinkSelectorForRegistrationId($registration_id));
97
-    }
98
-
99
-
100
-    /**
101
-     * /**
102
-     * This assumes you are on the admin details page for a registration in EE.  It selects the given status in the
103
-     * dropdown for changing registration status.
104
-     *
105
-     * @param string $status_label_or_value  Either the label for the dropdown option or the value for the option.
106
-     * @param $status_label_or_value
107
-     */
108
-    public function selectRegistrationStatusOnRegistrationDetailsPageFor($status_label_or_value)
109
-    {
110
-        $this->actor()->selectOption(
111
-            RegistrationsAdminPage::DROPDOWN_REGISTRATION_STATUS,
112
-            $status_label_or_value
113
-        );
114
-    }
115
-
116
-
117
-    /**
118
-     * This selects (or deselects) the "Send Related Messages" checkbox on the Registration Details page.
119
-     * @param bool $send_related_messages
120
-     */
121
-    public function selectSendRelatedMessagesOptionOnRegistrationDetailsPage($send_related_messages = true)
122
-    {
123
-        $send_related_messages
124
-            ? $this->actor()->selectOption(
125
-                RegistrationsAdminPage::DROPDOWN_SEND_RELATED_MESSAGES,
126
-                'Yes'
127
-            )
128
-            : $this->actor()->selecOption(
129
-                RegistrationsAdminPage::DROPDOWN_SEND_RELATED_MESSAGES,
130
-                'No'
131
-            );
132
-    }
133
-
134
-
135
-
136
-    /**
137
-     * This assumes you are on the admin details page for a registration in EE.  It selects the given status in the
138
-     * dropdown for changing registration status and submits the change.
139
-     *
140
-     * @param string $status_label_or_value  Either the label for the dropdown option or the value for the option.
141
-     * @param bool   $send_related_messages  Whether or not to send related messages after changing the bulk action.
142
-     */
143
-    public function changeRegistrationStatusOnRegistrationDetailsPageTo(
144
-        $status_label_or_value,
145
-        $send_related_messages = true
146
-    ) {
147
-        $this->actor()->selectRegistrationStatusOnRegistrationDetailsPageFor($status_label_or_value);
148
-        $this->actor()->selectSendRelatedMessagesOptionOnRegistrationDetailsPage($send_related_messages);
149
-        $this->actor()->click(RegistrationsAdminPage::BUTTON_UPDATE_REGISTRATION_STATUS);
150
-        $this->actor()->waitForText('Registration status has been set to');
151
-    }
18
+	/**
19
+	 * This will select all checkboxes on a registration list table for the given array of
20
+	 * registration ids.
21
+	 * Assumes the actor is on a list table page for registrations.
22
+	 * @param $registration_ids
23
+	 */
24
+	public function selectBulkActionCheckboxesForRegistrationIds(array $registration_ids)
25
+	{
26
+		foreach ($registration_ids as $registration_id) {
27
+			$this->actor()->checkOption(
28
+				RegistrationsAdminPage::listTableCheckBoxSelectorForRegistrationId($registration_id)
29
+			);
30
+		}
31
+	}
32
+
33
+
34
+	/**
35
+	 * Navigates the actor to the default registration list table page.
36
+	 * @param string $additional_params
37
+	 */
38
+	public function amOnDefaultRegistrationsListTableAdminPage($additional_params = '')
39
+	{
40
+		$this->actor()->amOnAdminPage(
41
+			RegistrationsAdminPage::registrationsDefaultAdminListTableUrl($additional_params)
42
+		);
43
+		//wait for page to fully load
44
+		$this->actor()->wait(5);
45
+	}
46
+
47
+
48
+	/**
49
+	 * Will enter the provided value in the registration list table search field and execute a search for that value.
50
+	 * @param string $search_text
51
+	 */
52
+	public function searchForRegistrationOnRegistrationListTableWithText($search_text)
53
+	{
54
+		$this->amOnDefaultRegistrationsListTableAdminPage();
55
+		$this->actor()->fillField(RegistrationsAdminPage::SEARCH_INPUT_SELECTOR_LIST_TABLE_REGISTRATION, $search_text);
56
+		$this->actor()->click(CoreAdmin::LIST_TABLE_SEARCH_SUBMIT_SELECTOR);
57
+		$this->actor()->waitForText('Displaying search results for');
58
+	}
59
+
60
+
61
+
62
+	/**
63
+	 * This will filter the registration list table to view registrations for the given event id.
64
+	 * Assumption is made that you are logged into the admin but you do not need to be on the registration list table
65
+	 * page.
66
+	 *
67
+	 * @param int $event_id  The id of the event viewing registrations for.
68
+	 */
69
+	public function amViewingRegistrationsForEvent($event_id)
70
+	{
71
+		$this->actor()->amOnDefaultEventsListTablePage();
72
+		$this->actor()->click(EventsAdmin::listTableActionLinkRegistrationsForEvent($event_id));
73
+		$this->actor()->waitForText('Viewing registrations for the event');
74
+	}
75
+
76
+
77
+	/**
78
+	 * This helper will initiate registering for the given event via the backend.
79
+	 * @param int $event_id  The event to initiate registration for.
80
+	 */
81
+	public function amOnAdminRegistrationPageForEvent($event_id)
82
+	{
83
+		$this->actor()->amViewingRegistrationsForEvent($event_id);
84
+		$this->actor()->click(RegistrationsAdminPage::BUTTON_ADD_NEW_REGISTRATION);
85
+		$this->actor()->waitForText('Adding Registration For');
86
+	}
87
+
88
+
89
+
90
+	/**
91
+	 * This clicks the View Details Link for Registration with the given Id
92
+	 * @param $registration_id
93
+	 */
94
+	public function clickViewDetailsLinkForRegistrationWithId($registration_id)
95
+	{
96
+		$this->actor()->click(RegistrationsAdminPage::viewDetailsLinkSelectorForRegistrationId($registration_id));
97
+	}
98
+
99
+
100
+	/**
101
+	 * /**
102
+	 * This assumes you are on the admin details page for a registration in EE.  It selects the given status in the
103
+	 * dropdown for changing registration status.
104
+	 *
105
+	 * @param string $status_label_or_value  Either the label for the dropdown option or the value for the option.
106
+	 * @param $status_label_or_value
107
+	 */
108
+	public function selectRegistrationStatusOnRegistrationDetailsPageFor($status_label_or_value)
109
+	{
110
+		$this->actor()->selectOption(
111
+			RegistrationsAdminPage::DROPDOWN_REGISTRATION_STATUS,
112
+			$status_label_or_value
113
+		);
114
+	}
115
+
116
+
117
+	/**
118
+	 * This selects (or deselects) the "Send Related Messages" checkbox on the Registration Details page.
119
+	 * @param bool $send_related_messages
120
+	 */
121
+	public function selectSendRelatedMessagesOptionOnRegistrationDetailsPage($send_related_messages = true)
122
+	{
123
+		$send_related_messages
124
+			? $this->actor()->selectOption(
125
+				RegistrationsAdminPage::DROPDOWN_SEND_RELATED_MESSAGES,
126
+				'Yes'
127
+			)
128
+			: $this->actor()->selecOption(
129
+				RegistrationsAdminPage::DROPDOWN_SEND_RELATED_MESSAGES,
130
+				'No'
131
+			);
132
+	}
133
+
134
+
135
+
136
+	/**
137
+	 * This assumes you are on the admin details page for a registration in EE.  It selects the given status in the
138
+	 * dropdown for changing registration status and submits the change.
139
+	 *
140
+	 * @param string $status_label_or_value  Either the label for the dropdown option or the value for the option.
141
+	 * @param bool   $send_related_messages  Whether or not to send related messages after changing the bulk action.
142
+	 */
143
+	public function changeRegistrationStatusOnRegistrationDetailsPageTo(
144
+		$status_label_or_value,
145
+		$send_related_messages = true
146
+	) {
147
+		$this->actor()->selectRegistrationStatusOnRegistrationDetailsPageFor($status_label_or_value);
148
+		$this->actor()->selectSendRelatedMessagesOptionOnRegistrationDetailsPage($send_related_messages);
149
+		$this->actor()->click(RegistrationsAdminPage::BUTTON_UPDATE_REGISTRATION_STATUS);
150
+		$this->actor()->waitForText('Registration status has been set to');
151
+	}
152 152
 
153 153
 }
154 154
\ No newline at end of file
Please login to merge, or discard this patch.
acceptance_tests/Helpers/Checkout.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -13,75 +13,75 @@
 block discarded – undo
13 13
  */
14 14
 trait Checkout
15 15
 {
16
-    /**
17
-     * @param     $value
18
-     * @param int $attendee_number
19
-     * @param bool  $admin  Used to indicate whether we're filling out the field from the context of the admin or not.
20
-     */
21
-    public function fillOutFirstNameFieldForAttendee($value, $attendee_number = 1, $admin = false)
22
-    {
23
-        $this->actor()->fillField(CheckoutPage::firstNameFieldSelectorForAttendeeNumber($attendee_number, $admin), $value);
24
-    }
16
+	/**
17
+	 * @param     $value
18
+	 * @param int $attendee_number
19
+	 * @param bool  $admin  Used to indicate whether we're filling out the field from the context of the admin or not.
20
+	 */
21
+	public function fillOutFirstNameFieldForAttendee($value, $attendee_number = 1, $admin = false)
22
+	{
23
+		$this->actor()->fillField(CheckoutPage::firstNameFieldSelectorForAttendeeNumber($attendee_number, $admin), $value);
24
+	}
25 25
 
26
-    /**
27
-     * @param     $value
28
-     * @param int $attendee_number
29
-     * @param bool  $admin  Used to indicate whether we're filling out the field from the context of the admin or not.
30
-     */
31
-    public function fillOutLastNameFieldForAttendee($value, $attendee_number = 1, $admin = false)
32
-    {
33
-        $this->actor()->fillField(CheckoutPage::lastNameFieldSelectorForAttendeeNumber($attendee_number, $admin), $value);
34
-    }
26
+	/**
27
+	 * @param     $value
28
+	 * @param int $attendee_number
29
+	 * @param bool  $admin  Used to indicate whether we're filling out the field from the context of the admin or not.
30
+	 */
31
+	public function fillOutLastNameFieldForAttendee($value, $attendee_number = 1, $admin = false)
32
+	{
33
+		$this->actor()->fillField(CheckoutPage::lastNameFieldSelectorForAttendeeNumber($attendee_number, $admin), $value);
34
+	}
35 35
 
36
-    /**
37
-     * @param     $value
38
-     * @param int $attendee_number
39
-     * @param bool  $admin  Used to indicate whether we're filling out the field from the context of the admin or not.
40
-     */
41
-    public function fillOutEmailFieldForAttendee($value, $attendee_number = 1, $admin = false)
42
-    {
43
-        $this->actor()->fillField(CheckoutPage::emailFieldSelectorForAttendeeNumber($attendee_number, $admin), $value);
44
-    }
36
+	/**
37
+	 * @param     $value
38
+	 * @param int $attendee_number
39
+	 * @param bool  $admin  Used to indicate whether we're filling out the field from the context of the admin or not.
40
+	 */
41
+	public function fillOutEmailFieldForAttendee($value, $attendee_number = 1, $admin = false)
42
+	{
43
+		$this->actor()->fillField(CheckoutPage::emailFieldSelectorForAttendeeNumber($attendee_number, $admin), $value);
44
+	}
45 45
 
46 46
 
47
-    /**
48
-     * Clicks the next registration step button.
49
-     */
50
-    public function goToNextRegistrationStep()
51
-    {
52
-        $this->actor()->click(CheckoutPage::NEXT_STEP_BUTTON_SELECTOR);
53
-    }
47
+	/**
48
+	 * Clicks the next registration step button.
49
+	 */
50
+	public function goToNextRegistrationStep()
51
+	{
52
+		$this->actor()->click(CheckoutPage::NEXT_STEP_BUTTON_SELECTOR);
53
+	}
54 54
 
55 55
 
56
-    /**
57
-     * Selects the payment option for the given payment method slug.
58
-     *
59
-     * @param string $payment_method_slug
60
-     * @param bool   $verify_selected      If true, this will wait for the "Important Information" info box after the
61
-     *                                     payment option select box is complete.  Otherwise its up to calling code to
62
-     *                                     wait for whatever is needed after selecting the payment method.
63
-     */
64
-    public function selectPaymentOptionFor($payment_method_slug = 'invoice', $verify_selected = true)
65
-    {
66
-        $this->waitForElementVisible(CheckoutPage::SELECTOR_PAYMENT_OPTIONS_CONTAINER);
67
-        $this->wait(5);
68
-        $this->actor()->selectOption(
69
-            CheckoutPage::PAYMENT_METHOD_STEP_FORM,
70
-            $payment_method_slug
71
-        );
72
-        if ($verify_selected) {
73
-            $this->actor()->waitForText('Important information regarding your payment');
74
-        }
75
-    }
56
+	/**
57
+	 * Selects the payment option for the given payment method slug.
58
+	 *
59
+	 * @param string $payment_method_slug
60
+	 * @param bool   $verify_selected      If true, this will wait for the "Important Information" info box after the
61
+	 *                                     payment option select box is complete.  Otherwise its up to calling code to
62
+	 *                                     wait for whatever is needed after selecting the payment method.
63
+	 */
64
+	public function selectPaymentOptionFor($payment_method_slug = 'invoice', $verify_selected = true)
65
+	{
66
+		$this->waitForElementVisible(CheckoutPage::SELECTOR_PAYMENT_OPTIONS_CONTAINER);
67
+		$this->wait(5);
68
+		$this->actor()->selectOption(
69
+			CheckoutPage::PAYMENT_METHOD_STEP_FORM,
70
+			$payment_method_slug
71
+		);
72
+		if ($verify_selected) {
73
+			$this->actor()->waitForText('Important information regarding your payment');
74
+		}
75
+	}
76 76
 
77 77
 
78
-    /**
79
-     * Submits the payment options step form.
80
-     * Assumes the actor is in the context of the payment options SPCO step.
81
-     */
82
-    public function submitPaymentOptionsRegistrationStepForm()
83
-    {
84
-        $this->actor()->submitForm(CheckoutPage::PAYMENT_METHOD_STEP_FORM, array());
85
-    }
78
+	/**
79
+	 * Submits the payment options step form.
80
+	 * Assumes the actor is in the context of the payment options SPCO step.
81
+	 */
82
+	public function submitPaymentOptionsRegistrationStepForm()
83
+	{
84
+		$this->actor()->submitForm(CheckoutPage::PAYMENT_METHOD_STEP_FORM, array());
85
+	}
86 86
 
87 87
 }
88 88
\ No newline at end of file
Please login to merge, or discard this patch.
acceptance_tests/Page/TicketSelector.php 1 patch
Indentation   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -12,27 +12,27 @@
 block discarded – undo
12 12
 class TicketSelector
13 13
 {
14 14
 
15
-    /**
16
-     * Return the selector for the ticket option select input for the given event id.
17
-     * @param int|string $event_id
18
-     * @return string
19
-     */
20
-    public static function ticketOptionByEventIdSelector($event_id)
21
-    {
22
-        return "//select[@id='ticket-selector-tbl-qty-slct-$event_id-1']";
23
-    }
15
+	/**
16
+	 * Return the selector for the ticket option select input for the given event id.
17
+	 * @param int|string $event_id
18
+	 * @return string
19
+	 */
20
+	public static function ticketOptionByEventIdSelector($event_id)
21
+	{
22
+		return "//select[@id='ticket-selector-tbl-qty-slct-$event_id-1']";
23
+	}
24 24
 
25 25
 
26
-    /**
27
-     * Return the selector for the submit button for the ticket selector for the given event id.
28
-     * @param int|string $event_id
29
-     * @param bool       $admin     Used to return the selector from the context of the admin (true) or frontend (false)
30
-     * @return string
31
-     */
32
-    public static function ticketSelectionSubmitSelectorByEventId($event_id, $admin = false)
33
-    {
34
-        return $admin
35
-            ? "#ee-new-registration-step-button"
36
-            : "#ticket-selector-submit-$event_id-btn";
37
-    }
26
+	/**
27
+	 * Return the selector for the submit button for the ticket selector for the given event id.
28
+	 * @param int|string $event_id
29
+	 * @param bool       $admin     Used to return the selector from the context of the admin (true) or frontend (false)
30
+	 * @return string
31
+	 */
32
+	public static function ticketSelectionSubmitSelectorByEventId($event_id, $admin = false)
33
+	{
34
+		return $admin
35
+			? "#ee-new-registration-step-button"
36
+			: "#ticket-selector-submit-$event_id-btn";
37
+	}
38 38
 }
39 39
\ No newline at end of file
Please login to merge, or discard this patch.
acceptance_tests/Page/RegistrationsAdmin.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -12,47 +12,47 @@
 block discarded – undo
12 12
 class RegistrationsAdmin extends CoreAdmin
13 13
 {
14 14
 
15
-    const REGISTRATION_STATUS_NOT_APPROVED = 'RNA';
16
-    const REGISTRATION_STATUS_APPROVED = 'RAP';
17
-    const REGISTRATION_STATUS_PENDING_PAYMENT = 'RPP';
18
-    const SEARCH_INPUT_SELECTOR_LIST_TABLE_REGISTRATION = '#event-espresso_page_espresso_registrations-search-input';
19
-    const BUTTON_ADD_NEW_REGISTRATION = '#add-new-registration';
20
-    const DROPDOWN_REGISTRATION_STATUS = '#reg-status-change-form-reg-status';
21
-    const BUTTON_UPDATE_REGISTRATION_STATUS = '#reg-status-change-form-submit-submit';
22
-    const DROPDOWN_SEND_RELATED_MESSAGES = '#reg-status-change-form-send-notifications';
23
-
24
-
25
-    /**
26
-     * @param string $additional_params
27
-     * @return string
28
-     */
29
-    public static function registrationsDefaultAdminListTableUrl($additional_params = '')
30
-    {
31
-        return self::adminUrl('espresso_registrations', 'default', $additional_params);
32
-    }
33
-
34
-
35
-    /**
36
-     * Given a registration id, this will return the selector for all the checkbox for that id.
37
-     * Assumes the view is the default registrations list table.
38
-     * @param int $registration_id
39
-     * @return string
40
-     */
41
-    public static function listTableCheckBoxSelectorForRegistrationId($registration_id)
42
-    {
43
-        return "//input[@name='_REG_ID[]' and @value='{$registration_id}']";
44
-    }
45
-
46
-
47
-    /**
48
-     * Given a registration id, this will return the selector for the link to the registration details.
49
-     * Assumes the view is the default registrations list table.
50
-     * @param int $registration_id
51
-     * @return string
52
-     */
53
-    public static function viewDetailsLinkSelectorForRegistrationId($registration_id)
54
-    {
55
-        return "//tbody[@id='the-list']/tr/td[contains(@class, 'column-_REG_ID') and contains(., $registration_id)]"
56
-            . "//ancestor::tr/td[contains(@class, 'column-ATT_fname')]/a[1]";
57
-    }
15
+	const REGISTRATION_STATUS_NOT_APPROVED = 'RNA';
16
+	const REGISTRATION_STATUS_APPROVED = 'RAP';
17
+	const REGISTRATION_STATUS_PENDING_PAYMENT = 'RPP';
18
+	const SEARCH_INPUT_SELECTOR_LIST_TABLE_REGISTRATION = '#event-espresso_page_espresso_registrations-search-input';
19
+	const BUTTON_ADD_NEW_REGISTRATION = '#add-new-registration';
20
+	const DROPDOWN_REGISTRATION_STATUS = '#reg-status-change-form-reg-status';
21
+	const BUTTON_UPDATE_REGISTRATION_STATUS = '#reg-status-change-form-submit-submit';
22
+	const DROPDOWN_SEND_RELATED_MESSAGES = '#reg-status-change-form-send-notifications';
23
+
24
+
25
+	/**
26
+	 * @param string $additional_params
27
+	 * @return string
28
+	 */
29
+	public static function registrationsDefaultAdminListTableUrl($additional_params = '')
30
+	{
31
+		return self::adminUrl('espresso_registrations', 'default', $additional_params);
32
+	}
33
+
34
+
35
+	/**
36
+	 * Given a registration id, this will return the selector for all the checkbox for that id.
37
+	 * Assumes the view is the default registrations list table.
38
+	 * @param int $registration_id
39
+	 * @return string
40
+	 */
41
+	public static function listTableCheckBoxSelectorForRegistrationId($registration_id)
42
+	{
43
+		return "//input[@name='_REG_ID[]' and @value='{$registration_id}']";
44
+	}
45
+
46
+
47
+	/**
48
+	 * Given a registration id, this will return the selector for the link to the registration details.
49
+	 * Assumes the view is the default registrations list table.
50
+	 * @param int $registration_id
51
+	 * @return string
52
+	 */
53
+	public static function viewDetailsLinkSelectorForRegistrationId($registration_id)
54
+	{
55
+		return "//tbody[@id='the-list']/tr/td[contains(@class, 'column-_REG_ID') and contains(., $registration_id)]"
56
+			. "//ancestor::tr/td[contains(@class, 'column-ATT_fname')]/a[1]";
57
+	}
58 58
 }
59 59
\ No newline at end of file
Please login to merge, or discard this patch.
acceptance_tests/Page/Checkout.php 1 patch
Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -13,71 +13,71 @@
 block discarded – undo
13 13
 class Checkout
14 14
 {
15 15
 
16
-    /**
17
-     * The class selector for the next step button in the checkout.
18
-     * @var string
19
-     */
20
-    const NEXT_STEP_BUTTON_SELECTOR = '.spco-next-step-btn';
21
-
22
-
23
-    const PAYMENT_METHOD_STEP_FORM = '#ee-spco-payment_options-reg-step-form';
24
-
25
-
26
-    const SELECTOR_PAYMENT_OPTIONS_CONTAINER = '#spco-available-methods-of-payment-dv';
27
-
28
-
29
-    /**
30
-     * @param int $attendee_number
31
-     * @param bool  $admin  Used to indicate whether we're retrieving the selector from the context of the admin or not.
32
-     * @return string
33
-     */
34
-    public static function firstNameFieldSelectorForAttendeeNumber($attendee_number = 1, $admin = false)
35
-    {
36
-        return self::fieldSelectorForAttendeeNumber('fname', $attendee_number, $admin);
37
-    }
38
-
39
-
40
-    /**
41
-     * @param int $attendee_number
42
-     * @param bool  $admin  Used to indicate whether we're retrieving the selector from the context of the admin or not.
43
-     * @return string
44
-     */
45
-    public static function lastNameFieldSelectorForAttendeeNumber($attendee_number = 1, $admin = false)
46
-    {
47
-        return self::fieldSelectorForAttendeeNumber('lname', $attendee_number, $admin);
48
-    }
49
-
50
-
51
-    /**
52
-     * @param int $attendee_number
53
-     * @param bool  $admin  Used to indicate whether we're retrieving the selector from the context of the admin or not.
54
-     * @return string
55
-     */
56
-    public static function emailFieldSelectorForAttendeeNumber($attendee_number = 1, $admin = false)
57
-    {
58
-        return self::fieldSelectorForAttendeeNumber('email', $attendee_number, $admin);
59
-    }
60
-
61
-    /**
62
-     * @param string    $field_name
63
-     * @param int $attendee_number
64
-     * @param bool  $admin  Used to indicate whether we're retrieving the selector from the context of the admin or not.
65
-     * @return string
66
-     */
67
-    public static function fieldSelectorForAttendeeNumber($field_name, $attendee_number = 1, $admin = false)
68
-    {
69
-        return $admin
70
-                ? "//fieldset[starts-with(@id, 'ee-registration-$attendee_number')]//input[contains(@class, 'ee-reg-qstn-$field_name')]"
71
-                : "//div[starts-with(@id, 'spco-attendee-panel-dv-$attendee_number')]//input[contains(@class, 'ee-reg-qstn-$field_name')]";
72
-    }
73
-
74
-
75
-    /**
76
-     * @param string $payment_method_slug Slug for the payment method.
77
-     * @return string
78
-     */
79
-    public static function fieldSelectorForPaymentOption($payment_method_slug)
80
-    {
81
-        return "#ee-available-payment-method-inputs-{$payment_method_slug}";
82
-    }
16
+	/**
17
+	 * The class selector for the next step button in the checkout.
18
+	 * @var string
19
+	 */
20
+	const NEXT_STEP_BUTTON_SELECTOR = '.spco-next-step-btn';
21
+
22
+
23
+	const PAYMENT_METHOD_STEP_FORM = '#ee-spco-payment_options-reg-step-form';
24
+
25
+
26
+	const SELECTOR_PAYMENT_OPTIONS_CONTAINER = '#spco-available-methods-of-payment-dv';
27
+
28
+
29
+	/**
30
+	 * @param int $attendee_number
31
+	 * @param bool  $admin  Used to indicate whether we're retrieving the selector from the context of the admin or not.
32
+	 * @return string
33
+	 */
34
+	public static function firstNameFieldSelectorForAttendeeNumber($attendee_number = 1, $admin = false)
35
+	{
36
+		return self::fieldSelectorForAttendeeNumber('fname', $attendee_number, $admin);
37
+	}
38
+
39
+
40
+	/**
41
+	 * @param int $attendee_number
42
+	 * @param bool  $admin  Used to indicate whether we're retrieving the selector from the context of the admin or not.
43
+	 * @return string
44
+	 */
45
+	public static function lastNameFieldSelectorForAttendeeNumber($attendee_number = 1, $admin = false)
46
+	{
47
+		return self::fieldSelectorForAttendeeNumber('lname', $attendee_number, $admin);
48
+	}
49
+
50
+
51
+	/**
52
+	 * @param int $attendee_number
53
+	 * @param bool  $admin  Used to indicate whether we're retrieving the selector from the context of the admin or not.
54
+	 * @return string
55
+	 */
56
+	public static function emailFieldSelectorForAttendeeNumber($attendee_number = 1, $admin = false)
57
+	{
58
+		return self::fieldSelectorForAttendeeNumber('email', $attendee_number, $admin);
59
+	}
60
+
61
+	/**
62
+	 * @param string    $field_name
63
+	 * @param int $attendee_number
64
+	 * @param bool  $admin  Used to indicate whether we're retrieving the selector from the context of the admin or not.
65
+	 * @return string
66
+	 */
67
+	public static function fieldSelectorForAttendeeNumber($field_name, $attendee_number = 1, $admin = false)
68
+	{
69
+		return $admin
70
+				? "//fieldset[starts-with(@id, 'ee-registration-$attendee_number')]//input[contains(@class, 'ee-reg-qstn-$field_name')]"
71
+				: "//div[starts-with(@id, 'spco-attendee-panel-dv-$attendee_number')]//input[contains(@class, 'ee-reg-qstn-$field_name')]";
72
+	}
73
+
74
+
75
+	/**
76
+	 * @param string $payment_method_slug Slug for the payment method.
77
+	 * @return string
78
+	 */
79
+	public static function fieldSelectorForPaymentOption($payment_method_slug)
80
+	{
81
+		return "#ee-available-payment-method-inputs-{$payment_method_slug}";
82
+	}
83 83
 }
Please login to merge, or discard this patch.