Completed
Push — master ( edfd40...5c1088 )
by Dmitry
02:40 queued 18s
created

DomainCrudCest::ensureThatICanAddPrices()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

Changes 0
Metric Value
dl 8
loc 8
c 0
b 0
f 0
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace ahnames\hipanel\tests\acceptance\module\finance\manager;
4
5
use hipanel\helpers\Url;
6
use hipanel\modules\finance\tests\_support\Page\plan\Create as PlanCreatePage;
7
use hipanel\modules\finance\tests\_support\Page\price\domain\Create as PriceDomainCreate;
8
use hipanel\modules\finance\tests\_support\Page\price\certificate\Update as PriceDomainUpdate;
9
use hipanel\tests\_support\Step\Acceptance\Manager;
10
11 View Code Duplication
class DomainCrudCest
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

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.

Loading history...
12
{
13
    /**
14
     * @var string
15
     */
16
    private $id;
17
18
    /**
19
     * @var array
20
     */
21
    private $fields;
22
23
    public function ensureThatICanCreateTariffPlan(Manager $I): void
24
    {
25
        $this->fields = [
26
            'name' => uniqid(),
27
            'type' => 'Domain tariff',
28
            'client' => '[email protected]',
29
            'currency' => 'USD',
30
            'note' => 'test note',
31
        ];
32
        $page = new PlanCreatePage($I, $this->fields);
33
        $this->id = $page->createPlan();
0 ignored issues
show
Documentation Bug introduced by
The property $id was declared of type string, but $page->createPlan() is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
34
    }
35
36
    public function ensureThatICanAddPrices(Manager $I): void
37
    {
38
        $I->needPage(Url::to(['@plan/view', 'id' => $this->id]));
39
        $I->see('No prices found');
40
        $price = new PriceDomainCreate($I, $this->id);
41
        $price->addPrices('Default Tariff');
42
        $price->ensureThereNoSuggestions('Default Tariff');
43
    }
44
45
    public function ensureICanUpdatePrices(Manager $I): void
46
    {
47
        $price = new PriceDomainUpdate($I, $this->id);
48
        $price->updatePrices();
49
    }
50
}
51