1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Finance module for HiPanel |
4
|
|
|
* |
5
|
|
|
* @link https://github.com/hiqdev/hipanel-module-finance |
6
|
|
|
* @package hipanel-module-finance |
7
|
|
|
* @license BSD-3-Clause |
8
|
|
|
* @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace hipanel\modules\finance\tests\acceptance\seller; |
12
|
|
|
|
13
|
|
|
use hipanel\helpers\Url; |
14
|
|
|
use hipanel\tests\_support\Page\IndexPage; |
15
|
|
|
use hipanel\tests\_support\Page\Widget\Input\Input; |
16
|
|
|
use hipanel\tests\_support\Page\Widget\Input\Select2; |
17
|
|
|
use hipanel\tests\_support\Step\Acceptance\Seller; |
18
|
|
|
|
19
|
|
|
class PlanCest |
20
|
|
|
{ |
21
|
|
|
/** |
22
|
|
|
* @var IndexPage |
23
|
|
|
*/ |
24
|
|
|
private $index; |
25
|
|
|
|
26
|
|
|
public function _before(Seller $I) |
27
|
|
|
{ |
28
|
|
|
$this->index = new IndexPage($I); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
View Code Duplication |
public function ensureIndexPageWorks(Seller $I) |
32
|
|
|
{ |
33
|
|
|
$I->login(); |
34
|
|
|
$I->needPage(Url::to('@plan/index')); |
35
|
|
|
$I->see('Tariff plans', 'h1'); |
36
|
|
|
$I->see('Create', 'a'); |
37
|
|
|
$this->ensureICanSeeAdvancedSearchBox($I); |
38
|
|
|
$this->ensureICanSeeBulkBillSearchBox(); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
View Code Duplication |
private function ensureICanSeeAdvancedSearchBox(Seller $I) |
|
|
|
|
42
|
|
|
{ |
43
|
|
|
$this->index->containsFilters([ |
44
|
|
|
Input::asAdvancedSearch($I, 'Name'), |
45
|
|
|
Input::asAdvancedSearch($I, 'Object name'), |
46
|
|
|
Input::asAdvancedSearch($I, 'Note'), |
47
|
|
|
Select2::asAdvancedSearch($I, 'Client'), |
48
|
|
|
Select2::asAdvancedSearch($I, 'Buyer'), |
49
|
|
|
Select2::asAdvancedSearch($I, 'Type'), |
50
|
|
|
Select2::asAdvancedSearch($I, 'Statuses'), |
51
|
|
|
]); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
private function ensureICanSeeBulkBillSearchBox() |
55
|
|
|
{ |
56
|
|
|
$this->index->containsBulkButtons([ |
57
|
|
|
'Restore', |
58
|
|
|
'Delete', |
59
|
|
|
]); |
60
|
|
|
$this->index->containsColumns([ |
61
|
|
|
'Name', |
62
|
|
|
'Seller', |
63
|
|
|
'Type', |
64
|
|
|
'Status', |
65
|
|
|
]); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.