Completed
Branch FET/9461/add-espresso-next-upc... (aee281)
by
unknown
77:39 queued 65:04
created

RegistrationsAdmin   A

Complexity

Total Complexity 11

Size/Duplication

Total Lines 139
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 139
rs 10
c 0
b 0
f 0
wmc 11
lcom 0
cbo 2

9 Methods

Rating   Name   Duplication   Size   Complexity  
A selectBulkActionCheckboxesForRegistrationIds() 0 8 2
A amOnDefaultRegistrationsListTableAdminPage() 0 8 1
A searchForRegistrationOnRegistrationListTableWithText() 0 7 1
A amViewingRegistrationsForEvent() 0 6 1
A amOnAdminRegistrationPageForEvent() 0 6 1
A clickViewDetailsLinkForRegistrationWithId() 0 4 1
A selectRegistrationStatusOnRegistrationDetailsPageFor() 0 7 1
A selectSendRelatedMessagesOptionOnRegistrationDetailsPage() 0 12 2
A changeRegistrationStatusOnRegistrationDetailsPageTo() 0 9 1
1
<?php
2
3
namespace EventEspresso\Codeception\helpers;
4
5
use Page\CoreAdmin;
6
use Page\RegistrationsAdmin as RegistrationsAdminPage;
7
use Page\EventsAdmin;
0 ignored issues
show
Bug introduced by
This use statement conflicts with another class in this namespace, EventEspresso\Codeception\helpers\EventsAdmin.

Let’s assume that you have a directory layout like this:

