Issues (213)

tests/_support/Page/Hub/Hub.php (1 issue)

1
<?php
2
3
namespace hipanel\modules\server\tests\_support\Page\Hub;
4
5
use Codeception\Example;
0 ignored issues
show
The type Codeception\Example was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use hipanel\modules\server\tests\_support\Page\AbstractServerForm;
7
use hipanel\tests\_support\Page\Widget\Input\Dropdown;
8
use hipanel\tests\_support\Page\Widget\Input\Input;
9
use hipanel\tests\_support\Page\Widget\Input\Select2;
10
use hipanel\tests\_support\Page\Widget\Input\Textarea;
11
12
/**
13
 * Class Hub
14
 * @package hipanel\modules\server\tests\_support\Page\Hub
15
 */
16
abstract class Hub extends AbstractServerForm
17
{
18
    /**
19
     * @param Example $data
20
     * @return Hub
21
     * @throws \Exception
22
     */
23
    public function fillForm(Example $data)
24
    {
25
        $I = $this->tester;
26
        foreach ($data as $field => $value) {
27
            if (is_null($value)) {
28
                continue;
29
            }
30
            switch (true) {
31
                case in_array($field, ['type_id', 'nic_media', 'digit_capacity_id']):
32
                    (new Dropdown($I, "select[name$=\"[{$field}]\"]"))->setValue($value);
33
                    break;
34
                case in_array($field, ['note']):
35
                    (new Textarea($I, "textarea[name$=\"[{$field}]\"]"))->setValue($value);
36
                    break;
37
                case in_array($field, ['net_id', 'kvm_id', 'pdu_id', 'rack_id', 'pdu2_id', 'net2_id', 'ipmi_id', 'location_id']):
38
                    (new Select2($I, "select[name$=\"[{$field}]\"]"))->setValue($value);
39
                    break;
40
                default:
41
                    (new Input($I, "input[name$=\"[{$field}]\"]"))->setValue($value);
42
            }
43
        }
44
45
        return $this;
46
    }
47
}
48