|
1
|
|
|
<?php |
|
2
|
|
|
namespace EventEspresso\Codeception\helpers; |
|
3
|
|
|
|
|
4
|
|
|
use Page\CoreAdmin; |
|
5
|
|
|
use Page\CountrySettingsAdmin as CountrySettings; |
|
6
|
|
|
|
|
7
|
|
|
trait CountrySettingsAdmin |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* Instructs the actor to browse to the country settings page. |
|
11
|
|
|
* Assumes the actor is already logged in. |
|
12
|
|
|
* @param string $additional_params |
|
13
|
|
|
*/ |
|
14
|
|
|
public function amOnCountrySettingsAdminPage($additional_params = '') |
|
15
|
|
|
{ |
|
16
|
|
|
$this->actor()->amOnAdminPage(CountrySettings::url($additional_params)); |
|
|
|
|
|
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
|
|
20
|
|
|
/** |
|
21
|
|
|
* Instructs the actor to select the given decimal places radio option. |
|
22
|
|
|
* Assumes the actor is already on the country settings page. |
|
23
|
|
|
* @param string $decimal_places |
|
24
|
|
|
* @param string $country_code |
|
25
|
|
|
*/ |
|
26
|
|
|
public function setCurrencyDecimalPlacesTo($decimal_places = '2', $country_code = 'US') |
|
27
|
|
|
{ |
|
28
|
|
|
$this->actor()->click(CountrySettings::currencyDecimalPlacesRadioField($decimal_places, $country_code)); |
|
|
|
|
|
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Instructs the actor to select the given decimal mark radio option. |
|
34
|
|
|
* Assumes the actor is already on the country settings page. |
|
35
|
|
|
* @param string $decimal_mark |
|
36
|
|
|
*/ |
|
37
|
|
|
public function setCurrencyDecimalMarkTo($decimal_mark = '.') |
|
38
|
|
|
{ |
|
39
|
|
|
$this->actor()->click(CountrySettings::currencyDecimalMarkRadioField($decimal_mark)); |
|
|
|
|
|
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
|
|
43
|
|
|
/** |
|
44
|
|
|
* Instructs the actor to select the given thousands separator radio option. |
|
45
|
|
|
* Assumes the actor is already on the country settings page. |
|
46
|
|
|
* @param string $thousands_seperator |
|
47
|
|
|
*/ |
|
48
|
|
|
public function setCurrencyThousandsSeparatorTo($thousands_seperator = ',') |
|
49
|
|
|
{ |
|
50
|
|
|
$this->actor()->click(CountrySettings::currencyThousandsSeparatorField($thousands_seperator)); |
|
|
|
|
|
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* Clicks the country settings submit button. |
|
56
|
|
|
* Assumes the actor is on the country settings admin page. |
|
57
|
|
|
*/ |
|
58
|
|
|
public function saveCountrySettings() |
|
59
|
|
|
{ |
|
60
|
|
|
$this->actor()->click(CountrySettings::COUNTRY_SETTINGS_SAVE_BUTTON); |
|
|
|
|
|
|
61
|
|
|
//no indicator on the page when stuff has been updated so just give a bit of time for it to finish. |
|
62
|
|
|
$this->actor()->wait(5); |
|
|
|
|
|
|
63
|
|
|
} |
|
64
|
|
|
} |
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
Idableprovides a methodequalsIdthat 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.