.
|-- OtherDir
|   |-- Bar.php
|   `-- Foo.php
`-- SomeDir
    `-- Foo.php

and let’s assume the following content of Bar.php:

// Bar.php
namespace OtherDir;

use SomeDir\Foo; // This now conflicts the class OtherDir\Foo

If both files OtherDir/Foo.php and SomeDir/Foo.php are loaded in the same runtime, you will see a PHP error such as the following:

PHP Fatal error:  Cannot use SomeDir\Foo as Foo because the name is already in use in OtherDir/Foo.php

However, as OtherDir/Foo.php does not necessarily have to be loaded and the error is only triggered if it is loaded before OtherDir/Bar.php, this problem might go unnoticed for a while. In order to prevent this error from surfacing, you must import the namespace with a different alias:

// Bar.php
namespace OtherDir;

use SomeDir\Foo as SomeDirFoo; // There is no conflict anymore.
Loading history...
8
9
/**
10
 * Trait RegistrationsAdmin
11
 * Helper actions for Registration Admin Page actions.
12
 *
13
 * @package EventEspresso\Codeception\helpers
14
 */
15
trait RegistrationsAdmin
16
{
17
18
    /**
19
     * This will select all checkboxes on a registration list table for the given array of
20
     * registration ids.
21
     * Assumes the actor is on a list table page for registrations.
22
     * @param $registration_ids
23
     */
24
    public function selectBulkActionCheckboxesForRegistrationIds(array $registration_ids)
25
    {
26
        foreach ($registration_ids as $registration_id) {
27
            $this->actor()->checkOption(
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...
28
                RegistrationsAdminPage::listTableCheckBoxSelectorForRegistrationId($registration_id)
29
            );
30
        }
31
    }
32
33
34
    /**
35
     * Navigates the actor to the default registration list table page.
36
     * @param string $additional_params
37
     */
38
    public function amOnDefaultRegistrationsListTableAdminPage($additional_params = '')
39
    {
40
        $this->actor()->amOnAdminPage(
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
            RegistrationsAdminPage::registrationsDefaultAdminListTableUrl($additional_params)
42
        );
43
        //wait for page to fully load
44
        $this->actor()->wait(5);
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...
45
    }
46
47
48
    /**
49
     * Will enter the provided value in the registration list table search field and execute a search for that value.
50
     * @param string $search_text
51
     */
52
    public function searchForRegistrationOnRegistrationListTableWithText($search_text)
53
    {
54
        $this->amOnDefaultRegistrationsListTableAdminPage();
55
        $this->actor()->fillField(RegistrationsAdminPage::SEARCH_INPUT_SELECTOR_LIST_TABLE_REGISTRATION, $search_text);
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()->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...
57
        $this->actor()->waitForText('Displaying search results for');
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
    /**
63
     * This will filter the registration list table to view registrations for the given event id.
64
     * Assumption is made that you are logged into the admin but you do not need to be on the registration list table
65
     * page.
66
     *
67
     * @param int $event_id  The id of the event viewing registrations for.
68
     */
69
    public function amViewingRegistrationsForEvent($event_id)
70
    {
71
        $this->actor()->amOnDefaultEventsListTablePage();
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
        $this->actor()->click(EventsAdmin::listTableActionLinkRegistrationsForEvent($event_id));
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...
73
        $this->actor()->waitForText('Viewing registrations for the event');
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...
74
    }
75
76
77
    /**
78
     * This helper will initiate registering for the given event via the backend.
79
     * @param int $event_id  The event to initiate registration for.
80
     */
81
    public function amOnAdminRegistrationPageForEvent($event_id)
82
    {
83
        $this->actor()->amViewingRegistrationsForEvent($event_id);
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...
84
        $this->actor()->click(RegistrationsAdminPage::BUTTON_ADD_NEW_REGISTRATION);
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...
85
        $this->actor()->waitForText('Adding Registration For');
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...
86
    }
87
88
89
90
    /**
91
     * This clicks the View Details Link for Registration with the given Id
92
     * @param $registration_id
93
     */
94
    public function clickViewDetailsLinkForRegistrationWithId($registration_id)
95
    {
96
        $this->actor()->click(RegistrationsAdminPage::viewDetailsLinkSelectorForRegistrationId($registration_id));
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...
97
    }
98
99
100
    /**
101
     * /**
102
     * This assumes you are on the admin details page for a registration in EE.  It selects the given status in the
103
     * dropdown for changing registration status.
104
     *
105
     * @param string $status_label_or_value  Either the label for the dropdown option or the value for the option.
106
     * @param $status_label_or_value
107
     */
108
    public function selectRegistrationStatusOnRegistrationDetailsPageFor($status_label_or_value)
109
    {
110
        $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...
111
            RegistrationsAdminPage::DROPDOWN_REGISTRATION_STATUS,
112
            $status_label_or_value
113
        );
114
    }
115
116
117
    /**
118
     * This selects (or deselects) the "Send Related Messages" checkbox on the Registration Details page.
119
     * @param bool $send_related_messages
120
     */
121
    public function selectSendRelatedMessagesOptionOnRegistrationDetailsPage($send_related_messages = true)
122
    {
123
        $send_related_messages
124
            ? $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...
125
                RegistrationsAdminPage::DROPDOWN_SEND_RELATED_MESSAGES,
126
                'Yes'
127
            )
128
            : $this->actor()->selecOption(
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...
129
                RegistrationsAdminPage::DROPDOWN_SEND_RELATED_MESSAGES,
130
                'No'
131
            );
132
    }
133
134
135
136
    /**
137
     * This assumes you are on the admin details page for a registration in EE.  It selects the given status in the
138
     * dropdown for changing registration status and submits the change.
139
     *
140
     * @param string $status_label_or_value  Either the label for the dropdown option or the value for the option.
141
     * @param bool   $send_related_messages  Whether or not to send related messages after changing the bulk action.
142
     */
143
    public function changeRegistrationStatusOnRegistrationDetailsPageTo(
144
        $status_label_or_value,
145
        $send_related_messages = true
146
    ) {
147
        $this->actor()->selectRegistrationStatusOnRegistrationDetailsPageFor($status_label_or_value);
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...
148
        $this->actor()->selectSendRelatedMessagesOptionOnRegistrationDetailsPage($send_related_messages);
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...
149
        $this->actor()->click(RegistrationsAdminPage::BUTTON_UPDATE_REGISTRATION_STATUS);
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...
150
        $this->actor()->waitForText('Registration status has been set to');
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...
151
    }
152
153
}