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 ( 00b7aa...24e2ca )
by Pedro
15:23
created

testItGetsTheOperationListFromSettings()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
namespace Backpack\CRUD\Tests\Unit\CrudPanel;
4
5
/**
6
 * @covers Backpack\CRUD\app\Library\CrudPanel\Traits\Settings
7
 */
8
class CrudPanelSettingsTest extends \Backpack\CRUD\Tests\config\CrudPanel\BaseCrudPanel
9
{   
10
    public function testItCanAddASettingToCrudPanel()
11
    {
12
        $this->crudPanel->set('create.test', 'value');
13
14
        $this->assertEquals('value', $this->crudPanel->get('create.test'));
15
    }
16
17
    public function testItCanCheckIfASettingExist()
18
    {
19
        $this->crudPanel->set('create.test', 'value');
20
21
        $this->assertTrue($this->crudPanel->has('create.test'));
22
        $this->assertFalse($this->crudPanel->has('create.test2'));
23
    }
24
25
    public function testItCanGetOrSetASetting()
26
    {
27
        $this->crudPanel->setting('create.test', 'value');
28
29
        $this->assertEquals('value', $this->crudPanel->setting('create.test'));
30
    }
31
32
    public function testItCanGetAllSettingOrderedByKey()
33
    {
34
        $this->crudPanel->set('create.test', 'value');
35
        $this->crudPanel->set('create.ambat', 'value2');
36
        $this->crudPanel->set('ambar.test', 'value3');
37
38
        $this->assertEquals([
39
            'ambar.test' => 'value3',
40
            'create.test' => 'value',
41
            'create.ambat' => 'value2',
42
        ], $this->crudPanel->settings());
43
    }
44
45
    public function testItCanSetOperationSettings()
46
    {
47
        $this->crudPanel->setOperation('create');
48
49
        $this->crudPanel->setOperationSetting('test', 'value');
50
        $this->crudPanel->setOperationSetting('test', 'value', 'list');
51
52
        $this->assertEquals('value', $this->crudPanel->get('create.test'));
53
        $this->assertEquals('value', $this->crudPanel->get('list.test'));
54
    }
55
56
    public function itCanCheckIfOperationSettingsExist()
57
    {
58
        $this->crudPanel->setOperation('create');
59
60
        $this->crudPanel->setOperationSetting('test', 'value');
61
        $this->crudPanel->setOperationSetting('test', 'value', 'list');
62
63
        $this->assertTrue('value', $this->crudPanel->hasOperationSetting('test'));
0 ignored issues
show
Bug introduced by
$this->crudPanel->hasOperationSetting('test') of type boolean is incompatible with the type string expected by parameter $message of PHPUnit\Framework\Assert::assertTrue(). ( Ignorable by Annotation )

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

63
        $this->assertTrue('value', /** @scrutinizer ignore-type */ $this->crudPanel->hasOperationSetting('test'));
Loading history...
64
        $this->assertTrue('value', $this->crudPanel->hasOperationSetting('test', 'list'));
65
    }
66
67
    public function testItGetsTheOperationListFromSettings() 
68
    {
69
        $this->crudPanel->set('create.access', 'value');
70
        $this->crudPanel->set('list.access', 'value2');
71
        $this->crudPanel->set('something', 'value');
72
        $this->crudPanel->set('whatever.not', 'value');
73
74
        $this->assertEquals(['create', 'list'], $this->invokeMethod($this->crudPanel, 'getAvailableOperationsList'));
75
    }
76
}
77