1
|
|
|
<?php |
2
|
|
|
namespace EventEspresso\Codeception\helpers; |
3
|
|
|
|
4
|
|
|
use Page\CoreAdmin; |
5
|
|
|
use Page\EventsAdmin as EventsPage; |
6
|
|
|
|
7
|
|
|
|
8
|
|
|
/** |
9
|
|
|
* Trait EventsAdmin |
10
|
|
|
* Helper actions for the Events Admin pages. |
11
|
|
|
* |
12
|
|
|
* @package EventEspresso\Codeception\helpers |
13
|
|
|
*/ |
14
|
|
|
trait EventsAdmin |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @param string $additional_params |
19
|
|
|
*/ |
20
|
|
|
public function amOnDefaultEventsListTablePage($additional_params = '') |
21
|
|
|
{ |
22
|
|
|
$this->actor()->amOnAdminPage(EventsPage::defaultEventsListTableUrl($additional_params)); |
|
|
|
|
23
|
|
|
} |
24
|
|
|
|
25
|
|
|
|
26
|
|
|
/** |
27
|
|
|
* Triggers the publishing of the Event. |
28
|
|
|
*/ |
29
|
|
|
public function publishEvent() |
30
|
|
|
{ |
31
|
|
|
$this->actor()->click(EventsPage::EVENT_EDITOR_PUBLISH_BUTTON_SELECTOR); |
|
|
|
|
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
|
35
|
|
|
/** |
36
|
|
|
* Navigates the actor to the event list table page and will attempt to edit the event for the given title. |
37
|
|
|
* First this will search using the given title and then attempt to edit from the results of the search. |
38
|
|
|
* |
39
|
|
|
* Assumes actor is already logged in. |
40
|
|
|
* @param $event_title |
41
|
|
|
*/ |
42
|
|
|
public function amEditingTheEventWithTitle($event_title) |
43
|
|
|
{ |
44
|
|
|
$this->amOnDefaultEventsListTablePage(); |
45
|
|
|
$this->actor()->fillField(EventsPage::EVENT_LIST_TABLE_SEARCH_INPUT_SELECTOR, $event_title); |
|
|
|
|
46
|
|
|
$this->actor()->click(CoreAdmin::LIST_TABLE_SEARCH_SUBMIT_SELECTOR); |
|
|
|
|
47
|
|
|
$this->actor()->waitForText('Displaying search results for'); |
|
|
|
|
48
|
|
|
$this->actor()->click(EventsPage::eventListTableEventTitleEditLink($event_title)); |
|
|
|
|
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
|
52
|
|
|
/** |
53
|
|
|
* Navigates the user to the single event page (frontend view) for the given event title via clicking the "View" |
54
|
|
|
* link for the event in the event list table. |
55
|
|
|
* Assumes the actor is already logged in and on the Event list table page. |
56
|
|
|
* |
57
|
|
|
* @param string $event_title |
58
|
|
|
*/ |
59
|
|
|
public function amOnEventPageAfterClickingViewLinkInListTableForEvent($event_title) |
60
|
|
|
{ |
61
|
|
|
$this->actor()->moveMouseOver(EventsPage::eventListTableEventTitleEditLinkSelectorForTitle($event_title)); |
|
|
|
|
62
|
|
|
$this->actor()->click(EventsPage::eventListTableEventTitleViewLinkSelectorForTitle($event_title)); |
|
|
|
|
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* This performs the click action on the gear icon that triggers the advanced settings view state. |
68
|
|
|
* Assumes the actor is already logged in and editing an event. |
69
|
|
|
* |
70
|
|
|
* @param int $row_number What ticket row to toggle open/close. |
71
|
|
|
*/ |
72
|
|
|
public function toggleAdvancedSettingsViewForTicketRow($row_number = 1) |
73
|
|
|
{ |
74
|
|
|
$this->actor()->click(EventsPage::eventEditorTicketAdvancedDetailsSelector($row_number)); |
|
|
|
|
75
|
|
|
} |
76
|
|
|
|
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* Toggles the TKT_is_taxable checkbox for the ticket in the given row. |
80
|
|
|
* Assumes the actor is already logged in and editing an event and that the advanced settings view state for that |
81
|
|
|
* ticket is "open". |
82
|
|
|
* |
83
|
|
|
* @param int $row_number What ticket row to toggle the checkbox for. |
84
|
|
|
*/ |
85
|
|
|
public function toggleTicketIsTaxableForTicketRow($row_number = 1) |
86
|
|
|
{ |
87
|
|
|
$this->actor()->click(EventsPage::eventEditorTicketTaxableCheckboxSelector($row_number)); |
|
|
|
|
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
|
91
|
|
|
/** |
92
|
|
|
* Use to change the default registration status for the event. |
93
|
|
|
* Assumes the view is already on the event editor. |
94
|
|
|
* @param $registration_status |
95
|
|
|
*/ |
96
|
|
|
public function changeDefaultRegistrationStatusTo($registration_status) |
97
|
|
|
{ |
98
|
|
|
$this->actor()->selectOption( |
|
|
|
|
99
|
|
|
EventsPage::EVENT_EDITOR_DEFAULT_REGISTRATION_STATUS_FIELD_SELECTOR, |
100
|
|
|
$registration_status |
101
|
|
|
); |
102
|
|
|
} |
103
|
|
|
|
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Use this from the context of the event editor to select the given custom template for a given message type and |
107
|
|
|
* messenger. |
108
|
|
|
* |
109
|
|
|
* @param string $message_type_label The visible label for the message type (eg Registration Approved) |
110
|
|
|
* @param string $messenger_slug The slug for the messenger (eg 'email') |
111
|
|
|
* @param string $custom_template_label The visible label in the select input for the custom template you want |
112
|
|
|
* selected. |
113
|
|
|
*/ |
114
|
|
|
public function selectCustomTemplateFor($message_type_label, $messenger_slug, $custom_template_label) |
115
|
|
|
{ |
116
|
|
|
$this->actor()->click(EventsPage::eventEditorNotificationsMetaBoxMessengerTabSelector($messenger_slug)); |
|
|
|
|
117
|
|
|
$this->actor()->selectOption( |
|
|
|
|
118
|
|
|
EventsPage::eventEditorNotificationsMetaBoxSelectSelectorForMessageType($message_type_label), |
119
|
|
|
$custom_template_label |
120
|
|
|
); |
121
|
|
|
} |
122
|
|
|
} |
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.