Completed
Branch BUG-10738-inconsistency-in-ses... (a1eed8)
by
unknown
24:27 queued 12:29
created
acceptance_tests/Page/MessagesAdmin.php 1 patch
Indentation   +267 added lines, -267 removed lines patch added patch discarded remove patch
@@ -14,292 +14,292 @@
 block discarded – undo
14 14
 class MessagesAdmin extends CoreAdmin
15 15
 {
16 16
 
17
-    /**
18
-     * Context slug for the admin messages context.
19
-     */
20
-    const ADMIN_CONTEXT_SLUG = 'admin';
17
+	/**
18
+	 * Context slug for the admin messages context.
19
+	 */
20
+	const ADMIN_CONTEXT_SLUG = 'admin';
21 21
 
22
-    /**
23
-     * Context slug for the primary attendee messages context
24
-     */
25
-    const PRIMARY_ATTENDEE_CONTEXT_SLUG = 'primary_attendee';
22
+	/**
23
+	 * Context slug for the primary attendee messages context
24
+	 */
25
+	const PRIMARY_ATTENDEE_CONTEXT_SLUG = 'primary_attendee';
26 26
 
27 27
 
28
-    /**
29
-     * Context slug for the attendee messages context
30
-     */
31
-    const ATTENDEE_CONTEXT_SLUG = 'attendee';
28
+	/**
29
+	 * Context slug for the attendee messages context
30
+	 */
31
+	const ATTENDEE_CONTEXT_SLUG = 'attendee';
32 32
 
33 33
 
34
-    /**
35
-     * Status reference for the EEM_Message::status_sent status.
36
-     */
37
-    const MESSAGE_STATUS_SENT = 'MSN';
34
+	/**
35
+	 * Status reference for the EEM_Message::status_sent status.
36
+	 */
37
+	const MESSAGE_STATUS_SENT = 'MSN';
38 38
 
39 39
 
40
-    /**
41
-     * Message type slug for the Payment Failed message type
42
-     */
43
-    const PAYMENT_FAILED_MESSAGE_TYPE_SLUG = 'payment_failed';
40
+	/**
41
+	 * Message type slug for the Payment Failed message type
42
+	 */
43
+	const PAYMENT_FAILED_MESSAGE_TYPE_SLUG = 'payment_failed';
44 44
 
45 45
 
46
-    /**
47
-     * Message type slug for the Registration Pending Payment message type
48
-     */
49
-    const MESSAGE_TYPE_PENDING_PAYMENT = 'pending_approval';
46
+	/**
47
+	 * Message type slug for the Registration Pending Payment message type
48
+	 */
49
+	const MESSAGE_TYPE_PENDING_PAYMENT = 'pending_approval';
50 50
 
51 51
 
52
-    /**
53
-     * Selector for the Global Messages "Send on same request" field in the Messages Settings tab.
54
-     */
55
-    const GLOBAL_MESSAGES_SETTINGS_ON_REQUEST_SELECTION_SELECTOR =
56
-        '#global_messages_settings-do-messages-on-same-request';
52
+	/**
53
+	 * Selector for the Global Messages "Send on same request" field in the Messages Settings tab.
54
+	 */
55
+	const GLOBAL_MESSAGES_SETTINGS_ON_REQUEST_SELECTION_SELECTOR =
56
+		'#global_messages_settings-do-messages-on-same-request';
57 57
 
58 58
 
59
-    /**
60
-     * Selector for the Global Messages Settings submit button in the Messages Settings tab.
61
-     */
62
-    const GLOBAL_MESSAGES_SETTINGS_SUBMIT_SELECTOR = '#global_messages_settings-update-settings-submit';
59
+	/**
60
+	 * Selector for the Global Messages Settings submit button in the Messages Settings tab.
61
+	 */
62
+	const GLOBAL_MESSAGES_SETTINGS_SUBMIT_SELECTOR = '#global_messages_settings-update-settings-submit';
63 63
 
64 64
 
65
-    /**
66
-     * This is the container where active message types for a messenger are found/dragged to.
67
-     */
68
-    const MESSAGES_SETTINGS_ACTIVE_MESSAGE_TYPES_CONTAINER_SELECTOR = '#active-message-types';
65
+	/**
66
+	 * This is the container where active message types for a messenger are found/dragged to.
67
+	 */
68
+	const MESSAGES_SETTINGS_ACTIVE_MESSAGE_TYPES_CONTAINER_SELECTOR = '#active-message-types';
69 69
 
70 70
 
71
-    /**
72
-     * Locator for the context switcher selector on the Message Template Editor page.
73
-     */
74
-    const MESSAGES_CONTEXT_SWITCHER_SELECTOR = "//form[@id='ee-msg-context-switcher-frm']/select";
71
+	/**
72
+	 * Locator for the context switcher selector on the Message Template Editor page.
73
+	 */
74
+	const MESSAGES_CONTEXT_SWITCHER_SELECTOR = "//form[@id='ee-msg-context-switcher-frm']/select";
75 75
 
76 76
 
77
-    /**
78
-     * Locator for the context switcher submit button in the Message Template Editor page.
79
-     */
80
-    const MESSAGES_CONTEXT_SWITCHER_BUTTON_SELECTOR = "#submit-msg-context-switcher-sbmt";
77
+	/**
78
+	 * Locator for the context switcher submit button in the Message Template Editor page.
79
+	 */
80
+	const MESSAGES_CONTEXT_SWITCHER_BUTTON_SELECTOR = "#submit-msg-context-switcher-sbmt";
81 81
 
82 82
 
83
-    /**
84
-     * Locator for the dialog container used for housing viewed messages in the message activity list table.
85
-     */
86
-    const MESSAGES_LIST_TABLE_VIEW_MESSAGE_DIALOG_CONTAINER_SELECTOR = '.ee-admin-dialog-container-inner-content';
87
-
88
-
89
-    /**
90
-     * Returns the selector for the on/off toggle for context on the message template editor.
91
-     */
92
-    const MESSAGES_CONTEXT_ACTIVE_STATE_TOGGLE =
93
-        "//div[@class='activate_context_on_off_toggle_container']/div[@class='switch']/label";
94
-
95
-
96
-    const SELECTOR_LINK_FINALIZE_PAYMENT_PENDING_PAYMENT_MESSAGE = "//td/p[@class='callout']/a";
97
-
98
-
99
-
100
-    /**
101
-     * @param string $additional_params Any additional request parameters for the generated url should be included as
102
-     *                                  a string.
103
-     * @return string
104
-     */
105
-    public static function messageActivityListTableUrl($additional_params = '')
106
-    {
107
-        return self::adminUrl('espresso_messages', 'default', $additional_params);
108
-    }
109
-
110
-
111
-    /**
112
-     * @param string $additional_params Any additional request parameters for the generated url should be included as
113
-     *                                  a string.
114
-     * @return string
115
-     */
116
-    public static function defaultMessageTemplateListTableUrl($additional_params = '')
117
-    {
118
-        return self::adminUrl('espresso_messages', 'global_mtps', $additional_params);
119
-    }
120
-
121
-
122
-    /**
123
-     * @param string $additional_params Any additional request parameters for the generated url should be included as
124
-     *                                  a string.
125
-     * @return string
126
-     */
127
-    public static function customMessageTemplateListTableUrl($additional_params = '')
128
-    {
129
-        return self::adminUrl('espresso_messages', 'custom_mtps', $additional_params);
130
-    }
131
-
132
-
133
-    /**
134
-     * @return string
135
-     */
136
-    public static function messageSettingsUrl()
137
-    {
138
-        return self::adminUrl('espresso_messages', 'settings');
139
-    }
140
-
141
-
142
-
143
-    public static function draggableSettingsBoxSelectorForMessageTypeAndMessenger(
144
-        $message_type_slug,
145
-        $messenger_slug = 'email'
146
-    ) {
147
-        return "#$message_type_slug-messagetype-$messenger_slug";
148
-    }
149
-
150
-
151
-    /**
152
-     * @param string $message_type_slug
153
-     * @param string $context
154
-     * @return string
155
-     */
156
-    public static function editMessageTemplateClassByMessageType($message_type_slug, $context = '')
157
-    {
158
-        return $context
159
-            ? '.' . $message_type_slug . '-' . $context . '-edit-link'
160
-            : '.' . $message_type_slug . '-edit-link';
161
-    }
162
-
163
-
164
-    /**
165
-     * Selector for (a) specific table cell(s) in the Messages Activity list table for the given parameters.
166
-     *
167
-     * @param        $field
168
-     * @param        $message_type_label
169
-     * @param string $message_status
170
-     * @param string $messenger
171
-     * @param string $context
172
-     * @param string $table_cell_content_for_field
173
-     * @param int    $number_in_set   It's possible that the given parameters could match multiple items in the view.
174
-     *                                This allows you to indicate which item from the set to match.  If this is set to 0
175
-     *                                then all matches for the locator will be returned.
176
-     * @return string
177
-     * @throws \InvalidArgumentException
178
-     */
179
-    public static function messagesActivityListTableCellSelectorFor(
180
-        $field,
181
-        $message_type_label,
182
-        $message_status = self::MESSAGE_STATUS_SENT,
183
-        $messenger = 'Email',
184
-        $context = 'Event Admin',
185
-        $table_cell_content_for_field = '',
186
-        $number_in_set = 1
187
-    ) {
188
-        $selector = "//tbody[@id='the-list']";
189
-        $selector .= "//tr[contains(@class, 'msg-status-$message_status')]"
190
-                     . "//td[contains(@class, 'message_type') and text()='$message_type_label']";
191
-        if ($messenger) {
192
-            $selector .= "/ancestor::tr/td[contains(@class, 'messenger') and text()='$messenger']";
193
-        }
194
-        $selector .= "/ancestor::tr/td[contains(@class, 'column-context') and text()='$context']";
195
-        $selector .= $table_cell_content_for_field
196
-            ? "/ancestor::tr/td[contains(@class, 'column-$field') and text()='$table_cell_content_for_field']"
197
-            : "/ancestor::tr/td[contains(@class, 'column-$field')]";
198
-        return $number_in_set > 0 ? Locator::elementAt($selector, $number_in_set) : $selector;
199
-    }
200
-
201
-
202
-    /**
203
-     * Selector for the Create Custom button found in the message template list table.
204
-     * @param string $message_type_label
205
-     * @param string $messenger_label
206
-     * @return string
207
-     */
208
-    public static function createCustomButtonForMessageTypeAndMessenger($message_type_label, $messenger_label)
209
-    {
210
-        $selector = "//tr/td[contains(@class, 'message_type') and text()='$message_type_label']"
211
-                    . "//ancestor::tr/td[contains(@class, 'messenger') and contains(., '$messenger_label')]"
212
-                    . "//ancestor::tr/td/a[@class='button button-small']";
213
-        return $selector;
214
-    }
215
-
216
-
217
-    /**
218
-     * Note, this could potentially match multiple buttons in the view so the selector is intentionally restricted to
219
-     * the FIRST match (which will be the latest message sent if the table is default sorted).
220
-     *
221
-     * @param string $message_type_label    The visible message type label for the row you want to match
222
-     * @param string $message_status        The status of the message for the row you want to match.
223
-     * @param string $messenger             The visible messenger label for the row you want to match.
224
-     * @param string $context               The visible context label for the row you want to match.
225
-     * @param int    $number_in_set         It's possible that the given parameters could match multiple items in the
226
-     *                                      view. This allows you to indicate which item from the set to match.
227
-     * @return string
228
-     * @throws \InvalidArgumentException
229
-     */
230
-    public static function messagesActivityListTableViewButtonSelectorFor(
231
-        $message_type_label,
232
-        $message_status = self::MESSAGE_STATUS_SENT,
233
-        $messenger = 'Email',
234
-        $context = 'Event Admin',
235
-        $number_in_set = 1
236
-    ) {
237
-        $selector = self::messagesActivityListTableCellSelectorFor(
238
-            'action',
239
-            $message_type_label,
240
-            $message_status,
241
-            $messenger,
242
-            $context,
243
-            '',
244
-            $number_in_set
245
-        );
246
-        $selector .= "/a/span[contains(@class, 'ee-message-action-link-view')"
247
-                     . " and not(contains(@class, 'ee-message-action-link-view_transaction'))]";
248
-        return $selector;
249
-    }
250
-
251
-
252
-    /**
253
-     * Locator for the delete action link for a message item in the message activity list table.
254
-     * Note: The link is not visible by default, so the column would need hovered over for the link to appear.
255
-     *
256
-     * @param        $message_type_label
257
-     * @param string $message_status
258
-     * @param string $messenger
259
-     * @param string $context
260
-     * @param int    $number_in_set
261
-     * @return string
262
-     * @throws \InvalidArgumentException
263
-     */
264
-    public static function messagesActivityListTableDeleteActionSelectorFor(
265
-        $message_type_label,
266
-        $message_status = self::MESSAGE_STATUS_SENT,
267
-        $messenger = 'Email',
268
-        $context = 'Event Admin',
269
-        $number_in_set = 1
270
-    ) {
271
-        $selector = self::messagesActivityListTableCellSelectorFor(
272
-            'to',
273
-            $message_type_label,
274
-            $message_status,
275
-            $messenger,
276
-            $context,
277
-            '',
278
-            $number_in_set
279
-        );
280
-        $selector .= "/div/span[@class='delete']/a";
281
-        return $selector;
282
-    }
283
-
284
-
285
-
286
-    /**
287
-     * Returns the input selector for a given field in the message template editor.
288
-     * Assumes one is already viewing the Message Template Editor.
289
-     * @param string     $field
290
-     * @return string
291
-     */
292
-    public static function messageInputFieldSelectorFor($field)
293
-    {
294
-        return "//div[@id='post-body']//input[@id='$field-content']";
295
-    }
296
-
297
-
298
-    /**
299
-     * Wrapper for self::messageInputFieldSelectorFor('to') that takes care of getting the input for the To field.
300
-     */
301
-    public static function messageTemplateToFieldSelector()
302
-    {
303
-        return self::messageInputFieldSelectorFor('to');
304
-    }
83
+	/**
84
+	 * Locator for the dialog container used for housing viewed messages in the message activity list table.
85
+	 */
86
+	const MESSAGES_LIST_TABLE_VIEW_MESSAGE_DIALOG_CONTAINER_SELECTOR = '.ee-admin-dialog-container-inner-content';
87
+
88
+
89
+	/**
90
+	 * Returns the selector for the on/off toggle for context on the message template editor.
91
+	 */
92
+	const MESSAGES_CONTEXT_ACTIVE_STATE_TOGGLE =
93
+		"//div[@class='activate_context_on_off_toggle_container']/div[@class='switch']/label";
94
+
95
+
96
+	const SELECTOR_LINK_FINALIZE_PAYMENT_PENDING_PAYMENT_MESSAGE = "//td/p[@class='callout']/a";
97
+
98
+
99
+
100
+	/**
101
+	 * @param string $additional_params Any additional request parameters for the generated url should be included as
102
+	 *                                  a string.
103
+	 * @return string
104
+	 */
105
+	public static function messageActivityListTableUrl($additional_params = '')
106
+	{
107
+		return self::adminUrl('espresso_messages', 'default', $additional_params);
108
+	}
109
+
110
+
111
+	/**
112
+	 * @param string $additional_params Any additional request parameters for the generated url should be included as
113
+	 *                                  a string.
114
+	 * @return string
115
+	 */
116
+	public static function defaultMessageTemplateListTableUrl($additional_params = '')
117
+	{
118
+		return self::adminUrl('espresso_messages', 'global_mtps', $additional_params);
119
+	}
120
+
121
+
122
+	/**
123
+	 * @param string $additional_params Any additional request parameters for the generated url should be included as
124
+	 *                                  a string.
125
+	 * @return string
126
+	 */
127
+	public static function customMessageTemplateListTableUrl($additional_params = '')
128
+	{
129
+		return self::adminUrl('espresso_messages', 'custom_mtps', $additional_params);
130
+	}
131
+
132
+
133
+	/**
134
+	 * @return string
135
+	 */
136
+	public static function messageSettingsUrl()
137
+	{
138
+		return self::adminUrl('espresso_messages', 'settings');
139
+	}
140
+
141
+
142
+
143
+	public static function draggableSettingsBoxSelectorForMessageTypeAndMessenger(
144
+		$message_type_slug,
145
+		$messenger_slug = 'email'
146
+	) {
147
+		return "#$message_type_slug-messagetype-$messenger_slug";
148
+	}
149
+
150
+
151
+	/**
152
+	 * @param string $message_type_slug
153
+	 * @param string $context
154
+	 * @return string
155
+	 */
156
+	public static function editMessageTemplateClassByMessageType($message_type_slug, $context = '')
157
+	{
158
+		return $context
159
+			? '.' . $message_type_slug . '-' . $context . '-edit-link'
160
+			: '.' . $message_type_slug . '-edit-link';
161
+	}
162
+
163
+
164
+	/**
165
+	 * Selector for (a) specific table cell(s) in the Messages Activity list table for the given parameters.
166
+	 *
167
+	 * @param        $field
168
+	 * @param        $message_type_label
169
+	 * @param string $message_status
170
+	 * @param string $messenger
171
+	 * @param string $context
172
+	 * @param string $table_cell_content_for_field
173
+	 * @param int    $number_in_set   It's possible that the given parameters could match multiple items in the view.
174
+	 *                                This allows you to indicate which item from the set to match.  If this is set to 0
175
+	 *                                then all matches for the locator will be returned.
176
+	 * @return string
177
+	 * @throws \InvalidArgumentException
178
+	 */
179
+	public static function messagesActivityListTableCellSelectorFor(
180
+		$field,
181
+		$message_type_label,
182
+		$message_status = self::MESSAGE_STATUS_SENT,
183
+		$messenger = 'Email',
184
+		$context = 'Event Admin',
185
+		$table_cell_content_for_field = '',
186
+		$number_in_set = 1
187
+	) {
188
+		$selector = "//tbody[@id='the-list']";
189
+		$selector .= "//tr[contains(@class, 'msg-status-$message_status')]"
190
+					 . "//td[contains(@class, 'message_type') and text()='$message_type_label']";
191
+		if ($messenger) {
192
+			$selector .= "/ancestor::tr/td[contains(@class, 'messenger') and text()='$messenger']";
193
+		}
194
+		$selector .= "/ancestor::tr/td[contains(@class, 'column-context') and text()='$context']";
195
+		$selector .= $table_cell_content_for_field
196
+			? "/ancestor::tr/td[contains(@class, 'column-$field') and text()='$table_cell_content_for_field']"
197
+			: "/ancestor::tr/td[contains(@class, 'column-$field')]";
198
+		return $number_in_set > 0 ? Locator::elementAt($selector, $number_in_set) : $selector;
199
+	}
200
+
201
+
202
+	/**
203
+	 * Selector for the Create Custom button found in the message template list table.
204
+	 * @param string $message_type_label
205
+	 * @param string $messenger_label
206
+	 * @return string
207
+	 */
208
+	public static function createCustomButtonForMessageTypeAndMessenger($message_type_label, $messenger_label)
209
+	{
210
+		$selector = "//tr/td[contains(@class, 'message_type') and text()='$message_type_label']"
211
+					. "//ancestor::tr/td[contains(@class, 'messenger') and contains(., '$messenger_label')]"
212
+					. "//ancestor::tr/td/a[@class='button button-small']";
213
+		return $selector;
214
+	}
215
+
216
+
217
+	/**
218
+	 * Note, this could potentially match multiple buttons in the view so the selector is intentionally restricted to
219
+	 * the FIRST match (which will be the latest message sent if the table is default sorted).
220
+	 *
221
+	 * @param string $message_type_label    The visible message type label for the row you want to match
222
+	 * @param string $message_status        The status of the message for the row you want to match.
223
+	 * @param string $messenger             The visible messenger label for the row you want to match.
224
+	 * @param string $context               The visible context label for the row you want to match.
225
+	 * @param int    $number_in_set         It's possible that the given parameters could match multiple items in the
226
+	 *                                      view. This allows you to indicate which item from the set to match.
227
+	 * @return string
228
+	 * @throws \InvalidArgumentException
229
+	 */
230
+	public static function messagesActivityListTableViewButtonSelectorFor(
231
+		$message_type_label,
232
+		$message_status = self::MESSAGE_STATUS_SENT,
233
+		$messenger = 'Email',
234
+		$context = 'Event Admin',
235
+		$number_in_set = 1
236
+	) {
237
+		$selector = self::messagesActivityListTableCellSelectorFor(
238
+			'action',
239
+			$message_type_label,
240
+			$message_status,
241
+			$messenger,
242
+			$context,
243
+			'',
244
+			$number_in_set
245
+		);
246
+		$selector .= "/a/span[contains(@class, 'ee-message-action-link-view')"
247
+					 . " and not(contains(@class, 'ee-message-action-link-view_transaction'))]";
248
+		return $selector;
249
+	}
250
+
251
+
252
+	/**
253
+	 * Locator for the delete action link for a message item in the message activity list table.
254
+	 * Note: The link is not visible by default, so the column would need hovered over for the link to appear.
255
+	 *
256
+	 * @param        $message_type_label
257
+	 * @param string $message_status
258
+	 * @param string $messenger
259
+	 * @param string $context
260
+	 * @param int    $number_in_set
261
+	 * @return string
262
+	 * @throws \InvalidArgumentException
263
+	 */
264
+	public static function messagesActivityListTableDeleteActionSelectorFor(
265
+		$message_type_label,
266
+		$message_status = self::MESSAGE_STATUS_SENT,
267
+		$messenger = 'Email',
268
+		$context = 'Event Admin',
269
+		$number_in_set = 1
270
+	) {
271
+		$selector = self::messagesActivityListTableCellSelectorFor(
272
+			'to',
273
+			$message_type_label,
274
+			$message_status,
275
+			$messenger,
276
+			$context,
277
+			'',
278
+			$number_in_set
279
+		);
280
+		$selector .= "/div/span[@class='delete']/a";
281
+		return $selector;
282
+	}
283
+
284
+
285
+
286
+	/**
287
+	 * Returns the input selector for a given field in the message template editor.
288
+	 * Assumes one is already viewing the Message Template Editor.
289
+	 * @param string     $field
290
+	 * @return string
291
+	 */
292
+	public static function messageInputFieldSelectorFor($field)
293
+	{
294
+		return "//div[@id='post-body']//input[@id='$field-content']";
295
+	}
296
+
297
+
298
+	/**
299
+	 * Wrapper for self::messageInputFieldSelectorFor('to') that takes care of getting the input for the To field.
300
+	 */
301
+	public static function messageTemplateToFieldSelector()
302
+	{
303
+		return self::messageInputFieldSelectorFor('to');
304
+	}
305 305
 }
306 306
\ No newline at end of file
Please login to merge, or discard this patch.