Completed
Push — master ( b864d9...3fa98b )
by Dmitry
07:42 queued 03:17
created

CertificateCrudCest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 4
dl 0
loc 40
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A ensureThatICanCreateTariffPlan() 0 12 1
A ensureThatICanAddPrices() 0 8 1
A ensureICanUpdatePrices() 0 5 1
1
<?php
2
3
namespace hipanel\modules\finance\tests\acceptance\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\certificate\Create as PriceCertificateCreate;
8
use hipanel\modules\finance\tests\_support\Page\price\certificate\Update as PriceCertificateUpdate;
9
use hipanel\tests\_support\Step\Acceptance\Manager;
10
11
class CertificateCrudCest
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' => 'Certificate 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)
37
    {
38
        $I->needPage(Url::to(['@plan/view', 'id' => $this->id]));
39
        $I->see('No prices found');
40
        $price = new PriceCertificateCreate($I, $this->id);
41
        $price->addPrices('Certificate tariff');
42
        $price->ensureThereNoSuggestions('Certificate tariff');
43
    }
44
45
    public function ensureICanUpdatePrices(Manager $I)
46
    {
47
        $price = new PriceCertificateUpdate($I, $this->id);
48
        $price->updatePrices();
49
    }
50
}
51