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 — dependabot/npm_and_yarn/tinymc... ( 9cd85d )
by
unknown
28:40 queued 13:43
created

CrudPanelFiltersTest   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 2
Metric Value
eloc 19
c 2
b 0
f 2
dl 0
loc 39
rs 10
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A testItEnablesTheFiltersButConsiderThemDisableIfEmpty() 0 4 1
A testItCanAddFiltersToCrudPanel() 0 5 1
A testItCanClearFilters() 0 6 1
A testItCanCheckIfFilterIsActiveFromRequest() 0 11 1
1
<?php
2
3
namespace Backpack\CRUD\Tests\Unit\CrudPanel;
4
5
use Backpack\CRUD\app\Library\CrudPanel\CrudFilter;
6
use Backpack\CRUD\Tests\Unit\Models\User;
7
8
/**
9
 * @covers Backpack\CRUD\app\Library\CrudPanel\Traits\Filters
10
 * @covers Backpack\CRUD\app\Library\CrudPanel\CrudFilter
11
 */
12
class CrudPanelFiltersTest extends BaseCrudPanelTest
13
{
14
    protected $testFilter = [[
15
        'name'  => 'my_filter',
16
        'label' => 'filter label',
17
    ], false, false, false];
18
19
    public function testItEnablesTheFiltersButConsiderThemDisableIfEmpty()
20
    {
21
        $this->crudPanel->enableFilters();
22
        $this->assertFalse($this->crudPanel->filtersEnabled());
23
    }
24
25
    public function testItCanAddFiltersToCrudPanel()
26
    {
27
        $this->crudPanel->addFilter(...$this->testFilter);
0 ignored issues
show
Bug introduced by
$this->testFilter is expanded, but the parameter $options of Backpack\CRUD\app\Librar...\CrudPanel::addFilter() does not expect variable arguments. ( Ignorable by Annotation )

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

27
        $this->crudPanel->addFilter(/** @scrutinizer ignore-type */ ...$this->testFilter);
Loading history...
28
29
        $this->assertCount(1, $this->crudPanel->filters());
30
    }
31
32
    public function testItCanClearFilters()
33
    {
34
        $this->crudPanel->addFilter(...$this->testFilter);
0 ignored issues
show
Bug introduced by
$this->testFilter is expanded, but the parameter $options of Backpack\CRUD\app\Librar...\CrudPanel::addFilter() does not expect variable arguments. ( Ignorable by Annotation )

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

34
        $this->crudPanel->addFilter(/** @scrutinizer ignore-type */ ...$this->testFilter);
Loading history...
35
36
        $this->crudPanel->clearFilters();
37
        $this->assertCount(0, $this->crudPanel->filters());
38
    }
39
40
    public function testItCanCheckIfFilterIsActiveFromRequest()
41
    {
42
        $this->crudPanel->setModel(User::class);
43
        $request = request()->create('/admin/users', 'GET', ['my_custom_filter' => 'foo']);
44
        $request->setRouteResolver(function () use ($request) {
45
            return (new Route('GET', 'admin/users', ['UserCrudController', 'index']))->bind($request);
0 ignored issues
show
Bug introduced by
The type Backpack\CRUD\Tests\Unit\CrudPanel\Route was not found. Did you mean Route? If so, make sure to prefix the type with \.
Loading history...
46
        });
47
        $this->crudPanel->setRequest($request);
48
49
        $isActive = CrudFilter::name('my_custom_filter')->isActive();
0 ignored issues
show
Bug introduced by
The method isActive() does not exist on Backpack\CRUD\app\Library\CrudPanel\CrudPanel. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

49
        $isActive = CrudFilter::name('my_custom_filter')->/** @scrutinizer ignore-call */ isActive();
Loading history...
50
        $this->assertTrue($isActive);
51
    }
52
}
53