Completed
Branch FET-9222-rest-api-writes (64ff44)
by
unknown
95:49 queued 82:41
created

BaseCoreAdmin::setPerPageOptionForScreen()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 1
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
namespace EventEspresso\Codeception\helpers;
3
4
use Page\CoreAdmin;
5
6
/**
7
 * Trait BaseCoreAdmin
8
 * Contains actions for more generic EE Admin page navigation.  Generally speaking it is preferable to create a helper
9
 * specific to an EE admin page you want actions for, but this is provided for quicker setup as necessary.
10
 *
11
 * @package EventEspresso\Codeception\helpers
12
 */
13
trait BaseCoreAdmin
14
{
15
16
    /**
17
     * Core method for going to an Event Espresso Admin page.
18
     * @param string $page
19
     * @param string $action
20
     * @param string $additional_params
21
     */
22
    public function amOnEventEspressoAdminPage($page = '', $action = '', $additional_params = '')
23
    {
24
        $this->actor()->amOnAdminPage(CoreAdmin::adminUrl($page, $action, $additional_params));
25
    }
26
27
28
    /**
29
     * Helper method for returning an instance of the Actor.  Intended to help with IDE fill out of methods.
30
     * @return \EventEspressoAcceptanceTester;
31
     */
32
    protected function actor()
33
    {
34
        /** @var \EventEspressoAcceptanceTester $this */
35
        return $this;
36
    }
37
38
39
    /**
40
     * Use this to set the per page option for a list table page.
41
     * Assumes you are on a page that has this field exposed.
42
     * @param int|string $per_page_value
43
     */
44
    public function setPerPageOptionForScreen($per_page_value)
45
    {
46
        $this->actor()->click(CoreAdmin::WP_SCREEN_SETTINGS_LINK_SELECTOR);
47
        $this->actor()->fillField(CoreAdmin::WP_SCREEN_SETTINGS_PER_PAGE_FIELD_SELECTOR, $per_page_value);
48
        $this->actor()->click(CoreAdmin::WP_SCREEN_OPTIONS_APPLY_SETTINGS_BUTTON_SELECTOR);
49
        $this->actor()->wait(8);
50
    }
51
}