Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Issues (990)

Branch: next

tests/Unit/CrudPanel/HelpersTest.php (1 issue)

Severity
1
<?php
2
3
namespace Backpack\CRUD\Tests\Unit\CrudPanel;
4
5
use Backpack\CRUD\Tests\config\CrudPanel\BaseCrudPanel;
6
use Illuminate\Http\Request;
7
8
class HelpersTest extends BaseCrudPanel
9
{
10
    public function testBackpackFormInputParsesRepeatableFieldsFunction()
11
    {
12
        $input = [
13
            'form' => [
14
                [
15
                    'name' => 'repeatable[0][name]',
16
                    'value' => 'first row name',
17
                ],
18
                [
19
                    'name' => 'repeatable[0][age]',
20
                    'value' => '23',
21
                ],
22
                [
23
                    'name' => 'repeatable[1][name]',
24
                    'value' => 'second row name',
25
                ],
26
                [
27
                    'name' => 'repeatable[1][age]',
28
                    'value' => '24',
29
                ],
30
            ],
31
        ];
32
33
        $request = new Request($input);
34
        app()->handle($request);
0 ignored issues
show
The method handle() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

34
        app()->/** @scrutinizer ignore-call */ handle($request);
Loading history...
35
36
        $expectedOutput = [
37
            'repeatable' => [
38
                [
39
                    'name' => 'first row name',
40
                    'age' => '23',
41
                ],
42
                [
43
                    'name' => 'second row name',
44
                    'age' => '24',
45
                ],
46
            ],
47
        ];
48
49
        $this->assertEquals($expectedOutput, backpack_form_input());
50
    }
51
52
    public function testBackpackFormInputParsesDotNotationFields()
53
    {
54
        $input = [
55
            'form' => [
56
                [
57
                    'name' => 'address[street]',
58
                    'value' => 'street name',
59
                ],
60
                [
61
                    'name' => 'address[postal_code]',
62
                    'value' => '234',
63
                ],
64
            ],
65
        ];
66
67
        $request = new Request($input);
68
        app()->handle($request);
69
70
        $expectedOutput = [
71
            'address' => [
72
                'street' => 'street name',
73
                'postal_code' => '234',
74
            ],
75
        ];
76
77
        $this->assertEquals($expectedOutput, backpack_form_input());
78
    }
79
80
    public function testBackpackFormInputHandleDifferentInputTypesAtSameTime()
81
    {
82
        $input = [
83
            'form' => [
84
                [
85
                    'name' => 'address[street]',
86
                    'value' => 'street name',
87
                ],
88
                [
89
                    'name' => 'address[postal_code]',
90
                    'value' => '234',
91
                ],
92
                [
93
                    'name' => 'repeatable[0][name]',
94
                    'value' => 'first row name',
95
                ],
96
                [
97
                    'name' => 'repeatable[0][age]',
98
                    'value' => '23',
99
                ],
100
                [
101
                    'name' => 'repeatable[1][name]',
102
                    'value' => 'second row name',
103
                ],
104
                [
105
                    'name' => 'repeatable[1][age]',
106
                    'value' => '24',
107
                ],
108
                [
109
                    'name' => 'simple_field',
110
                    'value' => 'simple value',
111
                ],
112
            ],
113
        ];
114
115
        $request = new Request($input);
116
        app()->handle($request);
117
118
        $expectedOutput = [
119
            'address' => [
120
                'street' => 'street name',
121
                'postal_code' => '234',
122
            ],
123
            'repeatable' => [
124
                [
125
                    'name' => 'first row name',
126
                    'age' => '23',
127
                ],
128
                [
129
                    'name' => 'second row name',
130
                    'age' => '24',
131
                ],
132
            ],
133
            'simple_field' => 'simple value',
134
        ];
135
136
        $this->assertEquals($expectedOutput, backpack_form_input());
137
    }
138
}
139