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\client; |
12
|
|
|
|
13
|
|
|
use hipanel\helpers\Url; |
14
|
|
|
use hipanel\tests\_support\Step\Acceptance\Client; |
15
|
|
|
|
16
|
|
View Code Duplication |
class AccountRechargingCest |
|
|
|
|
17
|
|
|
{ |
18
|
|
|
public function ensureIndexPageWorks(Client $I) |
19
|
|
|
{ |
20
|
|
|
$I->login(); |
21
|
|
|
$I->needPage(Url::to('@pay/deposit')); |
22
|
|
|
$I->see('Account recharging', 'h1'); |
23
|
|
|
$this->ensureICanSeeDepositBox($I); |
24
|
|
|
$this->ensureICanSeePaymentBox($I); |
25
|
|
|
$this->ensureICanSeeWarningBox($I); |
26
|
|
|
} |
27
|
|
|
|
28
|
|
|
private function ensureICanSeeDepositBox(Client $I) |
29
|
|
|
{ |
30
|
|
|
$url = Url::to('@pay/deposit'); |
31
|
|
|
$form = "//form[@action='$url']"; |
32
|
|
|
$I->see('Amount', "$form/label"); |
33
|
|
|
$I->seeElement('input', ['id' => 'depositform-amount']); |
34
|
|
|
$text = 'Enter the amount of the replenishment in USD. For example: 8.79'; |
35
|
|
|
$I->see($text, $form); |
36
|
|
|
$I->see('Proceed', "$form/button[@type='submit']"); |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
private function ensureICanSeePaymentBox(Client $I) |
40
|
|
|
{ |
41
|
|
|
$I->see('Available payment methods', 'h3'); |
42
|
|
|
$I->see('We support fully automatic account depositing with the following payment systems:'); |
43
|
|
|
} |
44
|
|
|
|
45
|
|
|
private function ensureICanSeeWarningBox(Client $I) |
46
|
|
|
{ |
47
|
|
|
$I->see('Important information', 'h4'); |
48
|
|
|
$text = 'Remember to return to the site after successful payment!'; |
49
|
|
|
$I->see($text, 'p'); |
50
|
|
|
} |
51
|
|
|
} |
52
|
|
|
|
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.