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

Passed
Push — add-tests ( c242f5...76b07e )
by Pedro
32:12 queued 17:04
created

testItCanSetAndGetTheTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nc 1
nop 0
dl 0
loc 10
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Backpack\CRUD\Tests\Unit\CrudPanel;
4
5
use Backpack\CRUD\Tests\config\Models\User;
6
use Illuminate\Routing\Route;
7
8
/**
9
 * @covers Backpack\CRUD\app\Library\CrudPanel\Traits\HeadingsAndTitles
10
 * @covers Backpack\CRUD\app\Library\CrudPanel\CrudPanel
11
 */
12
class CrudPanelTitlesAndHeadingsTest extends \Backpack\CRUD\Tests\config\CrudPanel\BaseCrudPanel
13
{
14
    public function testItCanSetAndGetTheTitleFromTheAction()
15
    {
16
        $this->crudPanel->setTitle('test', 'create');
17
        $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

17
        $this->assertEquals('test', $this->crudPanel->getTitle(/** @scrutinizer ignore-type */ 'create'));
Loading history...
18
        $this->assertEquals($this->crudPanel->get('create.title'), $this->crudPanel->getTitle('create'));
19
    }
20
21
    public function testItCanSetAndGetTheHeadingFromTheAction()
22
    {
23
        $this->crudPanel->setHeading('test', 'create');
24
        $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

24
        $this->assertEquals('test', $this->crudPanel->getHeading(/** @scrutinizer ignore-type */ 'create'));
Loading history...
25
        $this->assertEquals($this->crudPanel->get('create.heading'), $this->crudPanel->getHeading('create'));
26
    }
27
28
    public function testItCanSetAndGetTheSubheadingFromTheAction()
29
    {
30
        $this->crudPanel->setSubheading('test', 'create');
31
        $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

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