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 BillCest |
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
|
|
|
public function ensureIndexPageWorks(Seller $I) |
32
|
|
|
{ |
33
|
|
|
$I->login(); |
34
|
|
|
$I->needPage(Url::to('@bill')); |
35
|
|
|
$I->see('Bills', 'h1'); |
36
|
|
|
$I->seeLink('Recharge account', Url::to('@pay/deposit')); |
37
|
|
|
$I->seeLink('Add payment', Url::to('@bill/create')); |
38
|
|
|
$I->seeLink('Currency exchange', Url::to('@bill/create-exchange')); |
39
|
|
|
$I->seeLink('Import payments', Url::to('@bill/import')); |
40
|
|
|
$this->ensureICanSeeAdvancedSearchBox($I); |
41
|
|
|
$this->ensureICanSeeBulkBillSearchBox(); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
View Code Duplication |
private function ensureICanSeeAdvancedSearchBox(Seller $I) |
45
|
|
|
{ |
46
|
|
|
$this->index->containsFilters([ |
47
|
|
|
Select2::asAdvancedSearch($I, 'Client'), |
48
|
|
|
Select2::asAdvancedSearch($I, 'Currency'), |
49
|
|
|
Select2::asAdvancedSearch($I, 'Type'), |
50
|
|
|
Input::asAdvancedSearch($I, 'Servers'), |
51
|
|
|
Input::asAdvancedSearch($I,'Description'), |
52
|
|
|
Select2::asAdvancedSearch($I, 'Tariff'), |
53
|
|
|
Select2::asAdvancedSearch($I, 'Reseller'), |
54
|
|
|
]); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
View Code Duplication |
private function ensureICanSeeBulkBillSearchBox() |
|
|
|
|
58
|
|
|
{ |
59
|
|
|
$this->index->containsBulkButtons([ |
60
|
|
|
'Copy', |
61
|
|
|
'Update', |
62
|
|
|
'Delete', |
63
|
|
|
]); |
64
|
|
|
$this->index->containsColumns([ |
65
|
|
|
'Client', |
66
|
|
|
'Time', |
67
|
|
|
'Sum', |
68
|
|
|
'Balance', |
69
|
|
|
'Type', |
70
|
|
|
'Description', |
71
|
|
|
]); |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|
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.