Completed
Branch BUG-10738-inconsistency-in-ses... (a1eed8)
by
unknown
24:27 queued 12:29
created

EventsAdmin::observeEventIdInListTableForEvent()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
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));
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
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);
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
32
    }
33
34
35
    /**
36
     * Triggers saving the Event.
37
     */
38
    public function saveEvent()
39
    {
40
        $this->actor()->click(EventsPage::EVENT_EDITOR_SAVE_BUTTON_SELECTOR);
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
41
    }
42
43
44
    /**
45
     * Navigates the actor to the event list table page and will attempt to edit the event for the given title.
46
     * First this will search using the given title and then attempt to edit from the results of the search.
47
     *
48
     * Assumes actor is already logged in.
49
     * @param $event_title
50
     */
51
    public function amEditingTheEventWithTitle($event_title)
52
    {
53
        $this->amOnDefaultEventsListTablePage();
54
        $this->actor()->fillField(EventsPage::EVENT_LIST_TABLE_SEARCH_INPUT_SELECTOR, $event_title);
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
55
        $this->actor()->click(CoreAdmin::LIST_TABLE_SEARCH_SUBMIT_SELECTOR);
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
56
        $this->actor()->waitForText($event_title, 15);
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
57
        $this->actor()->click(EventsPage::eventListTableEventTitleEditLinkSelectorForTitle($event_title));
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
58
    }
59
60
61
    /**
62
     * Navigates the user to the single event page (frontend view) for the given event title via clicking the "View"
63
     * link for the event in the event list table.
64
     * Assumes the actor is already logged in and on the Event list table page.
65
     *
66
     * @param string $event_title
67
     */
68
    public function amOnEventPageAfterClickingViewLinkInListTableForEvent($event_title)
69
    {
70
        $this->actor()->moveMouseOver(EventsPage::eventListTableEventTitleEditLinkSelectorForTitle($event_title));
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
71
        $this->actor()->click(EventsPage::eventListTableEventTitleViewLinkSelectorForTitle($event_title));
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
72
    }
73
74
75
    /**
76
     * Used to retrieve the event id for the event via the list table and for the given event.
77
     * @param string $event_title
78
     */
79
    public function observeEventIdInListTableForEvent($event_title)
80
    {
81
        return $this->actor()->observeValueFromInputAt(EventsPage::eventListTableEventIdSelectorForTitle($event_title));
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
82
    }
83
84
85
    /**
86
     * This performs the click action on the gear icon that triggers the advanced settings view state.
87
     * Assumes the actor is already logged in and editing an event.
88
     *
89
     * @param int $row_number  What ticket row to toggle open/close.
90
     */
91
    public function toggleAdvancedSettingsViewForTicketRow($row_number = 1)
92
    {
93
        $this->actor()->click(EventsPage::eventEditorTicketAdvancedDetailsSelector($row_number));
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
94
    }
95
96
97
    /**
98
     * Toggles the TKT_is_taxable checkbox for the ticket in the given row.
99
     * Assumes the actor is already logged in and editing an event and that the advanced settings view state for that
100
     * ticket is "open".
101
     *
102
     * @param int $row_number  What ticket row to toggle the checkbox for.
103
     */
104
    public function toggleTicketIsTaxableForTicketRow($row_number = 1)
105
    {
106
        $this->actor()->click(EventsPage::eventEditorTicketTaxableCheckboxSelector($row_number));
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
107
    }
108
109
110
    /**
111
     * Use to change the default registration status for the event.
112
     * Assumes the view is already on the event editor.
113
     * @param $registration_status
114
     */
115
    public function changeDefaultRegistrationStatusTo($registration_status)
116
    {
117
        $this->actor()->selectOption(
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
118
            EventsPage::EVENT_EDITOR_DEFAULT_REGISTRATION_STATUS_FIELD_SELECTOR,
119
            $registration_status
120
        );
121
    }
122
123
124
    /**
125
     * Use this from the context of the event editor to select the given custom template for a given message type and
126
     * messenger.
127
     *
128
     * @param string $message_type_label  The visible label for the message type (eg Registration Approved)
129
     * @param string $messenger_slug      The slug for the messenger (eg 'email')
130
     * @param string $custom_template_label The visible label in the select input for the custom template you want
131
     *                                      selected.
132
     */
133
    public function selectCustomTemplateFor($message_type_label, $messenger_slug, $custom_template_label)
134
    {
135
        $this->actor()->click(EventsPage::eventEditorNotificationsMetaBoxMessengerTabSelector($messenger_slug));
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
136
        $this->actor()->selectOption(
0 ignored issues
show
Bug introduced by
It seems like actor() must be provided by classes using this trait. How about adding it as abstract method to this trait?

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

trait Idable {
    public function equalIds(Idable $other) {
        return $this->getId() === $other->getId();
    }
}

The trait Idable provides a method equalsId that in turn relies on the method getId(). 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.

Loading history...
137
            EventsPage::eventEditorNotificationsMetaBoxSelectSelectorForMessageType($message_type_label),
138
            $custom_template_label
139
        );
140
    }
141
}