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 | * This takes care of clicking the View Message icon for the given parameters. |
||
150 | * Assumes you are already viewing the messages activity list table. |
||
151 | * @param $message_type_label |
||
152 | * @param $message_status |
||
153 | * @param string $messenger |
||
154 | * @param string $context |
||
155 | * @param int $number_in_set |
||
156 | */ |
||
157 | public function viewMessageInMessagesListTableFor( |
||
172 | |||
173 | |||
174 | /** |
||
175 | * Takes care of deleting a message matching the given parameters via the message activity list table. |
||
176 | * Assumes you are already viewing the messages activity list table. |
||
177 | * @param $message_type_label |
||
178 | * @param $message_status |
||
179 | * @param string $messenger |
||
180 | * @param string $context |
||
181 | * @param int $number_in_set |
||
182 | */ |
||
183 | public function deleteMessageInMessagesListTableFor( |
||
212 | |||
213 | |||
214 | /** |
||
215 | * Assuming you have already triggered the view modal for a single message from the context of the message activity |
||
216 | * list table, this will take care of validating the given text is in that window. |
||
217 | * @param string $text_to_view |
||
218 | */ |
||
219 | public function seeTextInViewMessageModal($text_to_view, $should_not_see = false) |
||
226 | |||
227 | |||
228 | /** |
||
229 | * Assuming you have already triggered the view modal for a single message from the context of the message activity |
||
230 | * list table, this will take care of validating the given text is NOT that window. |
||
231 | * @param string $text_to_view |
||
232 | */ |
||
233 | public function dontSeeTextInViewMessageModal($text_to_view) |
||
237 | } |
||
238 |
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.