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

Test Failed
Pull Request — main (#4778)
by Pedro
25:44 queued 10:58
created

testItCanSetAndGetTheSubheading()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 9
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 13
rs 9.9666
1
<?php
2
3
namespace Backpack\CRUD\Tests\Unit\CrudPanel;
4
5
use Backpack\CRUD\Tests\Unit\Models\User;
6
use Illuminate\Routing\Route;
7
8
/**
9
 * @covers Backpack\CRUD\app\Library\CrudPanel\Traits\HeadingsAndTitles
10
 */
11
class CrudPanelTitlesAndHeadingsTest extends BaseDBCrudPanelTest
12
{
13
    public function testItCanSetAndGetTheTitleFromTheAction()
14
    {
15
        $this->crudPanel->setTitle('test', 'create');
16
        $this->assertEquals('test', $this->crudPanel->getTitle('create'));
0 ignored issues
show
Bug introduced by
'create' of type string is incompatible with the type boolean expected by parameter $action of Backpack\CRUD\app\Librar...l\CrudPanel::getTitle(). ( Ignorable by Annotation )

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

16
        $this->assertEquals('test', $this->crudPanel->getTitle(/** @scrutinizer ignore-type */ 'create'));
Loading history...
17
        $this->assertEquals($this->crudPanel->get('create.title'), $this->crudPanel->getTitle('create'));
18
    }
19
20
    public function testItCanSetAndGetTheHeadingFromTheAction()
21
    {
22
        $this->crudPanel->setHeading('test', 'create');
23
        $this->assertEquals('test', $this->crudPanel->getHeading('create'));
0 ignored issues
show
Bug introduced by
'create' of type string is incompatible with the type boolean expected by parameter $action of Backpack\CRUD\app\Librar...CrudPanel::getHeading(). ( Ignorable by Annotation )

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

23
        $this->assertEquals('test', $this->crudPanel->getHeading(/** @scrutinizer ignore-type */ 'create'));
Loading history...
24
        $this->assertEquals($this->crudPanel->get('create.heading'), $this->crudPanel->getHeading('create'));
25
    }
26
27
    public function testItCanSetAndGetTheSubheadingFromTheAction()
28
    {
29
        $this->crudPanel->setSubheading('test', 'create');
30
        $this->assertEquals('test', $this->crudPanel->getSubheading('create'));
0 ignored issues
show
Bug introduced by
'create' of type string is incompatible with the type boolean expected by parameter $action of Backpack\CRUD\app\Librar...dPanel::getSubheading(). ( Ignorable by Annotation )

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

30
        $this->assertEquals('test', $this->crudPanel->getSubheading(/** @scrutinizer ignore-type */ 'create'));
Loading history...
31
        $this->assertEquals($this->crudPanel->get('create.subheading'), $this->crudPanel->getSubheading('create'));
32
    }
33
34
    public function testItCanSetAndGetTheSubheading()
35
    {
36
        $this->crudPanel->setModel(User::class);
37
        $request = request()->create('/admin/users/create', 'POST', ['name' => 'foo']);
38
        $request->setRouteResolver(function () use ($request) {
39
            return (new Route('POST', 'admin/users/create', ['UserCrudController', 'create']))->bind($request);
40
        });
41
        $this->crudPanel->setRequest($request);
42
43
        $this->crudPanel->setOperation('create');
44
        $this->crudPanel->setSubheading('test');
45
        $this->assertEquals('test', $this->crudPanel->getSubheading());
46
        $this->assertEquals($this->crudPanel->get('create.subheading'), $this->crudPanel->getSubheading());
47
    }
48
49
    public function testItCanSetAndGetTheHeading()
50
    {
51
        $this->crudPanel->setModel(User::class);
52
        $request = request()->create('/admin/users/create', 'POST', ['name' => 'foo']);
53
        $request->setRouteResolver(function () use ($request) {
54
            return (new Route('POST', 'admin/users/create', ['UserCrudController', 'create']))->bind($request);
55
        });
56
        $this->crudPanel->setRequest($request);
57
58
        $this->crudPanel->setOperation('create');
59
        $this->crudPanel->setHeading('test');
60
        $this->assertEquals('test', $this->crudPanel->getHeading());
61
        $this->assertEquals($this->crudPanel->get('create.heading'), $this->crudPanel->getHeading());
62
    }
63
64
    public function testItCanSetAndGetTheTitle()
65
    {
66
        $this->crudPanel->setModel(User::class);
67
        $request = request()->create('/admin/users/create', 'POST', ['name' => 'foo']);
68
        $request->setRouteResolver(function () use ($request) {
69
            return (new Route('POST', 'admin/users/create', ['UserCrudController', 'create']))->bind($request);
70
        });
71
        $this->crudPanel->setRequest($request);
72
73
        $this->crudPanel->setOperation('create');
74
        $this->crudPanel->setTitle('test');
75
76
        $this->assertEquals('test', $this->crudPanel->getTitle());
77
        $this->assertEquals($this->crudPanel->get('create.title'), $this->crudPanel->getTitle());
78
    }
79
}
80