|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace hipanel\modules\finance\tests\_support\Page\price; |
|
4
|
|
|
|
|
5
|
|
|
use hipanel\tests\_support\AcceptanceTester; |
|
6
|
|
|
use hipanel\tests\_support\Page\Widget\Select2; |
|
7
|
|
|
|
|
8
|
|
|
class Create extends View |
|
9
|
|
|
{ |
|
10
|
|
|
/** |
|
11
|
|
|
* @var Select2 |
|
12
|
|
|
*/ |
|
13
|
|
|
protected $select2; |
|
14
|
|
|
|
|
15
|
|
|
public function __construct(AcceptanceTester $I, int $id) |
|
16
|
|
|
{ |
|
17
|
|
|
parent::__construct($I, $id); |
|
18
|
|
|
|
|
19
|
|
|
$this->select2 = new Select2($this->tester); |
|
20
|
|
|
} |
|
21
|
|
|
|
|
22
|
|
|
public function createRandomPrices(string $objectName, string $templateName, string $priceType): void |
|
23
|
|
|
{ |
|
24
|
|
|
$this->loadPage(); |
|
25
|
|
|
$this->openModal(); |
|
26
|
|
|
$this->chooseObject($objectName); |
|
27
|
|
|
$this->chooseTemplate($templateName); |
|
28
|
|
|
$this->choosePriceType($priceType); |
|
29
|
|
|
$this->proceedToCreation(); |
|
30
|
|
|
$this->fillRandomPrices('price'); |
|
31
|
|
|
$this->saveForm(); |
|
32
|
|
|
$this->seeRandomPrices(); |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
|
|
public function openModal(): void |
|
36
|
|
|
{ |
|
37
|
|
|
$I = $this->tester; |
|
38
|
|
|
|
|
39
|
|
|
$I->click('Create'); |
|
40
|
|
|
$I->waitForElement('#create-prices'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function chooseObject(string $objectName): void |
|
44
|
|
|
{ |
|
45
|
|
|
$this->select2->open('#object_id'); |
|
46
|
|
|
$this->select2->fillSearchField($objectName); |
|
|
|
|
|
|
47
|
|
|
$this->select2->chooseOption($objectName); |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
public function chooseTemplate(string $templateName): void |
|
51
|
|
|
{ |
|
52
|
|
|
$this->select2->fillSearchField($templateName); |
|
|
|
|
|
|
53
|
|
|
$this->select2->chooseOption($templateName); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
public function choosePriceType(string $priceType): void |
|
57
|
|
|
{ |
|
58
|
|
|
$this->select2->open('#type'); |
|
59
|
|
|
$this->select2->fillSearchField($priceType); |
|
|
|
|
|
|
60
|
|
|
$this->select2->chooseOption($priceType); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function proceedToCreation(): void |
|
64
|
|
|
{ |
|
65
|
|
|
$I = $this->tester; |
|
66
|
|
|
|
|
67
|
|
|
$I->click('Proceed to creation'); |
|
68
|
|
|
$I->waitForText('Create suggested prices', 60); |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
|
|
public function saveForm(): void |
|
72
|
|
|
{ |
|
73
|
|
|
$I = $this->tester; |
|
74
|
|
|
|
|
75
|
|
|
$I->click('Save'); |
|
76
|
|
|
$I->closeNotification('Prices were successfully created'); |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
|
|
} |
|
80
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.