1 | <?php |
||
11 | trait MessagesAdmin |
||
12 | { |
||
13 | /** |
||
14 | * @param string $additional_params Any additional request parameters for the generated url should be included as |
||
15 | * a string. |
||
16 | */ |
||
17 | public function amOnMessagesActivityListTablePage($additional_params = '') |
||
21 | |||
22 | /** |
||
23 | * @param string $additional_params Any additional request parameters for the generated url should be included as |
||
24 | * a string. |
||
25 | */ |
||
26 | public function amOnDefaultMessageTemplateListTablePage($additional_params = '') |
||
30 | |||
31 | |||
32 | /** |
||
33 | * @param string $additional_params Any additional request parameters for the generated url should be included as |
||
34 | * a string. |
||
35 | */ |
||
36 | public function amOnCustomMessageTemplateListTablePage($additional_params = '') |
||
40 | |||
41 | |||
42 | /** |
||
43 | * Directs to message settings page |
||
44 | */ |
||
45 | public function amOnMessageSettingsPage() |
||
49 | |||
50 | |||
51 | public function activateMessageTypeForMessenger($message_type_slug, $messenger_slug = 'email') |
||
58 | |||
59 | |||
60 | /** |
||
61 | * Assumes you are already on the list table page that has the ui for editing the template. |
||
62 | * @param string $message_type_slug |
||
63 | * @param string $context [optional] if you want to click directly to the given context in the editor |
||
64 | */ |
||
65 | public function clickToEditMessageTemplateByMessageType($message_type_slug, $context = '') |
||
69 | |||
70 | |||
71 | /** |
||
72 | * Use this action to verify that the count for the given text in the specified field is as expected. For example |
||
73 | * filling the condition of, "There should only be 1 instance of `[email protected]` in all the 'to' column. |
||
74 | * |
||
75 | * @param int $expected_occurence_count |
||
76 | * @param string $text_to_check_for |
||
77 | * @param string $field |
||
78 | * @param string $message_type_label |
||
79 | * @param string $message_status |
||
80 | * @param string $messenger |
||
81 | * @param string $context |
||
82 | */ |
||
83 | public function verifyMatchingCountofTextInMessageActivityListTableFor( |
||
114 | |||
115 | |||
116 | /** |
||
117 | * This will create a custom message template for the given messenger and message type from the context of the |
||
118 | * default (global) message template list table. |
||
119 | * Also takes care of verifying the template was created. |
||
120 | * @param string $message_type_label |
||
121 | * @param string $messenger_label |
||
122 | */ |
||
123 | public function createCustomMessageTemplateFromDefaultFor($message_type_label, $messenger_label) |
||
134 | |||
135 | |||
136 | /** |
||
137 | * This switches the context of the current messages template to the given reference. |
||
138 | * @param string $context_reference This should be the visible label for the option. |
||
139 | */ |
||
140 | public function switchContextTo($context_reference) |
||
146 | |||
147 | |||
148 | /** |
||
149 | * Toggles Context so its turned off or on (depending on where it started) and verifies the expected state after |
||
150 | * toggling. |
||
151 | * |
||
152 | * @param string $context_string What context is being switched (used for the expected state text) |
||
153 | * @param bool $expected_state_is_active Used to indicate whether the expected state is active (true) or inactive |
||
154 | * (false) |
||
155 | */ |
||
156 | public function toggleContextState($context_string, $expected_state_is_active = true) |
||
165 | |||
166 | |||
167 | /** |
||
168 | * Triggers saving the message template. |
||
169 | * @param bool $and_close Use to indicate to click the Save and Close button. |
||
170 | */ |
||
171 | public function saveMessageTemplate($and_close = false) |
||
180 | |||
181 | |||
182 | /** |
||
183 | * This takes care of clicking the View Message icon for the given parameters. |
||
184 | * Assumes you are already viewing the messages activity list table. |
||
185 | * @param $message_type_label |
||
186 | * @param $message_status |
||
187 | * @param string $messenger |
||
188 | * @param string $context |
||
189 | * @param int $number_in_set |
||
190 | */ |
||
191 | public function viewMessageInMessagesListTableFor( |
||
206 | |||
207 | |||
208 | /** |
||
209 | * Takes care of deleting a message matching the given parameters via the message activity list table. |
||
210 | * Assumes you are already viewing the messages activity list table. |
||
211 | * @param $message_type_label |
||
212 | * @param $message_status |
||
213 | * @param string $messenger |
||
214 | * @param string $context |
||
215 | * @param int $number_in_set |
||
216 | */ |
||
217 | public function deleteMessageInMessagesListTableFor( |
||
252 | |||
253 | |||
254 | /** |
||
255 | * Assuming you have already triggered the view modal for a single message from the context of the message activity |
||
256 | * list table, this will take care of validating the given text is in that window. |
||
257 | * @param string $text_to_view |
||
258 | */ |
||
259 | public function seeTextInViewMessageModal($text_to_view, $should_not_see = false) |
||
266 | |||
267 | |||
268 | /** |
||
269 | * This returns the value for the link at the given selector in the message modal. |
||
270 | * @param string $selector (any selector string accepted by WebDriver) |
||
271 | */ |
||
272 | public function observeLinkAtInMessageModal($selector) |
||
278 | |||
279 | |||
280 | /** |
||
281 | * Assuming you have already triggered the view modal for a single message from the context of the message activity |
||
282 | * list table, this will take care of validating the given text is NOT that window. |
||
283 | * @param string $text_to_view |
||
284 | */ |
||
285 | public function dontSeeTextInViewMessageModal($text_to_view) |
||
289 | |||
290 | |||
291 | public function dismissMessageModal() |
||
297 | } |
||
298 |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idable
provides a methodequalsId
that in turn relies on the methodgetId()
. If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()
as an abstract method to the trait will make sure it is available.