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

module/finance/manager/DomainCrudCest.php (1 issue)

Checks property assignments for possibly missing type casts

Bug Documentation Minor

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

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
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