Completed
Branch BUG-10738-inconsistency-in-ses... (8f6fbc)
by
unknown
74:03 queued 63:31
created

selectBulkActionCheckboxesForRegistrationIds()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nc 2
nop 1
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace EventEspresso\Codeception\helpers;
4
5
use Page\RegistrationsAdmin as RegistrationsAdminPage;
6
7
/**
8
 * Trait RegistrationsAdmin
9
 * Helper actions for Registration Admin Page actions.
10
 *
11
 * @package EventEspresso\Codeception\helpers
12
 */
13
trait RegistrationsAdmin
14
{
15
16
    /**
17
     * This will select all checkboxes on a registration list table for the given array of
18
     * registration ids.
19
     * Assumes the actor is on a list table page for registrations.
20
     * @param $registration_ids
21
     */
22
    public function selectBulkActionCheckboxesForRegistrationIds(array $registration_ids)
23
    {
24
        foreach ($registration_ids as $registration_id) {
25
            $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...
26
                RegistrationsAdminPage::listTableCheckBoxSelectorForRegistrationId($registration_id)
27
            );
28
        }
29
    }
30
31
32
    /**
33
     * Navigates the actor to the default registration list table page.
34
     * @param string $additional_params
35
     */
36
    public function amOnDefaultRegistrationsListTableAdminPage($additional_params = '')
37
    {
38
        $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...
39
            RegistrationsAdminPage::registrationsDefaultAdminListTableUrl($additional_params)
40
        );
41
    }
42
}